From cc2d72352014b0365aba9b0a2f6bf5692f53802f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 5 Oct 2019 10:29:46 +0200 Subject: [PATCH] Apply clang-format to SUPL libraries --- src/core/libs/supl/asn-rrlp/Accuracy.c | 167 +- src/core/libs/supl/asn-rrlp/Accuracy.h | 1 - src/core/libs/supl/asn-rrlp/AccuracyOpt.c | 51 +- src/core/libs/supl/asn-rrlp/AccuracyOpt.h | 1 - src/core/libs/supl/asn-rrlp/AcquisAssist.c | 66 +- src/core/libs/supl/asn-rrlp/AcquisAssist.h | 1 - src/core/libs/supl/asn-rrlp/AcquisElement.c | 427 ++- src/core/libs/supl/asn-rrlp/AcquisElement.h | 1 - .../libs/supl/asn-rrlp/AddionalAngleFields.c | 168 +- .../libs/supl/asn-rrlp/AddionalAngleFields.h | 1 - .../supl/asn-rrlp/AddionalDopplerFields.c | 168 +- .../supl/asn-rrlp/AddionalDopplerFields.h | 1 - .../supl/asn-rrlp/AdditionalAssistanceData.c | 92 +- .../supl/asn-rrlp/AdditionalAssistanceData.h | 7 +- .../supl/asn-rrlp/AdditionalDopplerFields.c | 169 +- .../supl/asn-rrlp/AdditionalDopplerFields.h | 1 - src/core/libs/supl/asn-rrlp/AlertFlag.c | 167 +- src/core/libs/supl/asn-rrlp/AlertFlag.h | 1 - .../libs/supl/asn-rrlp/Almanac-KeplerianSet.c | 712 ++-- .../libs/supl/asn-rrlp/Almanac-KeplerianSet.h | 1 - src/core/libs/supl/asn-rrlp/Almanac.c | 115 +- src/core/libs/supl/asn-rrlp/Almanac.h | 1 - src/core/libs/supl/asn-rrlp/AlmanacElement.c | 796 +++-- src/core/libs/supl/asn-rrlp/AlmanacElement.h | 1 - src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c | 174 +- src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h | 1 - .../supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c | 67 +- .../supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h | 1 - src/core/libs/supl/asn-rrlp/AssistBTSData.c | 118 +- src/core/libs/supl/asn-rrlp/AssistBTSData.h | 1 - src/core/libs/supl/asn-rrlp/AssistanceData.c | 179 +- src/core/libs/supl/asn-rrlp/AssistanceData.h | 13 +- src/core/libs/supl/asn-rrlp/BCCHCarrier.c | 172 +- src/core/libs/supl/asn-rrlp/BCCHCarrier.h | 1 - src/core/libs/supl/asn-rrlp/BIT_STRING.c | 197 +- src/core/libs/supl/asn-rrlp/BOOLEAN.c | 322 +- src/core/libs/supl/asn-rrlp/BOOLEAN.h | 8 +- src/core/libs/supl/asn-rrlp/BSIC.c | 163 +- src/core/libs/supl/asn-rrlp/BSIC.h | 1 - src/core/libs/supl/asn-rrlp/BSICAndCarrier.c | 65 +- src/core/libs/supl/asn-rrlp/BSICAndCarrier.h | 1 - src/core/libs/supl/asn-rrlp/BTSPosition.c | 173 +- src/core/libs/supl/asn-rrlp/BTSPosition.h | 1 - .../libs/supl/asn-rrlp/BadSignalElement.c | 119 +- .../libs/supl/asn-rrlp/BadSignalElement.h | 1 - src/core/libs/supl/asn-rrlp/BitNumber.c | 167 +- src/core/libs/supl/asn-rrlp/BitNumber.h | 1 - .../libs/supl/asn-rrlp/CalcAssistanceBTS.c | 65 +- .../libs/supl/asn-rrlp/CalcAssistanceBTS.h | 1 - src/core/libs/supl/asn-rrlp/CellID.c | 163 +- src/core/libs/supl/asn-rrlp/CellID.h | 1 - src/core/libs/supl/asn-rrlp/CellIDAndLAC.c | 64 +- src/core/libs/supl/asn-rrlp/CellIDAndLAC.h | 1 - src/core/libs/supl/asn-rrlp/ControlHeader.c | 186 +- src/core/libs/supl/asn-rrlp/ControlHeader.h | 1 - .../libs/supl/asn-rrlp/DGANSSSgnElement.c | 317 +- .../libs/supl/asn-rrlp/DGANSSSgnElement.h | 1 - src/core/libs/supl/asn-rrlp/DGPSCorrections.c | 183 +- src/core/libs/supl/asn-rrlp/DGPSCorrections.h | 1 - src/core/libs/supl/asn-rrlp/ENUMERATED.c | 63 +- src/core/libs/supl/asn-rrlp/EOTDQuality.c | 168 +- src/core/libs/supl/asn-rrlp/EOTDQuality.h | 1 - .../libs/supl/asn-rrlp/EnvironmentCharacter.c | 167 +- .../libs/supl/asn-rrlp/EnvironmentCharacter.h | 5 +- .../asn-rrlp/EphemerisSubframe1Reserved.c | 304 +- .../asn-rrlp/EphemerisSubframe1Reserved.h | 1 - src/core/libs/supl/asn-rrlp/ErrorCodes.c | 173 +- src/core/libs/supl/asn-rrlp/ErrorCodes.h | 5 +- .../libs/supl/asn-rrlp/ExpOTDUncertainty.c | 178 +- .../libs/supl/asn-rrlp/ExpOTDUncertainty.h | 1 - src/core/libs/supl/asn-rrlp/ExpectedOTD.c | 172 +- src/core/libs/supl/asn-rrlp/ExpectedOTD.h | 1 - .../asn-rrlp/Ext-GeographicalInformation.c | 172 +- .../asn-rrlp/Ext-GeographicalInformation.h | 1 - .../libs/supl/asn-rrlp/Extended-reference.c | 167 +- .../libs/supl/asn-rrlp/Extended-reference.h | 1 - .../libs/supl/asn-rrlp/ExtensionContainer.c | 133 +- .../libs/supl/asn-rrlp/ExtensionContainer.h | 1 - src/core/libs/supl/asn-rrlp/FineRTD.c | 164 +- src/core/libs/supl/asn-rrlp/FineRTD.h | 1 - src/core/libs/supl/asn-rrlp/FixType.c | 164 +- src/core/libs/supl/asn-rrlp/FixType.h | 1 - src/core/libs/supl/asn-rrlp/FrameDrift.c | 168 +- src/core/libs/supl/asn-rrlp/FrameDrift.h | 1 - src/core/libs/supl/asn-rrlp/FrameNumber.c | 172 +- src/core/libs/supl/asn-rrlp/FrameNumber.h | 1 - .../libs/supl/asn-rrlp/GANSS-AssistData.c | 50 +- .../libs/supl/asn-rrlp/GANSS-AssistData.h | 1 - .../libs/supl/asn-rrlp/GANSS-ControlHeader.c | 73 +- .../libs/supl/asn-rrlp/GANSS-ControlHeader.h | 4 +- .../libs/supl/asn-rrlp/GANSS-MsrSetElement.c | 171 +- .../libs/supl/asn-rrlp/GANSS-MsrSetElement.h | 1 - .../libs/supl/asn-rrlp/GANSS-SgnElement.c | 541 ++- .../libs/supl/asn-rrlp/GANSS-SgnElement.h | 1 - .../libs/supl/asn-rrlp/GANSS-SgnTypeElement.c | 116 +- .../libs/supl/asn-rrlp/GANSS-SgnTypeElement.h | 1 - .../libs/supl/asn-rrlp/GANSSAlmanacElement.c | 43 +- .../libs/supl/asn-rrlp/GANSSAlmanacElement.h | 7 +- .../libs/supl/asn-rrlp/GANSSAlmanacModel.c | 270 +- .../libs/supl/asn-rrlp/GANSSAlmanacModel.h | 1 - .../libs/supl/asn-rrlp/GANSSAssistanceData.c | 176 +- .../libs/supl/asn-rrlp/GANSSAssistanceData.h | 1 - src/core/libs/supl/asn-rrlp/GANSSClockModel.c | 43 +- src/core/libs/supl/asn-rrlp/GANSSClockModel.h | 7 +- .../supl/asn-rrlp/GANSSCommonAssistData.c | 90 +- .../supl/asn-rrlp/GANSSCommonAssistData.h | 7 +- src/core/libs/supl/asn-rrlp/GANSSDataBit.c | 174 +- src/core/libs/supl/asn-rrlp/GANSSDataBit.h | 1 - .../libs/supl/asn-rrlp/GANSSDataBitAssist.c | 200 +- .../libs/supl/asn-rrlp/GANSSDataBitAssist.h | 1 - .../libs/supl/asn-rrlp/GANSSDiffCorrections.c | 116 +- .../libs/supl/asn-rrlp/GANSSDiffCorrections.h | 1 - .../asn-rrlp/GANSSGenericAssistDataElement.c | 268 +- .../asn-rrlp/GANSSGenericAssistDataElement.h | 10 +- .../libs/supl/asn-rrlp/GANSSIonoStormFlags.c | 367 +-- .../libs/supl/asn-rrlp/GANSSIonoStormFlags.h | 1 - .../libs/supl/asn-rrlp/GANSSIonosphereModel.c | 233 +- .../libs/supl/asn-rrlp/GANSSIonosphereModel.h | 1 - .../supl/asn-rrlp/GANSSIonosphericModel.c | 71 +- .../supl/asn-rrlp/GANSSIonosphericModel.h | 7 +- .../libs/supl/asn-rrlp/GANSSLocationInfo.c | 340 +- .../libs/supl/asn-rrlp/GANSSLocationInfo.h | 7 +- .../libs/supl/asn-rrlp/GANSSMeasureInfo.c | 49 +- .../libs/supl/asn-rrlp/GANSSMeasureInfo.h | 1 - src/core/libs/supl/asn-rrlp/GANSSNavModel.c | 323 +- src/core/libs/supl/asn-rrlp/GANSSNavModel.h | 1 - src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c | 41 +- src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h | 7 +- .../supl/asn-rrlp/GANSSPositioningMethod.c | 190 +- .../supl/asn-rrlp/GANSSPositioningMethod.h | 1 - .../supl/asn-rrlp/GANSSRealTimeIntegrity.c | 51 +- .../supl/asn-rrlp/GANSSRealTimeIntegrity.h | 1 - .../libs/supl/asn-rrlp/GANSSRefLocation.c | 49 +- .../libs/supl/asn-rrlp/GANSSRefLocation.h | 1 - .../supl/asn-rrlp/GANSSRefMeasurementAssist.c | 121 +- .../supl/asn-rrlp/GANSSRefMeasurementAssist.h | 1 - .../asn-rrlp/GANSSRefMeasurementElement.c | 362 +- .../asn-rrlp/GANSSRefMeasurementElement.h | 7 +- .../libs/supl/asn-rrlp/GANSSRefTimeInfo.c | 205 +- .../libs/supl/asn-rrlp/GANSSRefTimeInfo.h | 1 - .../libs/supl/asn-rrlp/GANSSReferenceTime.c | 72 +- .../libs/supl/asn-rrlp/GANSSReferenceTime.h | 4 +- .../supl/asn-rrlp/GANSSSatelliteElement.c | 217 +- .../supl/asn-rrlp/GANSSSatelliteElement.h | 7 +- src/core/libs/supl/asn-rrlp/GANSSSignalID.c | 174 +- src/core/libs/supl/asn-rrlp/GANSSSignalID.h | 1 - .../asn-rrlp/GANSSTOD-GSMTimeAssociation.c | 133 +- .../asn-rrlp/GANSSTOD-GSMTimeAssociation.h | 1 - src/core/libs/supl/asn-rrlp/GANSSTOD.c | 167 +- src/core/libs/supl/asn-rrlp/GANSSTOD.h | 1 - .../libs/supl/asn-rrlp/GANSSTODUncertainty.c | 176 +- .../libs/supl/asn-rrlp/GANSSTODUncertainty.h | 1 - src/core/libs/supl/asn-rrlp/GANSSTODm.c | 167 +- src/core/libs/supl/asn-rrlp/GANSSTODm.h | 1 - .../supl/asn-rrlp/GANSSTimeModelElement.c | 289 +- .../supl/asn-rrlp/GANSSTimeModelElement.h | 1 - src/core/libs/supl/asn-rrlp/GANSSUTCModel.c | 576 ++-- src/core/libs/supl/asn-rrlp/GANSSUTCModel.h | 1 - src/core/libs/supl/asn-rrlp/GPS-AssistData.c | 49 +- src/core/libs/supl/asn-rrlp/GPS-AssistData.h | 1 - src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c | 49 +- src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h | 1 - src/core/libs/supl/asn-rrlp/GPS-MsrElement.c | 403 ++- src/core/libs/supl/asn-rrlp/GPS-MsrElement.h | 1 - .../libs/supl/asn-rrlp/GPS-MsrSetElement.c | 136 +- .../libs/supl/asn-rrlp/GPS-MsrSetElement.h | 1 - .../libs/supl/asn-rrlp/GPSAssistanceData.c | 178 +- .../libs/supl/asn-rrlp/GPSAssistanceData.h | 1 - .../asn-rrlp/GPSReferenceTimeUncertainty.c | 172 +- .../asn-rrlp/GPSReferenceTimeUncertainty.h | 1 - src/core/libs/supl/asn-rrlp/GPSTOW23b.c | 167 +- src/core/libs/supl/asn-rrlp/GPSTOW23b.h | 1 - src/core/libs/supl/asn-rrlp/GPSTOW24b.c | 167 +- src/core/libs/supl/asn-rrlp/GPSTOW24b.h | 1 - src/core/libs/supl/asn-rrlp/GPSTOWAssist.c | 46 +- src/core/libs/supl/asn-rrlp/GPSTOWAssist.h | 1 - .../libs/supl/asn-rrlp/GPSTOWAssistElement.c | 115 +- .../libs/supl/asn-rrlp/GPSTOWAssistElement.h | 1 - src/core/libs/supl/asn-rrlp/GPSTime.c | 62 +- src/core/libs/supl/asn-rrlp/GPSTime.h | 1 - .../asn-rrlp/GPSTimeAssistanceMeasurements.c | 273 +- .../asn-rrlp/GPSTimeAssistanceMeasurements.h | 4 +- src/core/libs/supl/asn-rrlp/GPSWeek.c | 164 +- src/core/libs/supl/asn-rrlp/GPSWeek.h | 1 - src/core/libs/supl/asn-rrlp/GSMTime.c | 112 +- src/core/libs/supl/asn-rrlp/GSMTime.h | 1 - src/core/libs/supl/asn-rrlp/INTEGER.c | 1360 ++++---- src/core/libs/supl/asn-rrlp/INTEGER.h | 23 +- .../libs/supl/asn-rrlp/IonosphericModel.c | 568 ++-- .../libs/supl/asn-rrlp/IonosphericModel.h | 1 - src/core/libs/supl/asn-rrlp/LAC.c | 163 +- src/core/libs/supl/asn-rrlp/LAC.h | 1 - src/core/libs/supl/asn-rrlp/LocErrorReason.c | 212 +- src/core/libs/supl/asn-rrlp/LocErrorReason.h | 5 +- src/core/libs/supl/asn-rrlp/LocationError.c | 70 +- src/core/libs/supl/asn-rrlp/LocationError.h | 10 +- src/core/libs/supl/asn-rrlp/LocationInfo.c | 203 +- src/core/libs/supl/asn-rrlp/LocationInfo.h | 1 - .../libs/supl/asn-rrlp/MeasureResponseTime.c | 176 +- .../libs/supl/asn-rrlp/MeasureResponseTime.h | 1 - src/core/libs/supl/asn-rrlp/MethodType.c | 89 +- src/core/libs/supl/asn-rrlp/MethodType.h | 1 - src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c | 175 +- src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h | 1 - .../libs/supl/asn-rrlp/MoreAssDataToBeSent.c | 163 +- .../libs/supl/asn-rrlp/MoreAssDataToBeSent.h | 1 - src/core/libs/supl/asn-rrlp/MpathIndic.c | 161 +- src/core/libs/supl/asn-rrlp/MpathIndic.h | 1 - .../supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c | 67 +- .../supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h | 1 - src/core/libs/supl/asn-rrlp/MsrAssistBTS.c | 135 +- src/core/libs/supl/asn-rrlp/MsrAssistBTS.h | 1 - .../supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c | 51 +- .../supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h | 1 - src/core/libs/supl/asn-rrlp/MsrAssistData.c | 49 +- src/core/libs/supl/asn-rrlp/MsrAssistData.h | 1 - src/core/libs/supl/asn-rrlp/MsrPosition-Req.c | 178 +- src/core/libs/supl/asn-rrlp/MsrPosition-Req.h | 13 +- src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c | 193 +- src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h | 13 +- .../libs/supl/asn-rrlp/MultiFrameCarrier.c | 66 +- .../libs/supl/asn-rrlp/MultiFrameCarrier.h | 1 - .../libs/supl/asn-rrlp/MultiFrameOffset.c | 177 +- .../libs/supl/asn-rrlp/MultiFrameOffset.h | 1 - src/core/libs/supl/asn-rrlp/MultipleSets.c | 188 +- src/core/libs/supl/asn-rrlp/MultipleSets.h | 1 - src/core/libs/supl/asn-rrlp/NULL.c | 130 +- src/core/libs/supl/asn-rrlp/NULL.h | 6 +- .../libs/supl/asn-rrlp/NativeEnumerated.c | 242 +- src/core/libs/supl/asn-rrlp/NativeInteger.c | 321 +- .../supl/asn-rrlp/NavModel-KeplerianSet.c | 1130 +++---- .../supl/asn-rrlp/NavModel-KeplerianSet.h | 1 - src/core/libs/supl/asn-rrlp/NavModelElement.c | 65 +- src/core/libs/supl/asn-rrlp/NavModelElement.h | 1 - src/core/libs/supl/asn-rrlp/NavigationModel.c | 49 +- src/core/libs/supl/asn-rrlp/NavigationModel.h | 1 - .../libs/supl/asn-rrlp/NeighborIdentity.c | 127 +- .../libs/supl/asn-rrlp/NeighborIdentity.h | 1 - .../libs/supl/asn-rrlp/NumOfMeasurements.c | 178 +- .../libs/supl/asn-rrlp/NumOfMeasurements.h | 1 - src/core/libs/supl/asn-rrlp/OCTET_STRING.c | 2899 +++++++++-------- src/core/libs/supl/asn-rrlp/OCTET_STRING.h | 38 +- .../libs/supl/asn-rrlp/OTD-FirstSetMsrs.c | 134 +- .../libs/supl/asn-rrlp/OTD-FirstSetMsrs.h | 1 - .../supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c | 172 +- .../supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h | 1 - .../supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c | 51 +- .../supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h | 1 - src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c | 69 +- src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h | 1 - src/core/libs/supl/asn-rrlp/OTD-Measurement.c | 82 +- src/core/libs/supl/asn-rrlp/OTD-Measurement.h | 1 - .../supl/asn-rrlp/OTD-MeasurementWithID.c | 99 +- .../supl/asn-rrlp/OTD-MeasurementWithID.h | 1 - .../asn-rrlp/OTD-MsrElementFirst-R98-Ext.c | 54 +- .../asn-rrlp/OTD-MsrElementFirst-R98-Ext.h | 4 +- .../libs/supl/asn-rrlp/OTD-MsrElementFirst.c | 240 +- .../libs/supl/asn-rrlp/OTD-MsrElementFirst.h | 1 - .../libs/supl/asn-rrlp/OTD-MsrElementRest.c | 241 +- .../libs/supl/asn-rrlp/OTD-MsrElementRest.h | 1 - .../libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c | 61 +- .../libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h | 1 - src/core/libs/supl/asn-rrlp/OTDValue.c | 167 +- src/core/libs/supl/asn-rrlp/OTDValue.h | 1 - src/core/libs/supl/asn-rrlp/PDU.c | 114 +- src/core/libs/supl/asn-rrlp/PDU.h | 1 - src/core/libs/supl/asn-rrlp/PositionData.c | 189 +- src/core/libs/supl/asn-rrlp/PositionData.h | 1 - .../libs/supl/asn-rrlp/PositionInstruct.c | 121 +- .../libs/supl/asn-rrlp/PositionInstruct.h | 1 - src/core/libs/supl/asn-rrlp/PositionMethod.c | 165 +- src/core/libs/supl/asn-rrlp/PositionMethod.h | 1 - src/core/libs/supl/asn-rrlp/ProtocolError.c | 88 +- src/core/libs/supl/asn-rrlp/ProtocolError.h | 10 +- src/core/libs/supl/asn-rrlp/RRLP-Component.c | 108 +- src/core/libs/supl/asn-rrlp/RRLP-Component.h | 7 +- src/core/libs/supl/asn-rrlp/RefLocation.c | 49 +- src/core/libs/supl/asn-rrlp/RefLocation.h | 1 - src/core/libs/supl/asn-rrlp/RefQuality.c | 168 +- src/core/libs/supl/asn-rrlp/RefQuality.h | 1 - .../libs/supl/asn-rrlp/ReferenceAssistData.c | 102 +- .../libs/supl/asn-rrlp/ReferenceAssistData.h | 1 - src/core/libs/supl/asn-rrlp/ReferenceFrame.c | 170 +- src/core/libs/supl/asn-rrlp/ReferenceFrame.h | 1 - .../libs/supl/asn-rrlp/ReferenceIdentity.c | 49 +- .../libs/supl/asn-rrlp/ReferenceIdentity.h | 1 - .../supl/asn-rrlp/ReferenceIdentityType.c | 111 +- .../supl/asn-rrlp/ReferenceIdentityType.h | 1 - .../libs/supl/asn-rrlp/ReferenceRelation.c | 170 +- .../libs/supl/asn-rrlp/ReferenceRelation.h | 1 - src/core/libs/supl/asn-rrlp/ReferenceTime.c | 84 +- src/core/libs/supl/asn-rrlp/ReferenceTime.h | 1 - src/core/libs/supl/asn-rrlp/ReferenceWGS84.c | 86 +- src/core/libs/supl/asn-rrlp/ReferenceWGS84.h | 1 - .../Rel-5-MsrPosition-Rsp-Extension.c | 104 +- .../Rel-5-MsrPosition-Rsp-Extension.h | 7 +- .../asn-rrlp/Rel-5-ProtocolError-Extension.c | 66 +- .../asn-rrlp/Rel-5-ProtocolError-Extension.h | 7 +- .../Rel-7-MsrPosition-Rsp-Extension.c | 103 +- .../Rel-7-MsrPosition-Rsp-Extension.h | 7 +- .../Rel-98-MsrPosition-Rsp-Extension.c | 168 +- .../Rel-98-MsrPosition-Rsp-Extension.h | 13 +- .../asn-rrlp/Rel5-AssistanceData-Extension.c | 63 +- .../asn-rrlp/Rel5-AssistanceData-Extension.h | 7 +- .../asn-rrlp/Rel5-MsrPosition-Req-Extension.c | 63 +- .../asn-rrlp/Rel5-MsrPosition-Req-Extension.h | 7 +- .../asn-rrlp/Rel7-AssistanceData-Extension.c | 104 +- .../asn-rrlp/Rel7-AssistanceData-Extension.h | 7 +- .../asn-rrlp/Rel7-MsrPosition-Req-Extension.c | 160 +- .../asn-rrlp/Rel7-MsrPosition-Req-Extension.h | 7 +- .../asn-rrlp/Rel98-AssistanceData-Extension.c | 105 +- .../asn-rrlp/Rel98-AssistanceData-Extension.h | 10 +- .../libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c | 73 +- .../libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h | 7 +- .../Rel98-MsrPosition-Req-Extension.c | 105 +- .../Rel98-MsrPosition-Req-Extension.h | 10 +- src/core/libs/supl/asn-rrlp/RelDistance.c | 172 +- src/core/libs/supl/asn-rrlp/RelDistance.h | 1 - src/core/libs/supl/asn-rrlp/RelativeAlt.c | 172 +- src/core/libs/supl/asn-rrlp/RelativeAlt.h | 1 - src/core/libs/supl/asn-rrlp/RequestIndex.c | 174 +- src/core/libs/supl/asn-rrlp/RequestIndex.h | 1 - .../libs/supl/asn-rrlp/RequiredResponseTime.c | 176 +- .../libs/supl/asn-rrlp/RequiredResponseTime.h | 1 - src/core/libs/supl/asn-rrlp/RoughRTD.c | 167 +- src/core/libs/supl/asn-rrlp/RoughRTD.h | 1 - src/core/libs/supl/asn-rrlp/SVID.c | 163 +- src/core/libs/supl/asn-rrlp/SVID.h | 1 - src/core/libs/supl/asn-rrlp/SVIDMASK.c | 182 +- src/core/libs/supl/asn-rrlp/SVIDMASK.h | 1 - src/core/libs/supl/asn-rrlp/SatElement.c | 590 ++-- src/core/libs/supl/asn-rrlp/SatElement.h | 1 - src/core/libs/supl/asn-rrlp/SatStatus.c | 76 +- src/core/libs/supl/asn-rrlp/SatStatus.h | 7 +- src/core/libs/supl/asn-rrlp/SatelliteID.c | 172 +- src/core/libs/supl/asn-rrlp/SatelliteID.h | 1 - .../supl/asn-rrlp/SeqOf-BadSatelliteSet.c | 43 +- .../supl/asn-rrlp/SeqOf-BadSatelliteSet.h | 1 - .../libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c | 43 +- .../libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h | 1 - .../libs/supl/asn-rrlp/SeqOfAcquisElement.c | 43 +- .../libs/supl/asn-rrlp/SeqOfAcquisElement.h | 1 - .../libs/supl/asn-rrlp/SeqOfAlmanacElement.c | 43 +- .../libs/supl/asn-rrlp/SeqOfAlmanacElement.h | 1 - .../supl/asn-rrlp/SeqOfBadSignalElement.c | 43 +- .../supl/asn-rrlp/SeqOfBadSignalElement.h | 1 - .../supl/asn-rrlp/SeqOfDGANSSSgnElement.c | 43 +- .../supl/asn-rrlp/SeqOfDGANSSSgnElement.h | 1 - .../supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c | 46 +- .../supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h | 1 - .../supl/asn-rrlp/SeqOfGANSS-SgnElement.c | 43 +- .../supl/asn-rrlp/SeqOfGANSS-SgnElement.h | 1 - .../supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c | 46 +- .../supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h | 1 - .../supl/asn-rrlp/SeqOfGANSSAlmanacElement.c | 46 +- .../supl/asn-rrlp/SeqOfGANSSAlmanacElement.h | 1 - .../SeqOfGANSSGenericAssistDataElement.c | 53 +- .../SeqOfGANSSGenericAssistDataElement.h | 1 - .../SeqOfGANSSRefMeasurementElement.c | 53 +- .../SeqOfGANSSRefMeasurementElement.h | 1 - .../asn-rrlp/SeqOfGANSSSatelliteElement.c | 46 +- .../asn-rrlp/SeqOfGANSSSatelliteElement.h | 1 - .../libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c | 43 +- .../libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h | 1 - .../libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c | 43 +- .../libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h | 1 - .../supl/asn-rrlp/SeqOfGPS-MsrSetElement.c | 46 +- .../supl/asn-rrlp/SeqOfGPS-MsrSetElement.h | 1 - .../asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c | 46 +- .../asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h | 1 - .../libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c | 43 +- .../libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h | 1 - .../libs/supl/asn-rrlp/SeqOfNavModelElement.c | 43 +- .../libs/supl/asn-rrlp/SeqOfNavModelElement.h | 1 - .../asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c | 46 +- .../asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h | 1 - .../supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c | 43 +- .../supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h | 1 - .../supl/asn-rrlp/SeqOfOTD-MsrElementRest.c | 46 +- .../supl/asn-rrlp/SeqOfOTD-MsrElementRest.h | 1 - .../supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c | 46 +- .../supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h | 1 - .../asn-rrlp/SeqOfReferenceIdentityType.c | 46 +- .../asn-rrlp/SeqOfReferenceIdentityType.h | 1 - src/core/libs/supl/asn-rrlp/SeqOfSatElement.c | 45 +- src/core/libs/supl/asn-rrlp/SeqOfSatElement.h | 1 - .../libs/supl/asn-rrlp/SeqOfSgnTypeElement.c | 43 +- .../libs/supl/asn-rrlp/SeqOfSgnTypeElement.h | 1 - .../asn-rrlp/SeqOfStandardClockModelElement.c | 46 +- .../asn-rrlp/SeqOfStandardClockModelElement.h | 1 - .../SeqOfSystemInfoAssistBTS-R98-ExpOTD.c | 53 +- .../SeqOfSystemInfoAssistBTS-R98-ExpOTD.h | 1 - .../supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c | 46 +- .../supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h | 1 - src/core/libs/supl/asn-rrlp/SgnTypeElement.c | 137 +- src/core/libs/supl/asn-rrlp/SgnTypeElement.h | 1 - .../supl/asn-rrlp/StandardClockModelElement.c | 444 +-- .../supl/asn-rrlp/StandardClockModelElement.h | 7 +- src/core/libs/supl/asn-rrlp/StdResolution.c | 174 +- src/core/libs/supl/asn-rrlp/StdResolution.h | 1 - .../asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c | 65 +- .../asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h | 1 - .../libs/supl/asn-rrlp/SystemInfoAssistBTS.c | 57 +- .../libs/supl/asn-rrlp/SystemInfoAssistBTS.h | 1 - .../SystemInfoAssistData-R98-ExpOTD.c | 64 +- .../SystemInfoAssistData-R98-ExpOTD.h | 1 - .../libs/supl/asn-rrlp/SystemInfoAssistData.c | 51 +- .../libs/supl/asn-rrlp/SystemInfoAssistData.h | 1 - src/core/libs/supl/asn-rrlp/SystemInfoIndex.c | 176 +- src/core/libs/supl/asn-rrlp/SystemInfoIndex.h | 1 - src/core/libs/supl/asn-rrlp/TA0.c | 164 +- src/core/libs/supl/asn-rrlp/TA0.h | 1 - src/core/libs/supl/asn-rrlp/TA1.c | 163 +- src/core/libs/supl/asn-rrlp/TA1.h | 1 - src/core/libs/supl/asn-rrlp/TA2.c | 163 +- src/core/libs/supl/asn-rrlp/TA2.h | 1 - src/core/libs/supl/asn-rrlp/TLMReservedBits.c | 176 +- src/core/libs/supl/asn-rrlp/TLMReservedBits.h | 1 - src/core/libs/supl/asn-rrlp/TLMWord.c | 164 +- src/core/libs/supl/asn-rrlp/TLMWord.h | 1 - .../supl/asn-rrlp/TOA-MeasurementsOfRef.c | 65 +- .../supl/asn-rrlp/TOA-MeasurementsOfRef.h | 1 - src/core/libs/supl/asn-rrlp/TimeRelation.c | 67 +- src/core/libs/supl/asn-rrlp/TimeRelation.h | 1 - src/core/libs/supl/asn-rrlp/TimeSlot.c | 167 +- src/core/libs/supl/asn-rrlp/TimeSlot.h | 1 - src/core/libs/supl/asn-rrlp/TimeSlotScheme.c | 162 +- src/core/libs/supl/asn-rrlp/TimeSlotScheme.h | 1 - src/core/libs/supl/asn-rrlp/UTCModel.c | 572 ++-- src/core/libs/supl/asn-rrlp/UTCModel.h | 1 - src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c | 162 +- src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h | 1 - .../supl/asn-rrlp/UncompressedEphemeris.c | 2305 ++++++------- .../supl/asn-rrlp/UncompressedEphemeris.h | 7 +- src/core/libs/supl/asn-rrlp/UseMultipleSets.c | 163 +- src/core/libs/supl/asn-rrlp/UseMultipleSets.h | 1 - .../libs/supl/asn-rrlp/VelocityEstimate.c | 134 +- .../libs/supl/asn-rrlp/VelocityEstimate.h | 1 - src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c | 55 +- src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h | 25 +- src/core/libs/supl/asn-rrlp/asn_SET_OF.c | 110 +- src/core/libs/supl/asn-rrlp/asn_SET_OF.h | 41 +- src/core/libs/supl/asn-rrlp/asn_application.h | 31 +- src/core/libs/supl/asn-rrlp/asn_codecs.h | 68 +- src/core/libs/supl/asn-rrlp/asn_codecs_prim.c | 355 +- src/core/libs/supl/asn-rrlp/asn_codecs_prim.h | 26 +- src/core/libs/supl/asn-rrlp/asn_internal.h | 58 +- src/core/libs/supl/asn-rrlp/asn_system.h | 12 +- src/core/libs/supl/asn-rrlp/ber_decoder.c | 448 +-- src/core/libs/supl/asn-rrlp/ber_decoder.h | 40 +- src/core/libs/supl/asn-rrlp/ber_tlv_length.c | 229 +- src/core/libs/supl/asn-rrlp/ber_tlv_length.h | 47 +- src/core/libs/supl/asn-rrlp/ber_tlv_tag.c | 164 +- src/core/libs/supl/asn-rrlp/ber_tlv_tag.h | 39 +- src/core/libs/supl/asn-rrlp/constr_CHOICE.c | 1696 +++++----- src/core/libs/supl/asn-rrlp/constr_CHOICE.h | 16 +- src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c | 2311 +++++++------ src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h | 23 +- .../libs/supl/asn-rrlp/constr_SEQUENCE_OF.c | 273 +- src/core/libs/supl/asn-rrlp/constr_SET_OF.c | 1336 ++++---- src/core/libs/supl/asn-rrlp/constr_SET_OF.h | 8 +- src/core/libs/supl/asn-rrlp/constr_TYPE.c | 46 +- src/core/libs/supl/asn-rrlp/constr_TYPE.h | 133 +- src/core/libs/supl/asn-rrlp/constraints.c | 96 +- src/core/libs/supl/asn-rrlp/constraints.h | 43 +- .../libs/supl/asn-rrlp/converter-sample.c | 1389 ++++---- src/core/libs/supl/asn-rrlp/der_encoder.c | 214 +- src/core/libs/supl/asn-rrlp/der_encoder.h | 45 +- src/core/libs/supl/asn-rrlp/per_decoder.c | 119 +- src/core/libs/supl/asn-rrlp/per_decoder.h | 47 +- src/core/libs/supl/asn-rrlp/per_encoder.c | 146 +- src/core/libs/supl/asn-rrlp/per_encoder.h | 42 +- src/core/libs/supl/asn-rrlp/per_opentype.c | 138 +- src/core/libs/supl/asn-rrlp/per_opentype.h | 9 +- src/core/libs/supl/asn-rrlp/per_support.c | 738 ++--- src/core/libs/supl/asn-rrlp/per_support.h | 87 +- src/core/libs/supl/asn-rrlp/xer_decoder.c | 545 ++-- src/core/libs/supl/asn-rrlp/xer_decoder.h | 78 +- src/core/libs/supl/asn-rrlp/xer_encoder.c | 31 +- src/core/libs/supl/asn-rrlp/xer_encoder.h | 35 +- src/core/libs/supl/asn-rrlp/xer_support.c | 393 +-- src/core/libs/supl/asn-rrlp/xer_support.h | 41 +- src/core/libs/supl/asn-supl/AltitudeInfo.c | 356 +- src/core/libs/supl/asn-supl/AltitudeInfo.h | 10 +- src/core/libs/supl/asn-supl/BIT_STRING.c | 196 +- src/core/libs/supl/asn-supl/BOOLEAN.c | 320 +- src/core/libs/supl/asn-supl/BOOLEAN.h | 8 +- src/core/libs/supl/asn-supl/CPICH-Ec-N0.c | 165 +- src/core/libs/supl/asn-supl/CPICH-Ec-N0.h | 1 - src/core/libs/supl/asn-supl/CPICH-RSCP.c | 161 +- src/core/libs/supl/asn-supl/CPICH-RSCP.h | 1 - .../libs/supl/asn-supl/CdmaCellInformation.c | 524 ++- .../libs/supl/asn-supl/CdmaCellInformation.h | 7 +- src/core/libs/supl/asn-supl/CellInfo.c | 74 +- src/core/libs/supl/asn-supl/CellInfo.h | 7 +- .../libs/supl/asn-supl/CellMeasuredResults.c | 471 ++- .../libs/supl/asn-supl/CellMeasuredResults.h | 91 +- .../supl/asn-supl/CellMeasuredResultsList.c | 45 +- .../supl/asn-supl/CellMeasuredResultsList.h | 1 - .../libs/supl/asn-supl/CellParametersID.c | 170 +- .../libs/supl/asn-supl/CellParametersID.h | 1 - src/core/libs/supl/asn-supl/DUMMY.c | 119 +- src/core/libs/supl/asn-supl/DUMMY.h | 1 - src/core/libs/supl/asn-supl/ENUMERATED.c | 62 +- src/core/libs/supl/asn-supl/EncodingType.c | 164 +- src/core/libs/supl/asn-supl/EncodingType.h | 5 +- src/core/libs/supl/asn-supl/FQDN.c | 225 +- src/core/libs/supl/asn-supl/FQDN.h | 1 - src/core/libs/supl/asn-supl/FormatIndicator.c | 188 +- src/core/libs/supl/asn-supl/FormatIndicator.h | 5 +- src/core/libs/supl/asn-supl/FrequencyInfo.c | 136 +- src/core/libs/supl/asn-supl/FrequencyInfo.h | 13 +- .../libs/supl/asn-supl/FrequencyInfoFDD.c | 67 +- .../libs/supl/asn-supl/FrequencyInfoFDD.h | 7 +- .../libs/supl/asn-supl/FrequencyInfoTDD.c | 48 +- .../libs/supl/asn-supl/FrequencyInfoTDD.h | 7 +- src/core/libs/supl/asn-supl/GeneralizedTime.c | 968 +++--- src/core/libs/supl/asn-supl/GeneralizedTime.h | 58 +- .../libs/supl/asn-supl/GsmCellInformation.c | 386 ++- .../libs/supl/asn-supl/GsmCellInformation.h | 7 +- src/core/libs/supl/asn-supl/Horandveruncert.c | 194 +- src/core/libs/supl/asn-supl/Horandveruncert.h | 7 +- src/core/libs/supl/asn-supl/Horandvervel.c | 140 +- src/core/libs/supl/asn-supl/Horandvervel.h | 7 +- src/core/libs/supl/asn-supl/Horvel.c | 74 +- src/core/libs/supl/asn-supl/Horvel.h | 7 +- src/core/libs/supl/asn-supl/Horveluncert.c | 110 +- src/core/libs/supl/asn-supl/Horveluncert.h | 7 +- src/core/libs/supl/asn-supl/IA5String.c | 86 +- src/core/libs/supl/asn-supl/IA5String.h | 4 +- src/core/libs/supl/asn-supl/INTEGER.c | 1360 ++++---- src/core/libs/supl/asn-supl/INTEGER.h | 23 +- src/core/libs/supl/asn-supl/IPAddress.c | 63 +- src/core/libs/supl/asn-supl/IPAddress.h | 1 - src/core/libs/supl/asn-supl/KeyIdentity.c | 93 +- src/core/libs/supl/asn-supl/KeyIdentity.h | 1 - src/core/libs/supl/asn-supl/KeyIdentity4.c | 95 +- src/core/libs/supl/asn-supl/KeyIdentity4.h | 1 - src/core/libs/supl/asn-supl/LocationId.c | 64 +- src/core/libs/supl/asn-supl/LocationId.h | 7 +- src/core/libs/supl/asn-supl/MAC.c | 82 +- src/core/libs/supl/asn-supl/MAC.h | 1 - src/core/libs/supl/asn-supl/MeasuredResults.c | 87 +- src/core/libs/supl/asn-supl/MeasuredResults.h | 1 - .../libs/supl/asn-supl/MeasuredResultsList.c | 43 +- .../libs/supl/asn-supl/MeasuredResultsList.h | 1 - src/core/libs/supl/asn-supl/NMR.c | 43 +- src/core/libs/supl/asn-supl/NMR.h | 1 - src/core/libs/supl/asn-supl/NMRelement.c | 233 +- src/core/libs/supl/asn-supl/NMRelement.h | 7 +- .../libs/supl/asn-supl/NativeEnumerated.c | 242 +- src/core/libs/supl/asn-supl/NativeInteger.c | 321 +- src/core/libs/supl/asn-supl/Notification.c | 239 +- src/core/libs/supl/asn-supl/Notification.h | 7 +- .../libs/supl/asn-supl/NotificationType.c | 178 +- .../libs/supl/asn-supl/NotificationType.h | 5 +- src/core/libs/supl/asn-supl/OCTET_STRING.c | 2899 +++++++++-------- src/core/libs/supl/asn-supl/OCTET_STRING.h | 38 +- src/core/libs/supl/asn-supl/Pathloss.c | 167 +- src/core/libs/supl/asn-supl/Pathloss.h | 1 - src/core/libs/supl/asn-supl/PosMethod.c | 188 +- src/core/libs/supl/asn-supl/PosMethod.h | 5 +- src/core/libs/supl/asn-supl/PosPayLoad.c | 227 +- src/core/libs/supl/asn-supl/PosPayLoad.h | 7 +- src/core/libs/supl/asn-supl/PosProtocol.c | 80 +- src/core/libs/supl/asn-supl/PosProtocol.h | 7 +- src/core/libs/supl/asn-supl/PosTechnology.c | 144 +- src/core/libs/supl/asn-supl/PosTechnology.h | 7 +- src/core/libs/supl/asn-supl/Position.c | 84 +- src/core/libs/supl/asn-supl/Position.h | 7 +- .../libs/supl/asn-supl/PositionEstimate.c | 746 ++--- .../libs/supl/asn-supl/PositionEstimate.h | 10 +- src/core/libs/supl/asn-supl/PrefMethod.c | 160 +- src/core/libs/supl/asn-supl/PrefMethod.h | 1 - .../libs/supl/asn-supl/PrimaryCCPCH-RSCP.c | 178 +- .../libs/supl/asn-supl/PrimaryCCPCH-RSCP.h | 1 - .../libs/supl/asn-supl/PrimaryCPICH-Info.c | 101 +- .../libs/supl/asn-supl/PrimaryCPICH-Info.h | 1 - src/core/libs/supl/asn-supl/QoP.c | 302 +- src/core/libs/supl/asn-supl/QoP.h | 7 +- .../libs/supl/asn-supl/RequestedAssistData.c | 211 +- .../libs/supl/asn-supl/RequestedAssistData.h | 7 +- src/core/libs/supl/asn-supl/SETAuthKey.c | 63 +- src/core/libs/supl/asn-supl/SETAuthKey.h | 7 +- src/core/libs/supl/asn-supl/SETCapabilities.c | 82 +- src/core/libs/supl/asn-supl/SETCapabilities.h | 7 +- src/core/libs/supl/asn-supl/SETId.c | 159 +- src/core/libs/supl/asn-supl/SETId.h | 7 +- src/core/libs/supl/asn-supl/SLPAddress.c | 56 +- src/core/libs/supl/asn-supl/SLPAddress.h | 7 +- src/core/libs/supl/asn-supl/SLPMode.c | 151 +- src/core/libs/supl/asn-supl/SLPMode.h | 1 - src/core/libs/supl/asn-supl/SUPLEND.c | 81 +- src/core/libs/supl/asn-supl/SUPLEND.h | 7 +- src/core/libs/supl/asn-supl/SUPLINIT.c | 149 +- src/core/libs/supl/asn-supl/SUPLINIT.h | 7 +- src/core/libs/supl/asn-supl/SUPLPOS.c | 65 +- src/core/libs/supl/asn-supl/SUPLPOS.h | 7 +- src/core/libs/supl/asn-supl/SUPLPOSINIT.c | 134 +- src/core/libs/supl/asn-supl/SUPLPOSINIT.h | 7 +- src/core/libs/supl/asn-supl/SUPLRESPONSE.c | 100 +- src/core/libs/supl/asn-supl/SUPLRESPONSE.h | 7 +- src/core/libs/supl/asn-supl/SUPLSTART.c | 84 +- src/core/libs/supl/asn-supl/SUPLSTART.h | 7 +- src/core/libs/supl/asn-supl/SatelliteInfo.c | 46 +- src/core/libs/supl/asn-supl/SatelliteInfo.h | 1 - .../libs/supl/asn-supl/SatelliteInfoElement.c | 166 +- .../libs/supl/asn-supl/SatelliteInfoElement.h | 7 +- src/core/libs/supl/asn-supl/SessionID.c | 69 +- src/core/libs/supl/asn-supl/SessionID.h | 1 - src/core/libs/supl/asn-supl/SetSessionID.c | 116 +- src/core/libs/supl/asn-supl/SetSessionID.h | 1 - src/core/libs/supl/asn-supl/SlpSessionID.c | 61 +- src/core/libs/supl/asn-supl/SlpSessionID.h | 1 - src/core/libs/supl/asn-supl/Status.c | 154 +- src/core/libs/supl/asn-supl/Status.h | 5 +- src/core/libs/supl/asn-supl/StatusCode.c | 229 +- src/core/libs/supl/asn-supl/StatusCode.h | 5 +- src/core/libs/supl/asn-supl/TGSN.c | 163 +- src/core/libs/supl/asn-supl/TGSN.h | 1 - .../libs/supl/asn-supl/TimeslotISCP-List.c | 43 +- .../libs/supl/asn-supl/TimeslotISCP-List.h | 1 - src/core/libs/supl/asn-supl/TimeslotISCP.c | 174 +- src/core/libs/supl/asn-supl/TimeslotISCP.h | 1 - src/core/libs/supl/asn-supl/UARFCN.c | 163 +- src/core/libs/supl/asn-supl/UARFCN.h | 1 - src/core/libs/supl/asn-supl/ULP-PDU.c | 145 +- src/core/libs/supl/asn-supl/ULP-PDU.h | 1 - src/core/libs/supl/asn-supl/UTCTime.c | 200 +- src/core/libs/supl/asn-supl/UTCTime.h | 7 +- .../libs/supl/asn-supl/UTRA-CarrierRSSI.c | 177 +- .../libs/supl/asn-supl/UTRA-CarrierRSSI.h | 1 - src/core/libs/supl/asn-supl/UlpMessage.c | 154 +- src/core/libs/supl/asn-supl/UlpMessage.h | 7 +- src/core/libs/supl/asn-supl/Velocity.c | 91 +- src/core/libs/supl/asn-supl/Velocity.h | 7 +- src/core/libs/supl/asn-supl/Ver.c | 82 +- src/core/libs/supl/asn-supl/Ver.h | 1 - src/core/libs/supl/asn-supl/Version.c | 232 +- src/core/libs/supl/asn-supl/Version.h | 1 - src/core/libs/supl/asn-supl/VisibleString.c | 89 +- .../libs/supl/asn-supl/WcdmaCellInformation.c | 341 +- .../libs/supl/asn-supl/WcdmaCellInformation.h | 7 +- .../libs/supl/asn-supl/XNavigationModel.c | 322 +- .../libs/supl/asn-supl/XNavigationModel.h | 7 +- src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c | 54 +- src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h | 25 +- src/core/libs/supl/asn-supl/asn_SET_OF.c | 109 +- src/core/libs/supl/asn-supl/asn_SET_OF.h | 41 +- src/core/libs/supl/asn-supl/asn_application.h | 31 +- src/core/libs/supl/asn-supl/asn_codecs.h | 68 +- src/core/libs/supl/asn-supl/asn_codecs_prim.c | 354 +- src/core/libs/supl/asn-supl/asn_codecs_prim.h | 29 +- src/core/libs/supl/asn-supl/asn_internal.h | 58 +- src/core/libs/supl/asn-supl/asn_system.h | 12 +- src/core/libs/supl/asn-supl/ber_decoder.c | 444 +-- src/core/libs/supl/asn-supl/ber_decoder.h | 46 +- src/core/libs/supl/asn-supl/ber_tlv_length.c | 228 +- src/core/libs/supl/asn-supl/ber_tlv_length.h | 47 +- src/core/libs/supl/asn-supl/ber_tlv_tag.c | 164 +- src/core/libs/supl/asn-supl/ber_tlv_tag.h | 39 +- src/core/libs/supl/asn-supl/constr_CHOICE.c | 1696 +++++----- src/core/libs/supl/asn-supl/constr_CHOICE.h | 16 +- src/core/libs/supl/asn-supl/constr_SEQUENCE.c | 2309 +++++++------ src/core/libs/supl/asn-supl/constr_SEQUENCE.h | 23 +- .../libs/supl/asn-supl/constr_SEQUENCE_OF.c | 272 +- src/core/libs/supl/asn-supl/constr_SET_OF.c | 1336 ++++---- src/core/libs/supl/asn-supl/constr_SET_OF.h | 8 +- src/core/libs/supl/asn-supl/constr_TYPE.c | 46 +- src/core/libs/supl/asn-supl/constr_TYPE.h | 133 +- src/core/libs/supl/asn-supl/constraints.c | 95 +- src/core/libs/supl/asn-supl/constraints.h | 43 +- src/core/libs/supl/asn-supl/der_encoder.c | 214 +- src/core/libs/supl/asn-supl/der_encoder.h | 45 +- src/core/libs/supl/asn-supl/per_decoder.c | 119 +- src/core/libs/supl/asn-supl/per_decoder.h | 47 +- src/core/libs/supl/asn-supl/per_encoder.c | 146 +- src/core/libs/supl/asn-supl/per_encoder.h | 53 +- src/core/libs/supl/asn-supl/per_opentype.c | 138 +- src/core/libs/supl/asn-supl/per_opentype.h | 9 +- src/core/libs/supl/asn-supl/per_support.c | 738 ++--- src/core/libs/supl/asn-supl/per_support.h | 86 +- src/core/libs/supl/asn-supl/xer_decoder.c | 545 ++-- src/core/libs/supl/asn-supl/xer_decoder.h | 79 +- src/core/libs/supl/asn-supl/xer_encoder.c | 31 +- src/core/libs/supl/asn-supl/xer_encoder.h | 35 +- src/core/libs/supl/asn-supl/xer_support.c | 393 +-- src/core/libs/supl/asn-supl/xer_support.h | 41 +- 688 files changed, 42075 insertions(+), 39851 deletions(-) diff --git a/src/core/libs/supl/asn-rrlp/Accuracy.c b/src/core/libs/supl/asn-rrlp/Accuracy.c index ff366ae56..a5803c9cf 100644 --- a/src/core/libs/supl/asn-rrlp/Accuracy.c +++ b/src/core/libs/supl/asn-rrlp/Accuracy.c @@ -6,119 +6,130 @@ #include "Accuracy.h" -int -Accuracy_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int Accuracy_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -Accuracy_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void Accuracy_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -Accuracy_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void Accuracy_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ Accuracy_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -Accuracy_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int Accuracy_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ Accuracy_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -Accuracy_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t Accuracy_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ Accuracy_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -Accuracy_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Accuracy_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ Accuracy_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -Accuracy_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t Accuracy_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ Accuracy_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -Accuracy_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Accuracy_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ Accuracy_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -Accuracy_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t Accuracy_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ Accuracy_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -Accuracy_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t Accuracy_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ Accuracy_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ACCURACY_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_Accuracy_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_Accuracy = { "Accuracy", "Accuracy", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_Accuracy = { Accuracy_encode_xer, Accuracy_decode_uper, Accuracy_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Accuracy_tags_1, - sizeof(asn_DEF_Accuracy_tags_1) - /sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ - asn_DEF_Accuracy_tags_1, /* Same as above */ - sizeof(asn_DEF_Accuracy_tags_1) - /sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ + sizeof(asn_DEF_Accuracy_tags_1) / + sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ + asn_DEF_Accuracy_tags_1, /* Same as above */ + sizeof(asn_DEF_Accuracy_tags_1) / + sizeof(asn_DEF_Accuracy_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ACCURACY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Accuracy.h b/src/core/libs/supl/asn-rrlp/Accuracy.h index b08bfca6d..0b65bed6a 100644 --- a/src/core/libs/supl/asn-rrlp/Accuracy.h +++ b/src/core/libs/supl/asn-rrlp/Accuracy.h @@ -7,7 +7,6 @@ #ifndef _Accuracy_H_ #define _Accuracy_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AccuracyOpt.c b/src/core/libs/supl/asn-rrlp/AccuracyOpt.c index 9cc53a1d3..835ac4ee4 100644 --- a/src/core/libs/supl/asn-rrlp/AccuracyOpt.c +++ b/src/core/libs/supl/asn-rrlp/AccuracyOpt.c @@ -7,32 +7,28 @@ #include "AccuracyOpt.h" static asn_TYPE_member_t asn_MBR_AccuracyOpt_1[] = { - { ATF_POINTER, 1, offsetof(struct AccuracyOpt, accuracy), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Accuracy, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "accuracy" - }, + {ATF_POINTER, 1, offsetof(struct AccuracyOpt, accuracy), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "accuracy"}, }; -static int asn_MAP_AccuracyOpt_oms_1[] = { 0 }; +static int asn_MAP_AccuracyOpt_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_AccuracyOpt_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AccuracyOpt_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* accuracy at 125 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* accuracy at 125 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AccuracyOpt_specs_1 = { sizeof(struct AccuracyOpt), offsetof(struct AccuracyOpt, _asn_ctx), asn_MAP_AccuracyOpt_tag2el_1, - 1, /* Count of tags in the map */ - asn_MAP_AccuracyOpt_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + asn_MAP_AccuracyOpt_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AccuracyOpt = { "AccuracyOpt", @@ -46,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_AccuracyOpt = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AccuracyOpt_tags_1, - sizeof(asn_DEF_AccuracyOpt_tags_1) - /sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ - asn_DEF_AccuracyOpt_tags_1, /* Same as above */ - sizeof(asn_DEF_AccuracyOpt_tags_1) - /sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AccuracyOpt_tags_1) / + sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ + asn_DEF_AccuracyOpt_tags_1, /* Same as above */ + sizeof(asn_DEF_AccuracyOpt_tags_1) / + sizeof(asn_DEF_AccuracyOpt_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AccuracyOpt_1, - 1, /* Elements count */ - &asn_SPC_AccuracyOpt_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_AccuracyOpt_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AccuracyOpt.h b/src/core/libs/supl/asn-rrlp/AccuracyOpt.h index 1b3a29754..1f708eb72 100644 --- a/src/core/libs/supl/asn-rrlp/AccuracyOpt.h +++ b/src/core/libs/supl/asn-rrlp/AccuracyOpt.h @@ -7,7 +7,6 @@ #ifndef _AccuracyOpt_H_ #define _AccuracyOpt_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AcquisAssist.c b/src/core/libs/supl/asn-rrlp/AcquisAssist.c index 09c27582e..4a15050d4 100644 --- a/src/core/libs/supl/asn-rrlp/AcquisAssist.c +++ b/src/core/libs/supl/asn-rrlp/AcquisAssist.c @@ -7,40 +7,35 @@ #include "AcquisAssist.h" static asn_TYPE_member_t asn_MBR_AcquisAssist_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, timeRelation), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeRelation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeRelation" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, acquisList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfAcquisElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "acquisList" - }, + {ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, timeRelation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeRelation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeRelation"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisAssist, acquisList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfAcquisElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "acquisList"}, }; static ber_tlv_tag_t asn_DEF_AcquisAssist_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AcquisAssist_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* timeRelation at 817 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* acquisList at 822 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* timeRelation at 817 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* acquisList at 822 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AcquisAssist_specs_1 = { sizeof(struct AcquisAssist), offsetof(struct AcquisAssist, _asn_ctx), asn_MAP_AcquisAssist_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AcquisAssist = { "AcquisAssist", @@ -54,16 +49,15 @@ asn_TYPE_descriptor_t asn_DEF_AcquisAssist = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AcquisAssist_tags_1, - sizeof(asn_DEF_AcquisAssist_tags_1) - /sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ - asn_DEF_AcquisAssist_tags_1, /* Same as above */ - sizeof(asn_DEF_AcquisAssist_tags_1) - /sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AcquisAssist_tags_1) / + sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ + asn_DEF_AcquisAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_AcquisAssist_tags_1) / + sizeof(asn_DEF_AcquisAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AcquisAssist_1, - 2, /* Elements count */ - &asn_SPC_AcquisAssist_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_AcquisAssist_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AcquisAssist.h b/src/core/libs/supl/asn-rrlp/AcquisAssist.h index 94fa59617..251311623 100644 --- a/src/core/libs/supl/asn-rrlp/AcquisAssist.h +++ b/src/core/libs/supl/asn-rrlp/AcquisAssist.h @@ -7,7 +7,6 @@ #ifndef _AcquisAssist_H_ #define _AcquisAssist_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AcquisElement.c b/src/core/libs/supl/asn-rrlp/AcquisElement.c index d9764f039..3182bab4f 100644 --- a/src/core/libs/supl/asn-rrlp/AcquisElement.c +++ b/src/core/libs/supl/asn-rrlp/AcquisElement.c @@ -6,253 +6,245 @@ #include "AcquisElement.h" -static int -memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2048 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2048 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1022)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1022)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 19)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 19)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_gpsBitNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsBitNumber_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhaseSearchWindow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhaseSearchWindow_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 15)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 15)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DOPPLER0_CONSTR_3 = { - { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, -2048, 2047} /* (-2048..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_CONSTR_5 = { - { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1022} /* (0..1022) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6 = { - { APC_CONSTRAINED, 5, 5, 0, 19 } /* (0..19) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 19} /* (0..19) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GPS_BIT_NUMBER_CONSTR_7 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_8 = { - { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 15} /* (0..15) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_AcquisElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, svid), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svid" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, doppler0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler0_constraint_1, - &ASN_PER_MEMB_DOPPLER0_CONSTR_3, - 0, - "doppler0" - }, - { ATF_POINTER, 1, offsetof(struct AcquisElement, addionalDoppler), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AddionalDopplerFields, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "addionalDoppler" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhase), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhase_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_CONSTR_5, - 0, - "codePhase" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, intCodePhase), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_intCodePhase_constraint_1, - &ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6, - 0, - "intCodePhase" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, gpsBitNumber), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsBitNumber_constraint_1, - &ASN_PER_MEMB_GPS_BIT_NUMBER_CONSTR_7, - 0, - "gpsBitNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhaseSearchWindow), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhaseSearchWindow_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_8, - 0, - "codePhaseSearchWindow" - }, - { ATF_POINTER, 1, offsetof(struct AcquisElement, addionalAngle), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AddionalAngleFields, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "addionalAngle" - }, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, svid), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svid"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, doppler0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler0_constraint_1, + &ASN_PER_MEMB_DOPPLER0_CONSTR_3, 0, "doppler0"}, + {ATF_POINTER, 1, offsetof(struct AcquisElement, addionalDoppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalDopplerFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "addionalDoppler"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhase_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_CONSTR_5, 0, "codePhase"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, intCodePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_intCodePhase_constraint_1, + &ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6, 0, "intCodePhase"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, gpsBitNumber), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsBitNumber_constraint_1, + &ASN_PER_MEMB_GPS_BIT_NUMBER_CONSTR_7, 0, "gpsBitNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct AcquisElement, codePhaseSearchWindow), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhaseSearchWindow_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_8, 0, + "codePhaseSearchWindow"}, + {ATF_POINTER, 1, offsetof(struct AcquisElement, addionalAngle), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalAngleFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "addionalAngle"}, }; -static int asn_MAP_AcquisElement_oms_1[] = { 2, 7 }; +static int asn_MAP_AcquisElement_oms_1[] = {2, 7}; static ber_tlv_tag_t asn_DEF_AcquisElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AcquisElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svid at 834 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* doppler0 at 838 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* addionalDoppler at 839 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* codePhase at 840 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* intCodePhase at 841 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* gpsBitNumber at 842 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* codePhaseSearchWindow at 843 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* addionalAngle at 844 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* svid at 834 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* doppler0 at 838 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* addionalDoppler at 839 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* codePhase at 840 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* intCodePhase at 841 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* gpsBitNumber at 842 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* codePhaseSearchWindow at 843 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0} /* addionalAngle at 844 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AcquisElement_specs_1 = { sizeof(struct AcquisElement), offsetof(struct AcquisElement, _asn_ctx), asn_MAP_AcquisElement_tag2el_1, - 8, /* Count of tags in the map */ - asn_MAP_AcquisElement_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 8, /* Count of tags in the map */ + asn_MAP_AcquisElement_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AcquisElement = { "AcquisElement", @@ -266,16 +258,15 @@ asn_TYPE_descriptor_t asn_DEF_AcquisElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AcquisElement_tags_1, - sizeof(asn_DEF_AcquisElement_tags_1) - /sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ - asn_DEF_AcquisElement_tags_1, /* Same as above */ - sizeof(asn_DEF_AcquisElement_tags_1) - /sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AcquisElement_tags_1) / + sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ + asn_DEF_AcquisElement_tags_1, /* Same as above */ + sizeof(asn_DEF_AcquisElement_tags_1) / + sizeof(asn_DEF_AcquisElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AcquisElement_1, - 8, /* Elements count */ - &asn_SPC_AcquisElement_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_AcquisElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AcquisElement.h b/src/core/libs/supl/asn-rrlp/AcquisElement.h index 824b144c0..2c0802968 100644 --- a/src/core/libs/supl/asn-rrlp/AcquisElement.h +++ b/src/core/libs/supl/asn-rrlp/AcquisElement.h @@ -7,7 +7,6 @@ #ifndef _AcquisElement_H_ #define _AcquisElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c index 89c628772..244a67cf6 100644 --- a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c +++ b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.c @@ -6,101 +6,102 @@ #include "AddionalAngleFields.h" -static int -memb_azimuth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_azimuth_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_elevation_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_elevation_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_AZIMUTH_CONSTR_2 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ELEVATION_CONSTR_3 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_AddionalAngleFields_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, azimuth), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_azimuth_constraint_1, - &ASN_PER_MEMB_AZIMUTH_CONSTR_2, - 0, - "azimuth" - }, - { ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, elevation), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_elevation_constraint_1, - &ASN_PER_MEMB_ELEVATION_CONSTR_3, - 0, - "elevation" - }, + {ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, azimuth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_azimuth_constraint_1, + &ASN_PER_MEMB_AZIMUTH_CONSTR_2, 0, "azimuth"}, + {ATF_NOFLAGS, 0, offsetof(struct AddionalAngleFields, elevation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_elevation_constraint_1, + &ASN_PER_MEMB_ELEVATION_CONSTR_3, 0, "elevation"}, }; static ber_tlv_tag_t asn_DEF_AddionalAngleFields_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AddionalAngleFields_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* azimuth at 858 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* elevation at 860 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* azimuth at 858 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* elevation at 860 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AddionalAngleFields_specs_1 = { sizeof(struct AddionalAngleFields), offsetof(struct AddionalAngleFields, _asn_ctx), asn_MAP_AddionalAngleFields_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AddionalAngleFields = { "AddionalAngleFields", @@ -114,16 +115,15 @@ asn_TYPE_descriptor_t asn_DEF_AddionalAngleFields = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AddionalAngleFields_tags_1, - sizeof(asn_DEF_AddionalAngleFields_tags_1) - /sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ - asn_DEF_AddionalAngleFields_tags_1, /* Same as above */ - sizeof(asn_DEF_AddionalAngleFields_tags_1) - /sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AddionalAngleFields_tags_1) / + sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ + asn_DEF_AddionalAngleFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AddionalAngleFields_tags_1) / + sizeof(asn_DEF_AddionalAngleFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AddionalAngleFields_1, - 2, /* Elements count */ - &asn_SPC_AddionalAngleFields_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_AddionalAngleFields_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h index 6408276ae..f325510b5 100644 --- a/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h +++ b/src/core/libs/supl/asn-rrlp/AddionalAngleFields.h @@ -7,7 +7,6 @@ #ifndef _AddionalAngleFields_H_ #define _AddionalAngleFields_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c index 2c32f87f4..c0963e5ec 100644 --- a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c +++ b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.c @@ -6,101 +6,102 @@ #include "AddionalDopplerFields.h" -static int -memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_dopplerUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_dopplerUncertainty_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DOPPLER1_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_AddionalDopplerFields_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, doppler1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler1_constraint_1, - &ASN_PER_MEMB_DOPPLER1_CONSTR_2, - 0, - "doppler1" - }, - { ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, dopplerUncertainty), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_dopplerUncertainty_constraint_1, - &ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3, - 0, - "dopplerUncertainty" - }, + {ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, doppler1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler1_constraint_1, + &ASN_PER_MEMB_DOPPLER1_CONSTR_2, 0, "doppler1"}, + {ATF_NOFLAGS, 0, offsetof(struct AddionalDopplerFields, dopplerUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_dopplerUncertainty_constraint_1, + &ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3, 0, "dopplerUncertainty"}, }; static ber_tlv_tag_t asn_DEF_AddionalDopplerFields_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AddionalDopplerFields_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* doppler1 at 850 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* dopplerUncertainty at 851 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* doppler1 at 850 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* dopplerUncertainty at 851 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AddionalDopplerFields_specs_1 = { sizeof(struct AddionalDopplerFields), offsetof(struct AddionalDopplerFields, _asn_ctx), asn_MAP_AddionalDopplerFields_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AddionalDopplerFields = { "AddionalDopplerFields", @@ -114,16 +115,15 @@ asn_TYPE_descriptor_t asn_DEF_AddionalDopplerFields = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AddionalDopplerFields_tags_1, - sizeof(asn_DEF_AddionalDopplerFields_tags_1) - /sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ - asn_DEF_AddionalDopplerFields_tags_1, /* Same as above */ - sizeof(asn_DEF_AddionalDopplerFields_tags_1) - /sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AddionalDopplerFields_tags_1) / + sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ + asn_DEF_AddionalDopplerFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AddionalDopplerFields_tags_1) / + sizeof(asn_DEF_AddionalDopplerFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AddionalDopplerFields_1, - 2, /* Elements count */ - &asn_SPC_AddionalDopplerFields_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_AddionalDopplerFields_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h index cf78e19ab..c0918f74c 100644 --- a/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h +++ b/src/core/libs/supl/asn-rrlp/AddionalDopplerFields.h @@ -7,7 +7,6 @@ #ifndef _AddionalDopplerFields_H_ #define _AddionalDopplerFields_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c index e4bb5d8e7..40b13d653 100644 --- a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c +++ b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.c @@ -7,52 +7,49 @@ #include "AdditionalAssistanceData.h" static asn_TYPE_member_t asn_MBR_AdditionalAssistanceData_1[] = { - { ATF_POINTER, 3, offsetof(struct AdditionalAssistanceData, gpsAssistanceData), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSAssistanceData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsAssistanceData" - }, - { ATF_POINTER, 2, offsetof(struct AdditionalAssistanceData, extensionContainer), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExtensionContainer, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extensionContainer" - }, - { ATF_POINTER, 1, offsetof(struct AdditionalAssistanceData, ganssAssistanceData), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSAssistanceData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssAssistanceData" - }, + {ATF_POINTER, 3, + offsetof(struct AdditionalAssistanceData, gpsAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsAssistanceData"}, + {ATF_POINTER, 2, + offsetof(struct AdditionalAssistanceData, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extensionContainer"}, + {ATF_POINTER, 1, + offsetof(struct AdditionalAssistanceData, ganssAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssAssistanceData"}, }; -static int asn_MAP_AdditionalAssistanceData_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_AdditionalAssistanceData_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_AdditionalAssistanceData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AdditionalAssistanceData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsAssistanceData at 520 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* extensionContainer at 521 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssAssistanceData at 523 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* gpsAssistanceData at 520 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* extensionContainer at 521 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* ganssAssistanceData at 523 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AdditionalAssistanceData_specs_1 = { sizeof(struct AdditionalAssistanceData), offsetof(struct AdditionalAssistanceData, _asn_ctx), asn_MAP_AdditionalAssistanceData_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_AdditionalAssistanceData_oms_1, /* Optional members */ - 2, 1, /* Root/Additions */ - 1, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_AdditionalAssistanceData_oms_1, /* Optional members */ + 2, + 1, /* Root/Additions */ + 1, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AdditionalAssistanceData = { "AdditionalAssistanceData", @@ -66,16 +63,15 @@ asn_TYPE_descriptor_t asn_DEF_AdditionalAssistanceData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AdditionalAssistanceData_tags_1, - sizeof(asn_DEF_AdditionalAssistanceData_tags_1) - /sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ - asn_DEF_AdditionalAssistanceData_tags_1, /* Same as above */ - sizeof(asn_DEF_AdditionalAssistanceData_tags_1) - /sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AdditionalAssistanceData_tags_1) / + sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_AdditionalAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_AdditionalAssistanceData_tags_1) / + sizeof(asn_DEF_AdditionalAssistanceData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AdditionalAssistanceData_1, - 3, /* Elements count */ - &asn_SPC_AdditionalAssistanceData_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_AdditionalAssistanceData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h index 1d36ee10f..bd36e1715 100644 --- a/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h +++ b/src/core/libs/supl/asn-rrlp/AdditionalAssistanceData.h @@ -7,7 +7,6 @@ #ifndef _AdditionalAssistanceData_H_ #define _AdditionalAssistanceData_H_ - #include /* Including external dependencies */ @@ -27,9 +26,9 @@ extern "C" GPSAssistanceData_t *gpsAssistanceData /* OPTIONAL */; ExtensionContainer_t *extensionContainer /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ GANSSAssistanceData_t *ganssAssistanceData /* OPTIONAL */; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c index 75e77b9a7..ff66c2f3f 100644 --- a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c +++ b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.c @@ -6,101 +6,103 @@ #include "AdditionalDopplerFields.h" -static int -memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_dopplerUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_dopplerUncertainty_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 4)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 4)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DOPPLER1_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3 = { - { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 4} /* (0..4) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_AdditionalDopplerFields_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AdditionalDopplerFields, doppler1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler1_constraint_1, - &ASN_PER_MEMB_DOPPLER1_CONSTR_2, - 0, - "doppler1" - }, - { ATF_NOFLAGS, 0, offsetof(struct AdditionalDopplerFields, dopplerUncertainty), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_dopplerUncertainty_constraint_1, - &ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3, - 0, - "dopplerUncertainty" - }, + {ATF_NOFLAGS, 0, offsetof(struct AdditionalDopplerFields, doppler1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler1_constraint_1, + &ASN_PER_MEMB_DOPPLER1_CONSTR_2, 0, "doppler1"}, + {ATF_NOFLAGS, 0, + offsetof(struct AdditionalDopplerFields, dopplerUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_dopplerUncertainty_constraint_1, + &ASN_PER_MEMB_DOPPLER_UNCERTAINTY_CONSTR_3, 0, "dopplerUncertainty"}, }; static ber_tlv_tag_t asn_DEF_AdditionalDopplerFields_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AdditionalDopplerFields_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* doppler1 at 1342 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* dopplerUncertainty at 1343 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* doppler1 at 1342 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* dopplerUncertainty at 1343 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AdditionalDopplerFields_specs_1 = { sizeof(struct AdditionalDopplerFields), offsetof(struct AdditionalDopplerFields, _asn_ctx), asn_MAP_AdditionalDopplerFields_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AdditionalDopplerFields = { "AdditionalDopplerFields", @@ -114,16 +116,15 @@ asn_TYPE_descriptor_t asn_DEF_AdditionalDopplerFields = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AdditionalDopplerFields_tags_1, - sizeof(asn_DEF_AdditionalDopplerFields_tags_1) - /sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ - asn_DEF_AdditionalDopplerFields_tags_1, /* Same as above */ - sizeof(asn_DEF_AdditionalDopplerFields_tags_1) - /sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AdditionalDopplerFields_tags_1) / + sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ + asn_DEF_AdditionalDopplerFields_tags_1, /* Same as above */ + sizeof(asn_DEF_AdditionalDopplerFields_tags_1) / + sizeof(asn_DEF_AdditionalDopplerFields_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AdditionalDopplerFields_1, - 2, /* Elements count */ - &asn_SPC_AdditionalDopplerFields_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_AdditionalDopplerFields_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h index a690fd351..2399b8635 100644 --- a/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h +++ b/src/core/libs/supl/asn-rrlp/AdditionalDopplerFields.h @@ -7,7 +7,6 @@ #ifndef _AdditionalDopplerFields_H_ #define _AdditionalDopplerFields_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AlertFlag.c b/src/core/libs/supl/asn-rrlp/AlertFlag.c index b5fb0dcf8..23699b027 100644 --- a/src/core/libs/supl/asn-rrlp/AlertFlag.c +++ b/src/core/libs/supl/asn-rrlp/AlertFlag.c @@ -6,119 +6,130 @@ #include "AlertFlag.h" -int -AlertFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int AlertFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -AlertFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void AlertFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -AlertFlag_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void AlertFlag_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ AlertFlag_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -AlertFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int AlertFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ AlertFlag_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -AlertFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t AlertFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ AlertFlag_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -AlertFlag_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t AlertFlag_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ AlertFlag_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -AlertFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t AlertFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ AlertFlag_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -AlertFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t AlertFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ AlertFlag_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -AlertFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t AlertFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ AlertFlag_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -AlertFlag_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t AlertFlag_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ AlertFlag_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ALERT_FLAG_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_AlertFlag_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_AlertFlag = { "AlertFlag", "AlertFlag", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_AlertFlag = { AlertFlag_encode_xer, AlertFlag_decode_uper, AlertFlag_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AlertFlag_tags_1, - sizeof(asn_DEF_AlertFlag_tags_1) - /sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ - asn_DEF_AlertFlag_tags_1, /* Same as above */ - sizeof(asn_DEF_AlertFlag_tags_1) - /sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ + sizeof(asn_DEF_AlertFlag_tags_1) / + sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ + asn_DEF_AlertFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_AlertFlag_tags_1) / + sizeof(asn_DEF_AlertFlag_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ALERT_FLAG_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AlertFlag.h b/src/core/libs/supl/asn-rrlp/AlertFlag.h index ebae6320b..22ae1c43a 100644 --- a/src/core/libs/supl/asn-rrlp/AlertFlag.h +++ b/src/core/libs/supl/asn-rrlp/AlertFlag.h @@ -7,7 +7,6 @@ #ifndef _AlertFlag_H_ #define _AlertFlag_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c index 24fd9df22..1135c6ca3 100644 --- a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c +++ b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.c @@ -6,421 +6,422 @@ #include "Almanac-KeplerianSet.h" -static int -memb_kepAlmanacE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacE_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacDeltaI_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacDeltaI_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -1024 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -1024 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacOmegaDot_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -1024 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -1024 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepSVHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepSVHealth_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 15)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 15)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacAPowerHalf_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -65536 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -65536 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacOmega0_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacW_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacM0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacAF0_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8192 && value <= 8191)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8192 && value <= 8191)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_kepAlmanacAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_kepAlmanacAF1_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -1024 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -1024 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_E_CONSTR_2 = { - { APC_CONSTRAINED, 11, 11, 0, 2047 } /* (0..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, 0, 2047} /* (0..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_DELTA_I_CONSTR_3 = { - { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, -1024, 1023} /* (-1024..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_OMEGA_DOT_CONSTR_4 = { - { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, -1024, 1023} /* (-1024..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_SV_HEALTH_CONSTR_5 = { - { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 15} /* (0..15) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_A_POWER_HALF_CONSTR_6 = { - { APC_CONSTRAINED, 17, -1, -65536, 65535 } /* (-65536..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 17, -1, -65536, 65535} /* (-65536..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_OMEGA0_CONSTR_7 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_W_CONSTR_8 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_M0_CONSTR_9 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_A_F0_CONSTR_10 = { - { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, -8192, 8191} /* (-8192..8191) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEP_ALMANAC_A_F1_CONSTR_11 = { - { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, -1024, 1023} /* (-1024..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Almanac_KeplerianSet_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacE), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacE_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_E_CONSTR_2, - 0, - "kepAlmanacE" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacDeltaI), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacDeltaI_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_DELTA_I_CONSTR_3, - 0, - "kepAlmanacDeltaI" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmegaDot), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacOmegaDot_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_OMEGA_DOT_CONSTR_4, - 0, - "kepAlmanacOmegaDot" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepSVHealth), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepSVHealth_constraint_1, - &ASN_PER_MEMB_KEP_SV_HEALTH_CONSTR_5, - 0, - "kepSVHealth" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAPowerHalf), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacAPowerHalf_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_A_POWER_HALF_CONSTR_6, - 0, - "kepAlmanacAPowerHalf" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmega0), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacOmega0_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_OMEGA0_CONSTR_7, - 0, - "kepAlmanacOmega0" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacW), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacW_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_W_CONSTR_8, - 0, - "kepAlmanacW" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacM0), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacM0_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_M0_CONSTR_9, - 0, - "kepAlmanacM0" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF0), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacAF0_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_A_F0_CONSTR_10, - 0, - "kepAlmanacAF0" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF1), - (ASN_TAG_CLASS_CONTEXT | (9 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_kepAlmanacAF1_constraint_1, - &ASN_PER_MEMB_KEP_ALMANAC_A_F1_CONSTR_11, - 0, - "kepAlmanacAF1" - }, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacE), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacE_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_E_CONSTR_2, 0, "kepAlmanacE"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacDeltaI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacDeltaI_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_DELTA_I_CONSTR_3, 0, "kepAlmanacDeltaI"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacOmegaDot_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_OMEGA_DOT_CONSTR_4, 0, "kepAlmanacOmegaDot"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepSVHealth), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepSVHealth_constraint_1, + &ASN_PER_MEMB_KEP_SV_HEALTH_CONSTR_5, 0, "kepSVHealth"}, + {ATF_NOFLAGS, 0, + offsetof(struct Almanac_KeplerianSet, kepAlmanacAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacAPowerHalf_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_A_POWER_HALF_CONSTR_6, 0, + "kepAlmanacAPowerHalf"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacOmega0), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacOmega0_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_OMEGA0_CONSTR_7, 0, "kepAlmanacOmega0"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacW), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacW_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_W_CONSTR_8, 0, "kepAlmanacW"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacM0), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacM0_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_M0_CONSTR_9, 0, "kepAlmanacM0"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF0), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacAF0_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_A_F0_CONSTR_10, 0, "kepAlmanacAF0"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac_KeplerianSet, kepAlmanacAF1), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_kepAlmanacAF1_constraint_1, + &ASN_PER_MEMB_KEP_ALMANAC_A_F1_CONSTR_11, 0, "kepAlmanacAF1"}, }; static ber_tlv_tag_t asn_DEF_Almanac_KeplerianSet_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Almanac_KeplerianSet_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* kepAlmanacE at 1368 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* kepAlmanacDeltaI at 1369 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* kepAlmanacOmegaDot at 1370 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* kepSVHealth at 1371 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* kepAlmanacAPowerHalf at 1372 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* kepAlmanacOmega0 at 1373 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* kepAlmanacW at 1374 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* kepAlmanacM0 at 1375 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* kepAlmanacAF0 at 1376 */ - { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* kepAlmanacAF1 at 1377 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* kepAlmanacE at 1368 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* kepAlmanacDeltaI at 1369 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* kepAlmanacOmegaDot at 1370 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* kepSVHealth at 1371 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* kepAlmanacAPowerHalf at 1372 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* kepAlmanacOmega0 at 1373 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* kepAlmanacW at 1374 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0}, /* kepAlmanacM0 at 1375 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0}, /* kepAlmanacAF0 at 1376 */ + {(ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0} /* kepAlmanacAF1 at 1377 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Almanac_KeplerianSet_specs_1 = { sizeof(struct Almanac_KeplerianSet), offsetof(struct Almanac_KeplerianSet, _asn_ctx), asn_MAP_Almanac_KeplerianSet_tag2el_1, - 10, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 10, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Almanac_KeplerianSet = { "Almanac-KeplerianSet", @@ -434,16 +435,15 @@ asn_TYPE_descriptor_t asn_DEF_Almanac_KeplerianSet = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Almanac_KeplerianSet_tags_1, - sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) - /sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ - asn_DEF_Almanac_KeplerianSet_tags_1, /* Same as above */ - sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) - /sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) / + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ + asn_DEF_Almanac_KeplerianSet_tags_1, /* Same as above */ + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1) / + sizeof(asn_DEF_Almanac_KeplerianSet_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Almanac_KeplerianSet_1, - 10, /* Elements count */ - &asn_SPC_Almanac_KeplerianSet_specs_1 /* Additional specs */ + 10, /* Elements count */ + &asn_SPC_Almanac_KeplerianSet_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h index 83c0156ab..1c425ef58 100644 --- a/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h +++ b/src/core/libs/supl/asn-rrlp/Almanac-KeplerianSet.h @@ -7,7 +7,6 @@ #ifndef _Almanac_KeplerianSet_H_ #define _Almanac_KeplerianSet_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/Almanac.c b/src/core/libs/supl/asn-rrlp/Almanac.c index 1a46c0fd3..5ae28396a 100644 --- a/src/core/libs/supl/asn-rrlp/Almanac.c +++ b/src/core/libs/supl/asn-rrlp/Almanac.c @@ -6,71 +6,69 @@ #include "Almanac.h" -static int -memb_alamanacWNa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alamanacWNa_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_ALAMANAC_W_NA_CONSTR_2 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Almanac_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Almanac, alamanacWNa), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alamanacWNa_constraint_1, - &ASN_PER_MEMB_ALAMANAC_W_NA_CONSTR_2, - 0, - "alamanacWNa" - }, - { ATF_NOFLAGS, 0, offsetof(struct Almanac, almanacList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfAlmanacElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "almanacList" - }, + {ATF_NOFLAGS, 0, offsetof(struct Almanac, alamanacWNa), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alamanacWNa_constraint_1, + &ASN_PER_MEMB_ALAMANAC_W_NA_CONSTR_2, 0, "alamanacWNa"}, + {ATF_NOFLAGS, 0, offsetof(struct Almanac, almanacList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "almanacList"}, }; static ber_tlv_tag_t asn_DEF_Almanac_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Almanac_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* alamanacWNa at 789 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* almanacList at 794 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* alamanacWNa at 789 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* almanacList at 794 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Almanac_specs_1 = { sizeof(struct Almanac), offsetof(struct Almanac, _asn_ctx), asn_MAP_Almanac_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Almanac = { "Almanac", @@ -84,16 +82,13 @@ asn_TYPE_descriptor_t asn_DEF_Almanac = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Almanac_tags_1, - sizeof(asn_DEF_Almanac_tags_1) - /sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ - asn_DEF_Almanac_tags_1, /* Same as above */ - sizeof(asn_DEF_Almanac_tags_1) - /sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Almanac_tags_1) / sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ + asn_DEF_Almanac_tags_1, /* Same as above */ + sizeof(asn_DEF_Almanac_tags_1) / sizeof(asn_DEF_Almanac_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Almanac_1, - 2, /* Elements count */ - &asn_SPC_Almanac_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_Almanac_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Almanac.h b/src/core/libs/supl/asn-rrlp/Almanac.h index 262a3da2b..44c4e7dce 100644 --- a/src/core/libs/supl/asn-rrlp/Almanac.h +++ b/src/core/libs/supl/asn-rrlp/Almanac.h @@ -7,7 +7,6 @@ #ifndef _Almanac_H_ #define _Almanac_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AlmanacElement.c b/src/core/libs/supl/asn-rrlp/AlmanacElement.c index e09d05bb8..1991b1337 100644 --- a/src/core/libs/supl/asn-rrlp/AlmanacElement.c +++ b/src/core/libs/supl/asn-rrlp/AlmanacElement.c @@ -6,471 +6,468 @@ #include "AlmanacElement.h" -static int -memb_almanacE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacE_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_alamanacToa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alamanacToa_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacKsii_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacKsii_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacOmegaDot_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacSVhealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacSVhealth_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacAPowerHalf_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16777215)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16777215)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacOmega0_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacW_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacM0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacAF0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -1024 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -1024 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_almanacAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_almanacAF1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -1024 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -1024 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_E_CONSTR_3 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALAMANAC_TOA_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_KSII_CONSTR_5 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_OMEGA_DOT_CONSTR_6 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_S_VHEALTH_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_A_POWER_HALF_CONSTR_8 = { - { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, 0, 16777215} /* (0..16777215) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_OMEGA0_CONSTR_9 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_W_CONSTR_10 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_M0_CONSTR_11 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_A_F0_CONSTR_12 = { - { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, -1024, 1023} /* (-1024..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALMANAC_A_F1_CONSTR_13 = { - { APC_CONSTRAINED, 11, 11, -1024, 1023 } /* (-1024..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, -1024, 1023} /* (-1024..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_AlmanacElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, satelliteID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satelliteID" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacE), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacE_constraint_1, - &ASN_PER_MEMB_ALMANAC_E_CONSTR_3, - 0, - "almanacE" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, alamanacToa), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alamanacToa_constraint_1, - &ASN_PER_MEMB_ALAMANAC_TOA_CONSTR_4, - 0, - "alamanacToa" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacKsii), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacKsii_constraint_1, - &ASN_PER_MEMB_ALMANAC_KSII_CONSTR_5, - 0, - "almanacKsii" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmegaDot), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacOmegaDot_constraint_1, - &ASN_PER_MEMB_ALMANAC_OMEGA_DOT_CONSTR_6, - 0, - "almanacOmegaDot" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacSVhealth), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacSVhealth_constraint_1, - &ASN_PER_MEMB_ALMANAC_S_VHEALTH_CONSTR_7, - 0, - "almanacSVhealth" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAPowerHalf), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacAPowerHalf_constraint_1, - &ASN_PER_MEMB_ALMANAC_A_POWER_HALF_CONSTR_8, - 0, - "almanacAPowerHalf" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmega0), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacOmega0_constraint_1, - &ASN_PER_MEMB_ALMANAC_OMEGA0_CONSTR_9, - 0, - "almanacOmega0" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacW), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacW_constraint_1, - &ASN_PER_MEMB_ALMANAC_W_CONSTR_10, - 0, - "almanacW" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacM0), - (ASN_TAG_CLASS_CONTEXT | (9 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacM0_constraint_1, - &ASN_PER_MEMB_ALMANAC_M0_CONSTR_11, - 0, - "almanacM0" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF0), - (ASN_TAG_CLASS_CONTEXT | (10 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacAF0_constraint_1, - &ASN_PER_MEMB_ALMANAC_A_F0_CONSTR_12, - 0, - "almanacAF0" - }, - { ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF1), - (ASN_TAG_CLASS_CONTEXT | (11 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_almanacAF1_constraint_1, - &ASN_PER_MEMB_ALMANAC_A_F1_CONSTR_13, - 0, - "almanacAF1" - }, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satelliteID"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacE), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacE_constraint_1, + &ASN_PER_MEMB_ALMANAC_E_CONSTR_3, 0, "almanacE"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, alamanacToa), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alamanacToa_constraint_1, + &ASN_PER_MEMB_ALAMANAC_TOA_CONSTR_4, 0, "alamanacToa"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacKsii), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacKsii_constraint_1, + &ASN_PER_MEMB_ALMANAC_KSII_CONSTR_5, 0, "almanacKsii"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacOmegaDot_constraint_1, + &ASN_PER_MEMB_ALMANAC_OMEGA_DOT_CONSTR_6, 0, "almanacOmegaDot"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacSVhealth), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacSVhealth_constraint_1, + &ASN_PER_MEMB_ALMANAC_S_VHEALTH_CONSTR_7, 0, "almanacSVhealth"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacAPowerHalf_constraint_1, + &ASN_PER_MEMB_ALMANAC_A_POWER_HALF_CONSTR_8, 0, "almanacAPowerHalf"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacOmega0), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacOmega0_constraint_1, + &ASN_PER_MEMB_ALMANAC_OMEGA0_CONSTR_9, 0, "almanacOmega0"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacW), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacW_constraint_1, + &ASN_PER_MEMB_ALMANAC_W_CONSTR_10, 0, "almanacW"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacM0), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacM0_constraint_1, + &ASN_PER_MEMB_ALMANAC_M0_CONSTR_11, 0, "almanacM0"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF0), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacAF0_constraint_1, + &ASN_PER_MEMB_ALMANAC_A_F0_CONSTR_12, 0, "almanacAF0"}, + {ATF_NOFLAGS, 0, offsetof(struct AlmanacElement, almanacAF1), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_almanacAF1_constraint_1, + &ASN_PER_MEMB_ALMANAC_A_F1_CONSTR_13, 0, "almanacAF1"}, }; static ber_tlv_tag_t asn_DEF_AlmanacElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AlmanacElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 799 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* almanacE at 800 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* alamanacToa at 801 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* almanacKsii at 802 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* almanacOmegaDot at 803 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* almanacSVhealth at 804 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* almanacAPowerHalf at 805 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* almanacOmega0 at 806 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* almanacW at 807 */ - { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* almanacM0 at 808 */ - { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* almanacAF0 at 809 */ - { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 } /* almanacAF1 at 810 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satelliteID at 799 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* almanacE at 800 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* alamanacToa at 801 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* almanacKsii at 802 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* almanacOmegaDot at 803 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* almanacSVhealth at 804 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* almanacAPowerHalf at 805 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0}, /* almanacOmega0 at 806 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0}, /* almanacW at 807 */ + {(ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0}, /* almanacM0 at 808 */ + {(ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0}, /* almanacAF0 at 809 */ + {(ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0} /* almanacAF1 at 810 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AlmanacElement_specs_1 = { sizeof(struct AlmanacElement), offsetof(struct AlmanacElement, _asn_ctx), asn_MAP_AlmanacElement_tag2el_1, - 12, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 12, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AlmanacElement = { "AlmanacElement", @@ -484,16 +481,15 @@ asn_TYPE_descriptor_t asn_DEF_AlmanacElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AlmanacElement_tags_1, - sizeof(asn_DEF_AlmanacElement_tags_1) - /sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ - asn_DEF_AlmanacElement_tags_1, /* Same as above */ - sizeof(asn_DEF_AlmanacElement_tags_1) - /sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AlmanacElement_tags_1) / + sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_AlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_AlmanacElement_tags_1) / + sizeof(asn_DEF_AlmanacElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AlmanacElement_1, - 12, /* Elements count */ - &asn_SPC_AlmanacElement_specs_1 /* Additional specs */ + 12, /* Elements count */ + &asn_SPC_AlmanacElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AlmanacElement.h b/src/core/libs/supl/asn-rrlp/AlmanacElement.h index 67dae56df..596e68a1d 100644 --- a/src/core/libs/supl/asn-rrlp/AlmanacElement.h +++ b/src/core/libs/supl/asn-rrlp/AlmanacElement.h @@ -7,7 +7,6 @@ #ifndef _AlmanacElement_H_ #define _AlmanacElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c index cfc0a9bb4..84628ced9 100644 --- a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c +++ b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.c @@ -6,119 +6,137 @@ #include "AntiSpoofFlag.h" -int -AntiSpoofFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int AntiSpoofFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -AntiSpoofFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void AntiSpoofFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -AntiSpoofFlag_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void AntiSpoofFlag_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -AntiSpoofFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int AntiSpoofFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -AntiSpoofFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t AntiSpoofFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -AntiSpoofFlag_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t AntiSpoofFlag_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -AntiSpoofFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t AntiSpoofFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -AntiSpoofFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t AntiSpoofFlag_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -AntiSpoofFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t AntiSpoofFlag_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -AntiSpoofFlag_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t AntiSpoofFlag_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ AntiSpoofFlag_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ANTI_SPOOF_FLAG_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_AntiSpoofFlag_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_AntiSpoofFlag = { "AntiSpoofFlag", "AntiSpoofFlag", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_AntiSpoofFlag = { AntiSpoofFlag_encode_xer, AntiSpoofFlag_decode_uper, AntiSpoofFlag_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AntiSpoofFlag_tags_1, - sizeof(asn_DEF_AntiSpoofFlag_tags_1) - /sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ - asn_DEF_AntiSpoofFlag_tags_1, /* Same as above */ - sizeof(asn_DEF_AntiSpoofFlag_tags_1) - /sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ + sizeof(asn_DEF_AntiSpoofFlag_tags_1) / + sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ + asn_DEF_AntiSpoofFlag_tags_1, /* Same as above */ + sizeof(asn_DEF_AntiSpoofFlag_tags_1) / + sizeof(asn_DEF_AntiSpoofFlag_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ANTI_SPOOF_FLAG_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h index bb2226263..d17475e4c 100644 --- a/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h +++ b/src/core/libs/supl/asn-rrlp/AntiSpoofFlag.h @@ -7,7 +7,6 @@ #ifndef _AntiSpoofFlag_H_ #define _AntiSpoofFlag_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c index a13471a65..496935420 100644 --- a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.c @@ -7,40 +7,36 @@ #include "AssistBTSData-R98-ExpOTD.h" static asn_TYPE_member_t asn_MBR_AssistBTSData_R98_ExpOTD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData_R98_ExpOTD, expectedOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExpectedOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "expectedOTD" - }, - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData_R98_ExpOTD, expOTDuncertainty), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExpOTDUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "expOTDuncertainty" - }, + {ATF_NOFLAGS, 0, offsetof(struct AssistBTSData_R98_ExpOTD, expectedOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpectedOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "expectedOTD"}, + {ATF_NOFLAGS, 0, + offsetof(struct AssistBTSData_R98_ExpOTD, expOTDuncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpOTDUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "expOTDuncertainty"}, }; static ber_tlv_tag_t asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AssistBTSData_R98_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* expectedOTD at 933 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* expOTDuncertainty at 935 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* expectedOTD at 933 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* expOTDuncertainty at 935 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AssistBTSData_R98_ExpOTD_specs_1 = { sizeof(struct AssistBTSData_R98_ExpOTD), offsetof(struct AssistBTSData_R98_ExpOTD, _asn_ctx), asn_MAP_AssistBTSData_R98_ExpOTD_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AssistBTSData_R98_ExpOTD = { "AssistBTSData-R98-ExpOTD", @@ -54,16 +50,15 @@ asn_TYPE_descriptor_t asn_DEF_AssistBTSData_R98_ExpOTD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AssistBTSData_R98_ExpOTD_tags_1, - sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_AssistBTSData_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_AssistBTSData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_AssistBTSData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AssistBTSData_R98_ExpOTD_1, - 2, /* Elements count */ - &asn_SPC_AssistBTSData_R98_ExpOTD_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_AssistBTSData_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h index 56d609996..f661bf8c9 100644 --- a/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _AssistBTSData_R98_ExpOTD_H_ #define _AssistBTSData_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData.c b/src/core/libs/supl/asn-rrlp/AssistBTSData.c index c31c1c9d4..d95713fc5 100644 --- a/src/core/libs/supl/asn-rrlp/AssistBTSData.c +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData.c @@ -7,72 +7,55 @@ #include "AssistBTSData.h" static asn_TYPE_member_t asn_MBR_AssistBTSData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, bsic), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, multiFrameOffset), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MultiFrameOffset, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "multiFrameOffset" - }, - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, timeSlotScheme), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeSlotScheme, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeSlotScheme" - }, - { ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, roughRTD), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RoughRTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "roughRTD" - }, - { ATF_POINTER, 1, offsetof(struct AssistBTSData, calcAssistanceBTS), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CalcAssistanceBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "calcAssistanceBTS" - }, + {ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, bsic), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, + {ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "multiFrameOffset"}, + {ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeSlotScheme"}, + {ATF_NOFLAGS, 0, offsetof(struct AssistBTSData, roughRTD), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RoughRTD, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "roughRTD"}, + {ATF_POINTER, 1, offsetof(struct AssistBTSData, calcAssistanceBTS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CalcAssistanceBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "calcAssistanceBTS"}, }; -static int asn_MAP_AssistBTSData_oms_1[] = { 4 }; +static int asn_MAP_AssistBTSData_oms_1[] = {4}; static ber_tlv_tag_t asn_DEF_AssistBTSData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AssistBTSData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsic at 229 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* multiFrameOffset at 230 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* timeSlotScheme at 231 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* roughRTD at 232 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* calcAssistanceBTS at 235 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bsic at 229 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* multiFrameOffset at 230 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* timeSlotScheme at 231 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* roughRTD at 232 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* calcAssistanceBTS at 235 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AssistBTSData_specs_1 = { sizeof(struct AssistBTSData), offsetof(struct AssistBTSData, _asn_ctx), asn_MAP_AssistBTSData_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_AssistBTSData_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_AssistBTSData_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AssistBTSData = { "AssistBTSData", @@ -86,16 +69,15 @@ asn_TYPE_descriptor_t asn_DEF_AssistBTSData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AssistBTSData_tags_1, - sizeof(asn_DEF_AssistBTSData_tags_1) - /sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ - asn_DEF_AssistBTSData_tags_1, /* Same as above */ - sizeof(asn_DEF_AssistBTSData_tags_1) - /sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AssistBTSData_tags_1) / + sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ + asn_DEF_AssistBTSData_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistBTSData_tags_1) / + sizeof(asn_DEF_AssistBTSData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AssistBTSData_1, - 5, /* Elements count */ - &asn_SPC_AssistBTSData_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_AssistBTSData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AssistBTSData.h b/src/core/libs/supl/asn-rrlp/AssistBTSData.h index 1365083f7..31ca04098 100644 --- a/src/core/libs/supl/asn-rrlp/AssistBTSData.h +++ b/src/core/libs/supl/asn-rrlp/AssistBTSData.h @@ -7,7 +7,6 @@ #ifndef _AssistBTSData_H_ #define _AssistBTSData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/AssistanceData.c b/src/core/libs/supl/asn-rrlp/AssistanceData.c index 52c052cbe..d07a671c6 100644 --- a/src/core/libs/supl/asn-rrlp/AssistanceData.c +++ b/src/core/libs/supl/asn-rrlp/AssistanceData.c @@ -7,102 +7,86 @@ #include "AssistanceData.h" static asn_TYPE_member_t asn_MBR_AssistanceData_1[] = { - { ATF_POINTER, 8, offsetof(struct AssistanceData, referenceAssistData), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceAssistData" - }, - { ATF_POINTER, 7, offsetof(struct AssistanceData, msrAssistData), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MsrAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrAssistData" - }, - { ATF_POINTER, 6, offsetof(struct AssistanceData, systemInfoAssistData), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SystemInfoAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoAssistData" - }, - { ATF_POINTER, 5, offsetof(struct AssistanceData, gps_AssistData), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPS_AssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gps-AssistData" - }, - { ATF_POINTER, 4, offsetof(struct AssistanceData, moreAssDataToBeSent), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MoreAssDataToBeSent, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "moreAssDataToBeSent" - }, - { ATF_POINTER, 3, offsetof(struct AssistanceData, extensionContainer), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExtensionContainer, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extensionContainer" - }, - { ATF_POINTER, 2, offsetof(struct AssistanceData, rel98_AssistanceData_Extension), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel98_AssistanceData_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel98-AssistanceData-Extension" - }, - { ATF_POINTER, 1, offsetof(struct AssistanceData, rel5_AssistanceData_Extension), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel5_AssistanceData_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel5-AssistanceData-Extension" - }, + {ATF_POINTER, 8, offsetof(struct AssistanceData, referenceAssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceAssistData"}, + {ATF_POINTER, 7, offsetof(struct AssistanceData, msrAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrAssistData"}, + {ATF_POINTER, 6, offsetof(struct AssistanceData, systemInfoAssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoAssistData"}, + {ATF_POINTER, 5, offsetof(struct AssistanceData, gps_AssistData), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gps-AssistData"}, + {ATF_POINTER, 4, offsetof(struct AssistanceData, moreAssDataToBeSent), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MoreAssDataToBeSent, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "moreAssDataToBeSent"}, + {ATF_POINTER, 3, offsetof(struct AssistanceData, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extensionContainer"}, + {ATF_POINTER, 2, + offsetof(struct AssistanceData, rel98_AssistanceData_Extension), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_AssistanceData_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel98-AssistanceData-Extension"}, + {ATF_POINTER, 1, + offsetof(struct AssistanceData, rel5_AssistanceData_Extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel5_AssistanceData_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel5-AssistanceData-Extension"}, }; -static int asn_MAP_AssistanceData_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static int asn_MAP_AssistanceData_oms_1[] = {0, 1, 2, 3, 4, 5, 6, 7}; static ber_tlv_tag_t asn_DEF_AssistanceData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AssistanceData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceAssistData at 75 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msrAssistData at 76 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* systemInfoAssistData at 77 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* gps-AssistData at 78 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* moreAssDataToBeSent at 79 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensionContainer at 83 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* rel98-AssistanceData-Extension at 86 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* rel5-AssistanceData-Extension at 87 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* referenceAssistData at 75 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* msrAssistData at 76 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* systemInfoAssistData at 77 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* gps-AssistData at 78 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* moreAssDataToBeSent at 79 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* extensionContainer at 83 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* rel98-AssistanceData-Extension at 86 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0} /* rel5-AssistanceData-Extension at 87 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AssistanceData_specs_1 = { sizeof(struct AssistanceData), offsetof(struct AssistanceData, _asn_ctx), asn_MAP_AssistanceData_tag2el_1, - 8, /* Count of tags in the map */ - asn_MAP_AssistanceData_oms_1, /* Optional members */ - 6, 2, /* Root/Additions */ - 5, /* Start extensions */ - 9 /* Stop extensions */ + 8, /* Count of tags in the map */ + asn_MAP_AssistanceData_oms_1, /* Optional members */ + 6, + 2, /* Root/Additions */ + 5, /* Start extensions */ + 9 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AssistanceData = { "AssistanceData", @@ -116,16 +100,15 @@ asn_TYPE_descriptor_t asn_DEF_AssistanceData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AssistanceData_tags_1, - sizeof(asn_DEF_AssistanceData_tags_1) - /sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ - asn_DEF_AssistanceData_tags_1, /* Same as above */ - sizeof(asn_DEF_AssistanceData_tags_1) - /sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AssistanceData_tags_1) / + sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ + asn_DEF_AssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_AssistanceData_tags_1) / + sizeof(asn_DEF_AssistanceData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AssistanceData_1, - 8, /* Elements count */ - &asn_SPC_AssistanceData_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_AssistanceData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/AssistanceData.h b/src/core/libs/supl/asn-rrlp/AssistanceData.h index cf5946f29..25b9da129 100644 --- a/src/core/libs/supl/asn-rrlp/AssistanceData.h +++ b/src/core/libs/supl/asn-rrlp/AssistanceData.h @@ -7,7 +7,6 @@ #ifndef _AssistanceData_H_ #define _AssistanceData_H_ - #include /* Including external dependencies */ @@ -38,11 +37,13 @@ extern "C" MoreAssDataToBeSent_t *moreAssDataToBeSent /* OPTIONAL */; ExtensionContainer_t *extensionContainer /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ - struct Rel98_AssistanceData_Extension *rel98_AssistanceData_Extension /* OPTIONAL */; - struct Rel5_AssistanceData_Extension *rel5_AssistanceData_Extension /* OPTIONAL */; + * This type is extensible, + * possible extensions are below. + */ + struct Rel98_AssistanceData_Extension + *rel98_AssistanceData_Extension /* OPTIONAL */; + struct Rel5_AssistanceData_Extension + *rel5_AssistanceData_Extension /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/BCCHCarrier.c b/src/core/libs/supl/asn-rrlp/BCCHCarrier.c index 208f68df8..861086e4e 100644 --- a/src/core/libs/supl/asn-rrlp/BCCHCarrier.c +++ b/src/core/libs/supl/asn-rrlp/BCCHCarrier.c @@ -6,119 +6,135 @@ #include "BCCHCarrier.h" -int -BCCHCarrier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int BCCHCarrier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -BCCHCarrier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void BCCHCarrier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -BCCHCarrier_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void BCCHCarrier_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -BCCHCarrier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int BCCHCarrier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -BCCHCarrier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t BCCHCarrier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -BCCHCarrier_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BCCHCarrier_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -BCCHCarrier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t BCCHCarrier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -BCCHCarrier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BCCHCarrier_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -BCCHCarrier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t BCCHCarrier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -BCCHCarrier_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t BCCHCarrier_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ BCCHCarrier_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_BCCH_CARRIER_CONSTR_1 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_BCCHCarrier_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_BCCHCarrier = { "BCCHCarrier", "BCCHCarrier", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_BCCHCarrier = { BCCHCarrier_encode_xer, BCCHCarrier_decode_uper, BCCHCarrier_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BCCHCarrier_tags_1, - sizeof(asn_DEF_BCCHCarrier_tags_1) - /sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ - asn_DEF_BCCHCarrier_tags_1, /* Same as above */ - sizeof(asn_DEF_BCCHCarrier_tags_1) - /sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ + sizeof(asn_DEF_BCCHCarrier_tags_1) / + sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ + asn_DEF_BCCHCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_BCCHCarrier_tags_1) / + sizeof(asn_DEF_BCCHCarrier_tags_1[0]), /* 1 */ &ASN_PER_TYPE_BCCH_CARRIER_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BCCHCarrier.h b/src/core/libs/supl/asn-rrlp/BCCHCarrier.h index 7eb181591..b9deac158 100644 --- a/src/core/libs/supl/asn-rrlp/BCCHCarrier.h +++ b/src/core/libs/supl/asn-rrlp/BCCHCarrier.h @@ -7,7 +7,6 @@ #ifndef _BCCHCarrier_H_ #define _BCCHCarrier_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/BIT_STRING.c b/src/core/libs/supl/asn-rrlp/BIT_STRING.c index 78fe3f038..8439afc33 100644 --- a/src/core/libs/supl/asn-rrlp/BIT_STRING.c +++ b/src/core/libs/supl/asn-rrlp/BIT_STRING.c @@ -10,72 +10,68 @@ * BIT STRING basic type description. */ static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { - sizeof(BIT_STRING_t), - offsetof(BIT_STRING_t, _asn_ctx), - ASN_OSUBV_BIT -}; + sizeof(BIT_STRING_t), offsetof(BIT_STRING_t, _asn_ctx), ASN_OSUBV_BIT}; asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { "BIT STRING", "BIT_STRING", - OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ BIT_STRING_print, BIT_STRING_constraint, - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ - OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ OCTET_STRING_decode_xer_binary, BIT_STRING_encode_xer, - OCTET_STRING_decode_uper, /* Unaligned PER decoder */ - OCTET_STRING_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BIT_STRING_tags, - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - asn_DEF_BIT_STRING_tags, /* Same as above */ - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - &asn_DEF_BIT_STRING_specs -}; + sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + &asn_DEF_BIT_STRING_specs}; /* * BIT STRING generic constraint. */ -int -BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - if(st && st->buf) { - if((st->size == 0 && st->bits_unused) - || st->bits_unused < 0 || st->bits_unused > 7) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: invalid padding byte (%s:%d)", - td->name, __FILE__, __LINE__); + if (st && st->buf) + { + if ((st->size == 0 && st->bits_unused) || st->bits_unused < 0 || + st->bits_unused > 7) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", td->name, + __FILE__, __LINE__); + return -1; + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } return 0; } -static char *_bit_pattern[16] = { - "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", - "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" -}; +static char *_bit_pattern[16] = {"0000", "0001", "0010", "0011", "0100", "0101", + "0110", "0111", "1000", "1001", "1010", "1011", + "1100", "1101", "1110", "1111"}; -asn_enc_rval_t -BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; char scratch[128]; char *p = scratch; @@ -85,61 +81,60 @@ BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, uint8_t *buf; uint8_t *end; - if(!st || !st->buf) - _ASN_ENCODE_FAILED; + if (!st || !st->buf) _ASN_ENCODE_FAILED; er.encoded = 0; buf = st->buf; - end = buf + st->size - 1; /* Last byte is special */ + end = buf + st->size - 1; /* Last byte is special */ /* * Binary dump */ - for(; buf < end; buf++) { - int v = *buf; - int nline = xcan?0:(((buf - st->buf) % 8) == 0); - if(p >= scend || nline) { - er.encoded += p - scratch; - _ASN_CALLBACK(scratch, p - scratch); - p = scratch; - if(nline) _i_ASN_TEXT_INDENT(1, ilevel); + for (; buf < end; buf++) + { + int v = *buf; + int nline = xcan ? 0 : (((buf - st->buf) % 8) == 0); + if (p >= scend || nline) + { + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + if (nline) _i_ASN_TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; } - memcpy(p + 0, _bit_pattern[v >> 4], 4); - memcpy(p + 4, _bit_pattern[v & 0x0f], 4); - p += 8; - } - if(!xcan && ((buf - st->buf) % 8) == 0) - _i_ASN_TEXT_INDENT(1, ilevel); + if (!xcan && ((buf - st->buf) % 8) == 0) _i_ASN_TEXT_INDENT(1, ilevel); er.encoded += p - scratch; _ASN_CALLBACK(scratch, p - scratch); p = scratch; - if(buf == end) { - int v = *buf; - int ubits = st->bits_unused; - int i; - for(i = 7; i >= ubits; i--) - *p++ = (v & (1 << i)) ? 0x31 : 0x30; - er.encoded += p - scratch; - _ASN_CALLBACK(scratch, p - scratch); - } + if (buf == end) + { + int v = *buf; + int ubits = st->bits_unused; + int i; + for (i = 7; i >= ubits; i--) *p++ = (v & (1 << i)) ? 0x31 : 0x30; + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + } - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } - /* * BIT STRING specific contents printer. */ -int -BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; char scratch[64]; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; @@ -147,10 +142,9 @@ BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, uint8_t *end; char *p = scratch; - (void)td; /* Unused argument */ + (void)td; /* Unused argument */ - if(!st || !st->buf) - return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; ilevel++; buf = st->buf; @@ -159,31 +153,32 @@ BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, /* * Hexadecimal dump. */ - for(; buf < end; buf++) { - if((buf - st->buf) % 16 == 0 && (st->size > 16) - && buf != st->buf) { - _i_INDENT(1); - /* Dump the string */ - if(cb(scratch, p - scratch, app_key) < 0) return -1; - p = scratch; - } - *p++ = h2c[*buf >> 4]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - - if(p > scratch) { - p--; /* Eat the tailing space */ - - if((st->size > 16)) { - _i_INDENT(1); + for (; buf < end; buf++) + { + if ((buf - st->buf) % 16 == 0 && (st->size > 16) && buf != st->buf) + { + _i_INDENT(1); + /* Dump the string */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; } - /* Dump the incomplete 16-bytes row */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - } + if (p > scratch) + { + p--; /* Eat the tailing space */ + + if ((st->size > 16)) + { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + } return 0; } - diff --git a/src/core/libs/supl/asn-rrlp/BOOLEAN.c b/src/core/libs/supl/asn-rrlp/BOOLEAN.c index cdb4d4a5c..985f2638e 100644 --- a/src/core/libs/supl/asn-rrlp/BOOLEAN.c +++ b/src/core/libs/supl/asn-rrlp/BOOLEAN.c @@ -10,8 +10,7 @@ * BOOLEAN basic type description. */ static ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2))}; asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { "BOOLEAN", "BOOLEAN", @@ -22,243 +21,272 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { BOOLEAN_encode_der, BOOLEAN_decode_xer, BOOLEAN_encode_xer, - BOOLEAN_decode_uper, /* Unaligned PER decoder */ - BOOLEAN_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + BOOLEAN_decode_uper, /* Unaligned PER decoder */ + BOOLEAN_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BOOLEAN_tags, sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - asn_DEF_BOOLEAN_tags, /* Same as above */ + asn_DEF_BOOLEAN_tags, /* Same as above */ sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Decode BOOLEAN type. */ -asn_dec_rval_t -BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **bool_value, const void *buf_ptr, size_t size, - int tag_mode) { +asn_dec_rval_t BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **bool_value, + const void *buf_ptr, size_t size, + int tag_mode) +{ BOOLEAN_t *st = (BOOLEAN_t *)*bool_value; asn_dec_rval_t rval; ber_tlv_len_t length; ber_tlv_len_t lidx; - if(st == NULL) { - st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); - if(st == NULL) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; + if (st == NULL) + { + st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); + if (st == NULL) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } } - } - ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", td->name, tag_mode); /* * Check tags. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("Boolean length is %d bytes", (int)length); buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } /* * Compute boolean value. */ - for(*st = 0, lidx = 0; - (lidx < length) && *st == 0; lidx++) { - /* - * Very simple approach: read bytes until the end or - * value is already TRUE. - * BOOLEAN is not supposed to contain meaningful data anyway. - */ - *st |= ((const uint8_t *)buf_ptr)[lidx]; - } + for (*st = 0, lidx = 0; (lidx < length) && *st == 0; lidx++) + { + /* + * Very simple approach: read bytes until the end or + * value is already TRUE. + * BOOLEAN is not supposed to contain meaningful data anyway. + */ + *st |= ((const uint8_t *)buf_ptr)[lidx]; + } rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", - (long)rval.consumed, (long)length, - td->name, *st); - + ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", (long)rval.consumed, + (long)length, td->name, *st); + return rval; } -asn_enc_rval_t -BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t erval; BOOLEAN_t *st = (BOOLEAN_t *)sptr; erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - - if(cb) { - uint8_t bool_value; - - bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ - - if(cb(&bool_value, 1, app_key) < 0) { - erval.encoded = -1; + if (erval.encoded == -1) + { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } - } + + if (cb) + { + uint8_t bool_value; + + bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ + + if (cb(&bool_value, 1, app_key) < 0) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } erval.encoded += 1; _ASN_ENCODED_OK(erval); } - /* * Decode the chunk of XML text encoding INTEGER. */ -static enum xer_pbd_rval -BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { +static enum xer_pbd_rval BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, + void *sptr, + const void *chunk_buf, + size_t chunk_size) +{ BOOLEAN_t *st = (BOOLEAN_t *)sptr; const char *p = (const char *)chunk_buf; (void)td; - if(chunk_size && p[0] == 0x3c /* '<' */) { - switch(xer_check_tag(chunk_buf, chunk_size, "false")) { - case XCT_BOTH: - /* "" */ - *st = 0; - break; - case XCT_UNKNOWN_BO: - if(xer_check_tag(chunk_buf, chunk_size, "true") - != XCT_BOTH) - return XPBD_BROKEN_ENCODING; - /* "" */ - *st = 1; /* Or 0xff as in DER?.. */ - break; - default: - return XPBD_BROKEN_ENCODING; + if (chunk_size && p[0] == 0x3c /* '<' */) + { + switch (xer_check_tag(chunk_buf, chunk_size, "false")) + { + case XCT_BOTH: + /* "" */ + *st = 0; + break; + case XCT_UNKNOWN_BO: + if (xer_check_tag(chunk_buf, chunk_size, "true") != + XCT_BOTH) + return XPBD_BROKEN_ENCODING; + /* "" */ + *st = 1; /* Or 0xff as in DER?.. */ + break; + default: + return XPBD_BROKEN_ENCODING; + } + return XPBD_BODY_CONSUMED; + } + else + { + if (xer_is_whitespace(chunk_buf, chunk_size)) + return XPBD_NOT_BODY_IGNORE; + else + return XPBD_BROKEN_ENCODING; } - return XPBD_BODY_CONSUMED; - } else { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return XPBD_NOT_BODY_IGNORE; - else - return XPBD_BROKEN_ENCODING; - } } - -asn_dec_rval_t -BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size, - BOOLEAN__xer_body_decode); +asn_dec_rval_t BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ + return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(BOOLEAN_t), + opt_mname, buf_ptr, size, + BOOLEAN__xer_body_decode); } -asn_enc_rval_t -BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; - if(!st) _ASN_ENCODE_FAILED; + if (!st) _ASN_ENCODE_FAILED; - if(*st) { - _ASN_CALLBACK("", 7); - er.encoded = 7; - } else { - _ASN_CALLBACK("", 8); - er.encoded = 8; - } + if (*st) + { + _ASN_CALLBACK("", 7); + er.encoded = 7; + } + else + { + _ASN_CALLBACK("", 8); + er.encoded = 8; + } _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -int -BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; const char *buf; size_t buflen; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st) { - if(*st) { - buf = "TRUE"; - buflen = 4; - } else { - buf = "FALSE"; - buflen = 5; + if (st) + { + if (*st) + { + buf = "TRUE"; + buflen = 4; + } + else + { + buf = "FALSE"; + buflen = 5; + } + } + else + { + buf = ""; + buflen = 8; } - } else { - buf = ""; - buflen = 8; - } return (cb(buf, buflen, app_key) < 0) ? -1 : 0; } -void -BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { - if(td && ptr && !contents_only) { - FREEMEM(ptr); - } +void BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (td && ptr && !contents_only) + { + FREEMEM(ptr); + } } -asn_dec_rval_t -BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rv; BOOLEAN_t *st = (BOOLEAN_t *)*sptr; (void)opt_codec_ctx; (void)constraints; - if(!st) { - st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } /* * Extract a single bit */ - switch(per_get_few_bits(pd, 1)) { - case 1: *st = 1; break; - case 0: *st = 0; break; - case -1: default: _ASN_DECODE_STARVED; - } + switch (per_get_few_bits(pd, 1)) + { + case 1: + *st = 1; + break; + case 0: + *st = 0; + break; + case -1: + default: + _ASN_DECODE_STARVED; + } ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); @@ -267,16 +295,16 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } - -asn_enc_rval_t -BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er; (void)constraints; - if(!st) _ASN_ENCODE_FAILED; + if (!st) _ASN_ENCODE_FAILED; per_put_few_bits(po, *st ? 1 : 0, 1); diff --git a/src/core/libs/supl/asn-rrlp/BOOLEAN.h b/src/core/libs/supl/asn-rrlp/BOOLEAN.h index b74f2b430..b99faaa4a 100644 --- a/src/core/libs/supl/asn-rrlp/BOOLEAN.h +++ b/src/core/libs/supl/asn-rrlp/BOOLEAN.h @@ -13,10 +13,10 @@ extern "C" #endif /* - * The underlying integer may contain various values, but everything - * non-zero is capped to 0xff by the DER encoder. The BER decoder may - * yield non-zero values different from 1, beware. - */ + * The underlying integer may contain various values, but everything + * non-zero is capped to 0xff by the DER encoder. The BER decoder may + * yield non-zero values different from 1, beware. + */ typedef int BOOLEAN_t; extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; diff --git a/src/core/libs/supl/asn-rrlp/BSIC.c b/src/core/libs/supl/asn-rrlp/BSIC.c index 9c5886fca..ce7b30ad0 100644 --- a/src/core/libs/supl/asn-rrlp/BSIC.c +++ b/src/core/libs/supl/asn-rrlp/BSIC.c @@ -6,119 +6,128 @@ #include "BSIC.h" -int -BSIC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int BSIC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -BSIC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void BSIC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -BSIC_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void BSIC_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ BSIC_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -BSIC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int BSIC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ BSIC_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -BSIC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t BSIC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ BSIC_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -BSIC_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BSIC_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ BSIC_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -BSIC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t BSIC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ BSIC_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -BSIC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BSIC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ BSIC_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -BSIC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t BSIC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ BSIC_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -BSIC_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t BSIC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ BSIC_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_BSIC_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_BSIC_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_BSIC = { "BSIC", "BSIC", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_BSIC = { BSIC_encode_xer, BSIC_decode_uper, BSIC_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BSIC_tags_1, - sizeof(asn_DEF_BSIC_tags_1) - /sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ - asn_DEF_BSIC_tags_1, /* Same as above */ - sizeof(asn_DEF_BSIC_tags_1) - /sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ + sizeof(asn_DEF_BSIC_tags_1) / sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ + asn_DEF_BSIC_tags_1, /* Same as above */ + sizeof(asn_DEF_BSIC_tags_1) / sizeof(asn_DEF_BSIC_tags_1[0]), /* 1 */ &ASN_PER_TYPE_BSIC_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BSIC.h b/src/core/libs/supl/asn-rrlp/BSIC.h index 6f1e0f6f3..6f93b1918 100644 --- a/src/core/libs/supl/asn-rrlp/BSIC.h +++ b/src/core/libs/supl/asn-rrlp/BSIC.h @@ -7,7 +7,6 @@ #ifndef _BSIC_H_ #define _BSIC_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c index 6f63fb7c4..7ec6c745f 100644 --- a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c +++ b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.c @@ -7,40 +7,34 @@ #include "BSICAndCarrier.h" static asn_TYPE_member_t asn_MBR_BSICAndCarrier_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, carrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "carrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, bsic), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, + {ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, carrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "carrier"}, + {ATF_NOFLAGS, 0, offsetof(struct BSICAndCarrier, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, }; static ber_tlv_tag_t asn_DEF_BSICAndCarrier_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_BSICAndCarrier_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* carrier at 304 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* bsic at 306 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* carrier at 304 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* bsic at 306 */ }; static asn_SEQUENCE_specifics_t asn_SPC_BSICAndCarrier_specs_1 = { sizeof(struct BSICAndCarrier), offsetof(struct BSICAndCarrier, _asn_ctx), asn_MAP_BSICAndCarrier_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_BSICAndCarrier = { "BSICAndCarrier", @@ -54,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_BSICAndCarrier = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BSICAndCarrier_tags_1, - sizeof(asn_DEF_BSICAndCarrier_tags_1) - /sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ - asn_DEF_BSICAndCarrier_tags_1, /* Same as above */ - sizeof(asn_DEF_BSICAndCarrier_tags_1) - /sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_BSICAndCarrier_tags_1) / + sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ + asn_DEF_BSICAndCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_BSICAndCarrier_tags_1) / + sizeof(asn_DEF_BSICAndCarrier_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_BSICAndCarrier_1, - 2, /* Elements count */ - &asn_SPC_BSICAndCarrier_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_BSICAndCarrier_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h index cc343c64e..1c54aa6a2 100644 --- a/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h +++ b/src/core/libs/supl/asn-rrlp/BSICAndCarrier.h @@ -7,7 +7,6 @@ #ifndef _BSICAndCarrier_H_ #define _BSICAndCarrier_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/BTSPosition.c b/src/core/libs/supl/asn-rrlp/BTSPosition.c index 5b9d8db0f..a66dee5ba 100644 --- a/src/core/libs/supl/asn-rrlp/BTSPosition.c +++ b/src/core/libs/supl/asn-rrlp/BTSPosition.c @@ -6,115 +6,132 @@ #include "BTSPosition.h" -int -BTSPosition_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { - const Ext_GeographicalInformation_t *st = (const Ext_GeographicalInformation_t *)sptr; +int BTSPosition_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ + const Ext_GeographicalInformation_t *st = + (const Ext_GeographicalInformation_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 20)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 20)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using Ext_GeographicalInformation, * so here we adjust the DEF accordingly. */ -static void -BTSPosition_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_Ext_GeographicalInformation.free_struct; - td->print_struct = asn_DEF_Ext_GeographicalInformation.print_struct; - td->ber_decoder = asn_DEF_Ext_GeographicalInformation.ber_decoder; - td->der_encoder = asn_DEF_Ext_GeographicalInformation.der_encoder; - td->xer_decoder = asn_DEF_Ext_GeographicalInformation.xer_decoder; - td->xer_encoder = asn_DEF_Ext_GeographicalInformation.xer_encoder; - td->uper_decoder = asn_DEF_Ext_GeographicalInformation.uper_decoder; - td->uper_encoder = asn_DEF_Ext_GeographicalInformation.uper_encoder; - if(!td->per_constraints) - td->per_constraints = asn_DEF_Ext_GeographicalInformation.per_constraints; - td->elements = asn_DEF_Ext_GeographicalInformation.elements; +static void BTSPosition_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_Ext_GeographicalInformation.free_struct; + td->print_struct = asn_DEF_Ext_GeographicalInformation.print_struct; + td->ber_decoder = asn_DEF_Ext_GeographicalInformation.ber_decoder; + td->der_encoder = asn_DEF_Ext_GeographicalInformation.der_encoder; + td->xer_decoder = asn_DEF_Ext_GeographicalInformation.xer_decoder; + td->xer_encoder = asn_DEF_Ext_GeographicalInformation.xer_encoder; + td->uper_decoder = asn_DEF_Ext_GeographicalInformation.uper_decoder; + td->uper_encoder = asn_DEF_Ext_GeographicalInformation.uper_encoder; + if (!td->per_constraints) + td->per_constraints = + asn_DEF_Ext_GeographicalInformation.per_constraints; + td->elements = asn_DEF_Ext_GeographicalInformation.elements; td->elements_count = asn_DEF_Ext_GeographicalInformation.elements_count; - td->specifics = asn_DEF_Ext_GeographicalInformation.specifics; + td->specifics = asn_DEF_Ext_GeographicalInformation.specifics; } -void -BTSPosition_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void BTSPosition_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ BTSPosition_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -BTSPosition_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int BTSPosition_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ BTSPosition_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -BTSPosition_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t BTSPosition_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ BTSPosition_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -BTSPosition_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BTSPosition_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ BTSPosition_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -BTSPosition_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t BTSPosition_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ BTSPosition_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -BTSPosition_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BTSPosition_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ BTSPosition_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -BTSPosition_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t BTSPosition_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ BTSPosition_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -BTSPosition_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t BTSPosition_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ BTSPosition_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_BTSPosition_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; asn_TYPE_descriptor_t asn_DEF_BTSPosition = { "BTSPosition", "BTSPosition", @@ -127,15 +144,15 @@ asn_TYPE_descriptor_t asn_DEF_BTSPosition = { BTSPosition_encode_xer, BTSPosition_decode_uper, BTSPosition_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BTSPosition_tags_1, - sizeof(asn_DEF_BTSPosition_tags_1) - /sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ - asn_DEF_BTSPosition_tags_1, /* Same as above */ - sizeof(asn_DEF_BTSPosition_tags_1) - /sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_BTSPosition_tags_1) / + sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ + asn_DEF_BTSPosition_tags_1, /* Same as above */ + sizeof(asn_DEF_BTSPosition_tags_1) / + sizeof(asn_DEF_BTSPosition_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BTSPosition.h b/src/core/libs/supl/asn-rrlp/BTSPosition.h index f4ba8f776..12acab66d 100644 --- a/src/core/libs/supl/asn-rrlp/BTSPosition.h +++ b/src/core/libs/supl/asn-rrlp/BTSPosition.h @@ -7,7 +7,6 @@ #ifndef _BTSPosition_H_ #define _BTSPosition_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/BadSignalElement.c b/src/core/libs/supl/asn-rrlp/BadSignalElement.c index e203a2012..9069be966 100644 --- a/src/core/libs/supl/asn-rrlp/BadSignalElement.c +++ b/src/core/libs/supl/asn-rrlp/BadSignalElement.c @@ -6,73 +6,69 @@ #include "BadSignalElement.h" -static int -memb_badSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_badSignalID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_BAD_SIGNAL_ID_CONSTR_3 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_BadSignalElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct BadSignalElement, badSVID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "badSVID" - }, - { ATF_POINTER, 1, offsetof(struct BadSignalElement, badSignalID), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_badSignalID_constraint_1, - &ASN_PER_MEMB_BAD_SIGNAL_ID_CONSTR_3, - 0, - "badSignalID" - }, + {ATF_NOFLAGS, 0, offsetof(struct BadSignalElement, badSVID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "badSVID"}, + {ATF_POINTER, 1, offsetof(struct BadSignalElement, badSignalID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_badSignalID_constraint_1, + &ASN_PER_MEMB_BAD_SIGNAL_ID_CONSTR_3, 0, "badSignalID"}, }; -static int asn_MAP_BadSignalElement_oms_1[] = { 1 }; +static int asn_MAP_BadSignalElement_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_BadSignalElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_BadSignalElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* badSVID at 1300 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* badSignalID at 1301 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* badSVID at 1300 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* badSignalID at 1301 */ }; static asn_SEQUENCE_specifics_t asn_SPC_BadSignalElement_specs_1 = { sizeof(struct BadSignalElement), offsetof(struct BadSignalElement, _asn_ctx), asn_MAP_BadSignalElement_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_BadSignalElement_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_BadSignalElement_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_BadSignalElement = { "BadSignalElement", @@ -86,16 +82,15 @@ asn_TYPE_descriptor_t asn_DEF_BadSignalElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BadSignalElement_tags_1, - sizeof(asn_DEF_BadSignalElement_tags_1) - /sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ - asn_DEF_BadSignalElement_tags_1, /* Same as above */ - sizeof(asn_DEF_BadSignalElement_tags_1) - /sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_BadSignalElement_tags_1) / + sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ + asn_DEF_BadSignalElement_tags_1, /* Same as above */ + sizeof(asn_DEF_BadSignalElement_tags_1) / + sizeof(asn_DEF_BadSignalElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_BadSignalElement_1, - 2, /* Elements count */ - &asn_SPC_BadSignalElement_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_BadSignalElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BadSignalElement.h b/src/core/libs/supl/asn-rrlp/BadSignalElement.h index 3d953bf66..935301877 100644 --- a/src/core/libs/supl/asn-rrlp/BadSignalElement.h +++ b/src/core/libs/supl/asn-rrlp/BadSignalElement.h @@ -7,7 +7,6 @@ #ifndef _BadSignalElement_H_ #define _BadSignalElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/BitNumber.c b/src/core/libs/supl/asn-rrlp/BitNumber.c index 6f0540a98..6cd0d5ff8 100644 --- a/src/core/libs/supl/asn-rrlp/BitNumber.c +++ b/src/core/libs/supl/asn-rrlp/BitNumber.c @@ -6,119 +6,130 @@ #include "BitNumber.h" -int -BitNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int BitNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 156)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 156)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -BitNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void BitNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -BitNumber_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void BitNumber_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ BitNumber_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -BitNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int BitNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ BitNumber_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -BitNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t BitNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ BitNumber_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -BitNumber_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BitNumber_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ BitNumber_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -BitNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t BitNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ BitNumber_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -BitNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BitNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ BitNumber_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -BitNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t BitNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ BitNumber_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -BitNumber_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t BitNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ BitNumber_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_BIT_NUMBER_CONSTR_1 = { - { APC_CONSTRAINED, 8, 8, 0, 156 } /* (0..156) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 156} /* (0..156) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_BitNumber_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_BitNumber = { "BitNumber", "BitNumber", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_BitNumber = { BitNumber_encode_xer, BitNumber_decode_uper, BitNumber_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BitNumber_tags_1, - sizeof(asn_DEF_BitNumber_tags_1) - /sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ - asn_DEF_BitNumber_tags_1, /* Same as above */ - sizeof(asn_DEF_BitNumber_tags_1) - /sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ + sizeof(asn_DEF_BitNumber_tags_1) / + sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ + asn_DEF_BitNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_BitNumber_tags_1) / + sizeof(asn_DEF_BitNumber_tags_1[0]), /* 1 */ &ASN_PER_TYPE_BIT_NUMBER_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/BitNumber.h b/src/core/libs/supl/asn-rrlp/BitNumber.h index 03d7431fb..522da533b 100644 --- a/src/core/libs/supl/asn-rrlp/BitNumber.h +++ b/src/core/libs/supl/asn-rrlp/BitNumber.h @@ -7,7 +7,6 @@ #ifndef _BitNumber_H_ #define _BitNumber_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c index f6baa10fa..00640c2ce 100644 --- a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c +++ b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.c @@ -7,40 +7,34 @@ #include "CalcAssistanceBTS.h" static asn_TYPE_member_t asn_MBR_CalcAssistanceBTS_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, fineRTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FineRTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fineRTD" - }, - { ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, referenceWGS84), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceWGS84, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceWGS84" - }, + {ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, fineRTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FineRTD, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fineRTD"}, + {ATF_NOFLAGS, 0, offsetof(struct CalcAssistanceBTS, referenceWGS84), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceWGS84, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceWGS84"}, }; static ber_tlv_tag_t asn_DEF_CalcAssistanceBTS_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_CalcAssistanceBTS_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fineRTD at 241 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceWGS84 at 243 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* fineRTD at 241 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* referenceWGS84 at 243 */ }; static asn_SEQUENCE_specifics_t asn_SPC_CalcAssistanceBTS_specs_1 = { sizeof(struct CalcAssistanceBTS), offsetof(struct CalcAssistanceBTS, _asn_ctx), asn_MAP_CalcAssistanceBTS_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_CalcAssistanceBTS = { "CalcAssistanceBTS", @@ -54,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_CalcAssistanceBTS = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CalcAssistanceBTS_tags_1, - sizeof(asn_DEF_CalcAssistanceBTS_tags_1) - /sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ - asn_DEF_CalcAssistanceBTS_tags_1, /* Same as above */ - sizeof(asn_DEF_CalcAssistanceBTS_tags_1) - /sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_CalcAssistanceBTS_tags_1) / + sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ + asn_DEF_CalcAssistanceBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_CalcAssistanceBTS_tags_1) / + sizeof(asn_DEF_CalcAssistanceBTS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_CalcAssistanceBTS_1, - 2, /* Elements count */ - &asn_SPC_CalcAssistanceBTS_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_CalcAssistanceBTS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h index 8048388ac..90a2c4bba 100644 --- a/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h +++ b/src/core/libs/supl/asn-rrlp/CalcAssistanceBTS.h @@ -7,7 +7,6 @@ #ifndef _CalcAssistanceBTS_H_ #define _CalcAssistanceBTS_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/CellID.c b/src/core/libs/supl/asn-rrlp/CellID.c index 8eaf3d219..a2303c901 100644 --- a/src/core/libs/supl/asn-rrlp/CellID.c +++ b/src/core/libs/supl/asn-rrlp/CellID.c @@ -6,119 +6,128 @@ #include "CellID.h" -int -CellID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CellID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -CellID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void CellID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -CellID_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void CellID_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ CellID_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -CellID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int CellID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ CellID_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -CellID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t CellID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ CellID_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -CellID_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CellID_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ CellID_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -CellID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t CellID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ CellID_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -CellID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CellID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ CellID_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -CellID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t CellID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ CellID_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -CellID_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t CellID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ CellID_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_CELL_ID_CONSTR_1 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_CellID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_CellID = { "CellID", "CellID", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_CellID = { CellID_encode_xer, CellID_decode_uper, CellID_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CellID_tags_1, - sizeof(asn_DEF_CellID_tags_1) - /sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ - asn_DEF_CellID_tags_1, /* Same as above */ - sizeof(asn_DEF_CellID_tags_1) - /sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ + sizeof(asn_DEF_CellID_tags_1) / sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ + asn_DEF_CellID_tags_1, /* Same as above */ + sizeof(asn_DEF_CellID_tags_1) / sizeof(asn_DEF_CellID_tags_1[0]), /* 1 */ &ASN_PER_TYPE_CELL_ID_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/CellID.h b/src/core/libs/supl/asn-rrlp/CellID.h index 4c9f6dcdf..ecda1a3c1 100644 --- a/src/core/libs/supl/asn-rrlp/CellID.h +++ b/src/core/libs/supl/asn-rrlp/CellID.h @@ -7,7 +7,6 @@ #ifndef _CellID_H_ #define _CellID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c index 05c1cdb50..a68d71bbd 100644 --- a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c +++ b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.c @@ -7,40 +7,33 @@ #include "CellIDAndLAC.h" static asn_TYPE_member_t asn_MBR_CellIDAndLAC_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceLAC), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LAC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceLAC" - }, - { ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceCI), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceCI" - }, + {ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceLAC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LAC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceLAC"}, + {ATF_NOFLAGS, 0, offsetof(struct CellIDAndLAC, referenceCI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceCI"}, }; static ber_tlv_tag_t asn_DEF_CellIDAndLAC_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_CellIDAndLAC_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceLAC at 313 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceCI at 315 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceLAC at 313 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* referenceCI at 315 */ }; static asn_SEQUENCE_specifics_t asn_SPC_CellIDAndLAC_specs_1 = { sizeof(struct CellIDAndLAC), offsetof(struct CellIDAndLAC, _asn_ctx), asn_MAP_CellIDAndLAC_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_CellIDAndLAC = { "CellIDAndLAC", @@ -54,16 +47,15 @@ asn_TYPE_descriptor_t asn_DEF_CellIDAndLAC = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CellIDAndLAC_tags_1, - sizeof(asn_DEF_CellIDAndLAC_tags_1) - /sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ - asn_DEF_CellIDAndLAC_tags_1, /* Same as above */ - sizeof(asn_DEF_CellIDAndLAC_tags_1) - /sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_CellIDAndLAC_tags_1) / + sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ + asn_DEF_CellIDAndLAC_tags_1, /* Same as above */ + sizeof(asn_DEF_CellIDAndLAC_tags_1) / + sizeof(asn_DEF_CellIDAndLAC_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_CellIDAndLAC_1, - 2, /* Elements count */ - &asn_SPC_CellIDAndLAC_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_CellIDAndLAC_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h index 634ff5c73..4086737dc 100644 --- a/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h +++ b/src/core/libs/supl/asn-rrlp/CellIDAndLAC.h @@ -7,7 +7,6 @@ #ifndef _CellIDAndLAC_H_ #define _CellIDAndLAC_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ControlHeader.c b/src/core/libs/supl/asn-rrlp/ControlHeader.c index 4b97ad5a5..88acf8d33 100644 --- a/src/core/libs/supl/asn-rrlp/ControlHeader.c +++ b/src/core/libs/supl/asn-rrlp/ControlHeader.c @@ -7,112 +7,83 @@ #include "ControlHeader.h" static asn_TYPE_member_t asn_MBR_ControlHeader_1[] = { - { ATF_POINTER, 9, offsetof(struct ControlHeader, referenceTime), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceTime" - }, - { ATF_POINTER, 8, offsetof(struct ControlHeader, refLocation), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RefLocation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "refLocation" - }, - { ATF_POINTER, 7, offsetof(struct ControlHeader, dgpsCorrections), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_DGPSCorrections, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "dgpsCorrections" - }, - { ATF_POINTER, 6, offsetof(struct ControlHeader, navigationModel), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NavigationModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "navigationModel" - }, - { ATF_POINTER, 5, offsetof(struct ControlHeader, ionosphericModel), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_IonosphericModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ionosphericModel" - }, - { ATF_POINTER, 4, offsetof(struct ControlHeader, utcModel), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UTCModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "utcModel" - }, - { ATF_POINTER, 3, offsetof(struct ControlHeader, almanac), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Almanac, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "almanac" - }, - { ATF_POINTER, 2, offsetof(struct ControlHeader, acquisAssist), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AcquisAssist, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "acquisAssist" - }, - { ATF_POINTER, 1, offsetof(struct ControlHeader, realTimeIntegrity), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOf_BadSatelliteSet, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "realTimeIntegrity" - }, + {ATF_POINTER, 9, offsetof(struct ControlHeader, referenceTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceTime"}, + {ATF_POINTER, 8, offsetof(struct ControlHeader, refLocation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RefLocation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "refLocation"}, + {ATF_POINTER, 7, offsetof(struct ControlHeader, dgpsCorrections), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_DGPSCorrections, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "dgpsCorrections"}, + {ATF_POINTER, 6, offsetof(struct ControlHeader, navigationModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NavigationModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "navigationModel"}, + {ATF_POINTER, 5, offsetof(struct ControlHeader, ionosphericModel), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_IonosphericModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ionosphericModel"}, + {ATF_POINTER, 4, offsetof(struct ControlHeader, utcModel), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTCModel, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "utcModel"}, + {ATF_POINTER, 3, offsetof(struct ControlHeader, almanac), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Almanac, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "almanac"}, + {ATF_POINTER, 2, offsetof(struct ControlHeader, acquisAssist), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AcquisAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "acquisAssist"}, + {ATF_POINTER, 1, offsetof(struct ControlHeader, realTimeIntegrity), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOf_BadSatelliteSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "realTimeIntegrity"}, }; -static int asn_MAP_ControlHeader_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static int asn_MAP_ControlHeader_oms_1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; static ber_tlv_tag_t asn_DEF_ControlHeader_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ControlHeader_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceTime at 574 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refLocation at 575 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dgpsCorrections at 576 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* navigationModel at 577 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ionosphericModel at 578 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* utcModel at 579 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* almanac at 580 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* acquisAssist at 581 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* realTimeIntegrity at 582 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceTime at 574 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* refLocation at 575 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* dgpsCorrections at 576 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* navigationModel at 577 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* ionosphericModel at 578 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* utcModel at 579 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* almanac at 580 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0}, /* acquisAssist at 581 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0} /* realTimeIntegrity at 582 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ControlHeader_specs_1 = { sizeof(struct ControlHeader), offsetof(struct ControlHeader, _asn_ctx), asn_MAP_ControlHeader_tag2el_1, - 9, /* Count of tags in the map */ - asn_MAP_ControlHeader_oms_1, /* Optional members */ - 9, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 9, /* Count of tags in the map */ + asn_MAP_ControlHeader_oms_1, /* Optional members */ + 9, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ControlHeader = { "ControlHeader", @@ -126,16 +97,15 @@ asn_TYPE_descriptor_t asn_DEF_ControlHeader = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ControlHeader_tags_1, - sizeof(asn_DEF_ControlHeader_tags_1) - /sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ - asn_DEF_ControlHeader_tags_1, /* Same as above */ - sizeof(asn_DEF_ControlHeader_tags_1) - /sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ControlHeader_tags_1) / + sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ + asn_DEF_ControlHeader_tags_1, /* Same as above */ + sizeof(asn_DEF_ControlHeader_tags_1) / + sizeof(asn_DEF_ControlHeader_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ControlHeader_1, - 9, /* Elements count */ - &asn_SPC_ControlHeader_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_ControlHeader_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ControlHeader.h b/src/core/libs/supl/asn-rrlp/ControlHeader.h index 59e3a1873..208936b03 100644 --- a/src/core/libs/supl/asn-rrlp/ControlHeader.h +++ b/src/core/libs/supl/asn-rrlp/ControlHeader.h @@ -7,7 +7,6 @@ #ifndef _ControlHeader_H_ #define _ControlHeader_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c index b6db393dc..dfb1c5d23 100644 --- a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c +++ b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.c @@ -6,191 +6,185 @@ #include "DGANSSSgnElement.h" -static int -memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_pseudoRangeCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_pseudoRangeCor_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2047 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2047 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -127 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -127 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_IOD_CONSTR_3 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UDRE_CONSTR_4 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5 = { - { APC_CONSTRAINED, 12, 12, -2047, 2047 } /* (-2047..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, -2047, 2047} /* (-2047..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6 = { - { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -127, 127} /* (-127..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_DGANSSSgnElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, svID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svID" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, iod), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_iod_constraint_1, - &ASN_PER_MEMB_IOD_CONSTR_3, - 0, - "iod" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, udre), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_udre_constraint_1, - &ASN_PER_MEMB_UDRE_CONSTR_4, - 0, - "udre" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, pseudoRangeCor), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_pseudoRangeCor_constraint_1, - &ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5, - 0, - "pseudoRangeCor" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, rangeRateCor), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_rangeRateCor_constraint_1, - &ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6, - 0, - "rangeRateCor" - }, + {ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svID"}, + {ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, iod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_iod_constraint_1, &ASN_PER_MEMB_IOD_CONSTR_3, + 0, "iod"}, + {ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, udre), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_udre_constraint_1, + &ASN_PER_MEMB_UDRE_CONSTR_4, 0, "udre"}, + {ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, pseudoRangeCor), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_pseudoRangeCor_constraint_1, + &ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5, 0, "pseudoRangeCor"}, + {ATF_NOFLAGS, 0, offsetof(struct DGANSSSgnElement, rangeRateCor), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_rangeRateCor_constraint_1, + &ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6, 0, "rangeRateCor"}, }; static ber_tlv_tag_t asn_DEF_DGANSSSgnElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_DGANSSSgnElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1207 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* iod at 1210 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* udre at 1213 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pseudoRangeCor at 1217 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* rangeRateCor at 1221 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* svID at 1207 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* iod at 1210 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* udre at 1213 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* pseudoRangeCor at 1217 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* rangeRateCor at 1221 */ }; static asn_SEQUENCE_specifics_t asn_SPC_DGANSSSgnElement_specs_1 = { sizeof(struct DGANSSSgnElement), offsetof(struct DGANSSSgnElement, _asn_ctx), asn_MAP_DGANSSSgnElement_tag2el_1, - 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_DGANSSSgnElement = { "DGANSSSgnElement", @@ -204,16 +198,15 @@ asn_TYPE_descriptor_t asn_DEF_DGANSSSgnElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_DGANSSSgnElement_tags_1, - sizeof(asn_DEF_DGANSSSgnElement_tags_1) - /sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ - asn_DEF_DGANSSSgnElement_tags_1, /* Same as above */ - sizeof(asn_DEF_DGANSSSgnElement_tags_1) - /sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_DGANSSSgnElement_tags_1) / + sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ + asn_DEF_DGANSSSgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_DGANSSSgnElement_tags_1) / + sizeof(asn_DEF_DGANSSSgnElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_DGANSSSgnElement_1, - 5, /* Elements count */ - &asn_SPC_DGANSSSgnElement_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_DGANSSSgnElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h index d294bc71c..c1320cdef 100644 --- a/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h +++ b/src/core/libs/supl/asn-rrlp/DGANSSSgnElement.h @@ -7,7 +7,6 @@ #ifndef _DGANSSSgnElement_H_ #define _DGANSSSgnElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/DGPSCorrections.c b/src/core/libs/supl/asn-rrlp/DGPSCorrections.c index 522e01408..e1fa3d555 100644 --- a/src/core/libs/supl/asn-rrlp/DGPSCorrections.c +++ b/src/core/libs/supl/asn-rrlp/DGPSCorrections.c @@ -6,111 +6,107 @@ #include "DGPSCorrections.h" -static int -memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 604799)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 604799)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_status_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_status_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GPS_TOW_CONSTR_2 = { - { APC_CONSTRAINED, 20, -1, 0, 604799 } /* (0..604799) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 20, -1, 0, 604799} /* (0..604799) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STATUS_CONSTR_3 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_DGPSCorrections_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, gpsTOW), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsTOW_constraint_1, - &ASN_PER_MEMB_GPS_TOW_CONSTR_2, - 0, - "gpsTOW" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, status), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_status_constraint_1, - &ASN_PER_MEMB_STATUS_CONSTR_3, - 0, - "status" - }, - { ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, satList), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfSatElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satList" - }, + {ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsTOW_constraint_1, + &ASN_PER_MEMB_GPS_TOW_CONSTR_2, 0, "gpsTOW"}, + {ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, status), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_status_constraint_1, + &ASN_PER_MEMB_STATUS_CONSTR_3, 0, "status"}, + {ATF_NOFLAGS, 0, offsetof(struct DGPSCorrections, satList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSatElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satList"}, }; static ber_tlv_tag_t asn_DEF_DGPSCorrections_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_DGPSCorrections_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW at 655 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* status at 656 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* satList at 659 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gpsTOW at 655 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* status at 656 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* satList at 659 */ }; static asn_SEQUENCE_specifics_t asn_SPC_DGPSCorrections_specs_1 = { sizeof(struct DGPSCorrections), offsetof(struct DGPSCorrections, _asn_ctx), asn_MAP_DGPSCorrections_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_DGPSCorrections = { "DGPSCorrections", @@ -124,16 +120,15 @@ asn_TYPE_descriptor_t asn_DEF_DGPSCorrections = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_DGPSCorrections_tags_1, - sizeof(asn_DEF_DGPSCorrections_tags_1) - /sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ - asn_DEF_DGPSCorrections_tags_1, /* Same as above */ - sizeof(asn_DEF_DGPSCorrections_tags_1) - /sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_DGPSCorrections_tags_1) / + sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ + asn_DEF_DGPSCorrections_tags_1, /* Same as above */ + sizeof(asn_DEF_DGPSCorrections_tags_1) / + sizeof(asn_DEF_DGPSCorrections_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_DGPSCorrections_1, - 3, /* Elements count */ - &asn_SPC_DGPSCorrections_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_DGPSCorrections_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/DGPSCorrections.h b/src/core/libs/supl/asn-rrlp/DGPSCorrections.h index 6c0e7a078..7f4e69151 100644 --- a/src/core/libs/supl/asn-rrlp/DGPSCorrections.h +++ b/src/core/libs/supl/asn-rrlp/DGPSCorrections.h @@ -7,7 +7,6 @@ #ifndef _DGPSCorrections_H_ #define _DGPSCorrections_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ENUMERATED.c b/src/core/libs/supl/asn-rrlp/ENUMERATED.c index ba6c3b319..b41f70a42 100644 --- a/src/core/libs/supl/asn-rrlp/ENUMERATED.c +++ b/src/core/libs/supl/asn-rrlp/ENUMERATED.c @@ -6,66 +6,67 @@ #include #include #include -#include /* Encoder and decoder of a primitive type */ +#include /* Encoder and decoder of a primitive type */ /* * ENUMERATED basic type description. */ static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { "ENUMERATED", "ENUMERATED", ASN__PRIMITIVE_TYPE_free, - INTEGER_print, /* Implemented in terms of INTEGER */ + INTEGER_print, /* Implemented in terms of INTEGER */ asn_generic_no_constraint, ber_decode_primitive, - INTEGER_encode_der, /* Implemented in terms of INTEGER */ - INTEGER_decode_xer, /* This is temporary! */ + INTEGER_encode_der, /* Implemented in terms of INTEGER */ + INTEGER_decode_xer, /* This is temporary! */ INTEGER_encode_xer, - ENUMERATED_decode_uper, /* Unaligned PER decoder */ - ENUMERATED_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + ENUMERATED_decode_uper, /* Unaligned PER decoder */ + ENUMERATED_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ENUMERATED_tags, sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), - asn_DEF_ENUMERATED_tags, /* Same as above */ + asn_DEF_ENUMERATED_tags, /* Same as above */ sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -asn_dec_rval_t -ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rval; ENUMERATED_t *st = (ENUMERATED_t *)*sptr; long value; void *vptr = &value; - if(!st) { - st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } - rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, - &vptr, pd); - if(rval.code == RC_OK) - if(asn_long2INTEGER(st, value)) - rval.code = RC_FAIL; + rval = + NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, &vptr, pd); + if (rval.code == RC_OK) + if (asn_long2INTEGER(st, value)) rval.code = RC_FAIL; return rval; } -asn_enc_rval_t -ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ ENUMERATED_t *st = (ENUMERATED_t *)sptr; int64_t value; - if(asn_INTEGER2long(st, &value)) - _ASN_ENCODE_FAILED; + if (asn_INTEGER2long(st, &value)) _ASN_ENCODE_FAILED; return NativeEnumerated_encode_uper(td, constraints, &value, po); } - diff --git a/src/core/libs/supl/asn-rrlp/EOTDQuality.c b/src/core/libs/supl/asn-rrlp/EOTDQuality.c index 1227b5e0a..7fe565c54 100644 --- a/src/core/libs/supl/asn-rrlp/EOTDQuality.c +++ b/src/core/libs/supl/asn-rrlp/EOTDQuality.c @@ -6,101 +6,102 @@ #include "EOTDQuality.h" -static int -memb_nbrOfMeasurements_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_nbrOfMeasurements_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stdOfEOTD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stdOfEOTD_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_NBR_OF_MEASUREMENTS_CONSTR_2 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STD_OF_EOTD_CONSTR_3 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_EOTDQuality_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, nbrOfMeasurements), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_nbrOfMeasurements_constraint_1, - &ASN_PER_MEMB_NBR_OF_MEASUREMENTS_CONSTR_2, - 0, - "nbrOfMeasurements" - }, - { ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, stdOfEOTD), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stdOfEOTD_constraint_1, - &ASN_PER_MEMB_STD_OF_EOTD_CONSTR_3, - 0, - "stdOfEOTD" - }, + {ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, nbrOfMeasurements), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_nbrOfMeasurements_constraint_1, + &ASN_PER_MEMB_NBR_OF_MEASUREMENTS_CONSTR_2, 0, "nbrOfMeasurements"}, + {ATF_NOFLAGS, 0, offsetof(struct EOTDQuality, stdOfEOTD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stdOfEOTD_constraint_1, + &ASN_PER_MEMB_STD_OF_EOTD_CONSTR_3, 0, "stdOfEOTD"}, }; static ber_tlv_tag_t asn_DEF_EOTDQuality_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_EOTDQuality_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nbrOfMeasurements at 393 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* stdOfEOTD at 394 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* nbrOfMeasurements at 393 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* stdOfEOTD at 394 */ }; static asn_SEQUENCE_specifics_t asn_SPC_EOTDQuality_specs_1 = { sizeof(struct EOTDQuality), offsetof(struct EOTDQuality, _asn_ctx), asn_MAP_EOTDQuality_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_EOTDQuality = { "EOTDQuality", @@ -114,16 +115,15 @@ asn_TYPE_descriptor_t asn_DEF_EOTDQuality = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_EOTDQuality_tags_1, - sizeof(asn_DEF_EOTDQuality_tags_1) - /sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ - asn_DEF_EOTDQuality_tags_1, /* Same as above */ - sizeof(asn_DEF_EOTDQuality_tags_1) - /sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_EOTDQuality_tags_1) / + sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ + asn_DEF_EOTDQuality_tags_1, /* Same as above */ + sizeof(asn_DEF_EOTDQuality_tags_1) / + sizeof(asn_DEF_EOTDQuality_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_EOTDQuality_1, - 2, /* Elements count */ - &asn_SPC_EOTDQuality_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_EOTDQuality_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/EOTDQuality.h b/src/core/libs/supl/asn-rrlp/EOTDQuality.h index be695f8ce..069d82fe0 100644 --- a/src/core/libs/supl/asn-rrlp/EOTDQuality.h +++ b/src/core/libs/supl/asn-rrlp/EOTDQuality.h @@ -7,7 +7,6 @@ #ifndef _EOTDQuality_H_ #define _EOTDQuality_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c index 0a0988469..d5012ab1b 100644 --- a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c +++ b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.c @@ -6,9 +6,10 @@ #include "EnvironmentCharacter.h" -int -EnvironmentCharacter_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int EnvironmentCharacter_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,111 +19,127 @@ EnvironmentCharacter_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -EnvironmentCharacter_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void EnvironmentCharacter_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -EnvironmentCharacter_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void EnvironmentCharacter_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -EnvironmentCharacter_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int EnvironmentCharacter_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -EnvironmentCharacter_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t EnvironmentCharacter_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -EnvironmentCharacter_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t EnvironmentCharacter_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -EnvironmentCharacter_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t EnvironmentCharacter_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -EnvironmentCharacter_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t EnvironmentCharacter_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -EnvironmentCharacter_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t EnvironmentCharacter_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -EnvironmentCharacter_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t EnvironmentCharacter_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ EnvironmentCharacter_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ENVIRONMENT_CHARACTER_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_EnvironmentCharacter_value2enum_1[] = { - { 0, 7, "badArea" }, - { 1, 10, "notBadArea" }, - { 2, 9, "mixedArea" } + {0, 7, "badArea"}, {1, 10, "notBadArea"}, {2, 9, "mixedArea"} /* This list is extensible */ }; static unsigned int asn_MAP_EnvironmentCharacter_enum2value_1[] = { - 0, /* badArea(0) */ - 2, /* mixedArea(2) */ - 1 /* notBadArea(1) */ - /* This list is extensible */ + 0, /* badArea(0) */ + 2, /* mixedArea(2) */ + 1 /* notBadArea(1) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_EnvironmentCharacter_specs_1 = { - asn_MAP_EnvironmentCharacter_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_EnvironmentCharacter_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 4, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_EnvironmentCharacter_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_EnvironmentCharacter_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_EnvironmentCharacter_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_EnvironmentCharacter = { "EnvironmentCharacter", "EnvironmentCharacter", @@ -135,15 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_EnvironmentCharacter = { EnvironmentCharacter_encode_xer, EnvironmentCharacter_decode_uper, EnvironmentCharacter_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_EnvironmentCharacter_tags_1, - sizeof(asn_DEF_EnvironmentCharacter_tags_1) - /sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ - asn_DEF_EnvironmentCharacter_tags_1, /* Same as above */ - sizeof(asn_DEF_EnvironmentCharacter_tags_1) - /sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ + sizeof(asn_DEF_EnvironmentCharacter_tags_1) / + sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ + asn_DEF_EnvironmentCharacter_tags_1, /* Same as above */ + sizeof(asn_DEF_EnvironmentCharacter_tags_1) / + sizeof(asn_DEF_EnvironmentCharacter_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ENVIRONMENT_CHARACTER_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_EnvironmentCharacter_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_EnvironmentCharacter_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h index 1da5678b7..ac2df22dc 100644 --- a/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h +++ b/src/core/libs/supl/asn-rrlp/EnvironmentCharacter.h @@ -7,7 +7,6 @@ #ifndef _EnvironmentCharacter_H_ #define _EnvironmentCharacter_H_ - #include /* Including external dependencies */ @@ -25,8 +24,8 @@ extern "C" EnvironmentCharacter_notBadArea = 1, EnvironmentCharacter_mixedArea = 2 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_EnvironmentCharacter; /* EnvironmentCharacter */ diff --git a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c index b729566dc..d73e4bb51 100644 --- a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c +++ b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.c @@ -6,181 +6,182 @@ #include "EphemerisSubframe1Reserved.h" -static int -memb_reserved1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_reserved1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_reserved2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_reserved2_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16777215)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16777215)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_reserved3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_reserved3_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16777215)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16777215)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_reserved4_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_reserved4_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_RESERVED1_CONSTR_2 = { - { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 23, -1, 0, 8388607} /* (0..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RESERVED2_CONSTR_3 = { - { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, 0, 16777215} /* (0..16777215) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RESERVED3_CONSTR_4 = { - { APC_CONSTRAINED, 24, -1, 0, 16777215 } /* (0..16777215) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, 0, 16777215} /* (0..16777215) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RESERVED4_CONSTR_5 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_EphemerisSubframe1Reserved_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_reserved1_constraint_1, - &ASN_PER_MEMB_RESERVED1_CONSTR_2, - 0, - "reserved1" - }, - { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved2), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_reserved2_constraint_1, - &ASN_PER_MEMB_RESERVED2_CONSTR_3, - 0, - "reserved2" - }, - { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved3), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_reserved3_constraint_1, - &ASN_PER_MEMB_RESERVED3_CONSTR_4, - 0, - "reserved3" - }, - { ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved4), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_reserved4_constraint_1, - &ASN_PER_MEMB_RESERVED4_CONSTR_5, - 0, - "reserved4" - }, + {ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_reserved1_constraint_1, + &ASN_PER_MEMB_RESERVED1_CONSTR_2, 0, "reserved1"}, + {ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_reserved2_constraint_1, + &ASN_PER_MEMB_RESERVED2_CONSTR_3, 0, "reserved2"}, + {ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved3), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_reserved3_constraint_1, + &ASN_PER_MEMB_RESERVED3_CONSTR_4, 0, "reserved3"}, + {ATF_NOFLAGS, 0, offsetof(struct EphemerisSubframe1Reserved, reserved4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_reserved4_constraint_1, + &ASN_PER_MEMB_RESERVED4_CONSTR_5, 0, "reserved4"}, }; static ber_tlv_tag_t asn_DEF_EphemerisSubframe1Reserved_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_EphemerisSubframe1Reserved_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* reserved1 at 755 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* reserved2 at 756 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* reserved3 at 757 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* reserved4 at 758 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* reserved1 at 755 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* reserved2 at 756 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* reserved3 at 757 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* reserved4 at 758 */ }; static asn_SEQUENCE_specifics_t asn_SPC_EphemerisSubframe1Reserved_specs_1 = { sizeof(struct EphemerisSubframe1Reserved), offsetof(struct EphemerisSubframe1Reserved, _asn_ctx), asn_MAP_EphemerisSubframe1Reserved_tag2el_1, - 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_EphemerisSubframe1Reserved = { "EphemerisSubframe1Reserved", @@ -194,16 +195,15 @@ asn_TYPE_descriptor_t asn_DEF_EphemerisSubframe1Reserved = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_EphemerisSubframe1Reserved_tags_1, - sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) - /sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ - asn_DEF_EphemerisSubframe1Reserved_tags_1, /* Same as above */ - sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) - /sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) / + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ + asn_DEF_EphemerisSubframe1Reserved_tags_1, /* Same as above */ + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1) / + sizeof(asn_DEF_EphemerisSubframe1Reserved_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_EphemerisSubframe1Reserved_1, - 4, /* Elements count */ - &asn_SPC_EphemerisSubframe1Reserved_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_EphemerisSubframe1Reserved_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h index 583dd289c..e77e10ca1 100644 --- a/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h +++ b/src/core/libs/supl/asn-rrlp/EphemerisSubframe1Reserved.h @@ -7,7 +7,6 @@ #ifndef _EphemerisSubframe1Reserved_H_ #define _EphemerisSubframe1Reserved_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ErrorCodes.c b/src/core/libs/supl/asn-rrlp/ErrorCodes.c index 81e5270d6..37819dadf 100644 --- a/src/core/libs/supl/asn-rrlp/ErrorCodes.c +++ b/src/core/libs/supl/asn-rrlp/ErrorCodes.c @@ -6,9 +6,9 @@ #include "ErrorCodes.h" -int -ErrorCodes_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ErrorCodes_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,117 +18,128 @@ ErrorCodes_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -ErrorCodes_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void ErrorCodes_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -ErrorCodes_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ErrorCodes_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ErrorCodes_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ErrorCodes_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ErrorCodes_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ErrorCodes_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ErrorCodes_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ErrorCodes_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ErrorCodes_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ErrorCodes_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ErrorCodes_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ErrorCodes_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ErrorCodes_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ErrorCodes_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ErrorCodes_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ErrorCodes_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ ErrorCodes_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ERROR_CODES_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5 } /* (0..5,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5} /* (0..5,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_ErrorCodes_value2enum_1[] = { - { 0, 9, "unDefined" }, - { 1, 15, "missingComponet" }, - { 2, 13, "incorrectData" }, - { 3, 27, "missingIEorComponentElement" }, - { 4, 15, "messageTooShort" }, - { 5, 21, "unknowReferenceNumber" } + {0, 9, "unDefined"}, + {1, 15, "missingComponet"}, + {2, 13, "incorrectData"}, + {3, 27, "missingIEorComponentElement"}, + {4, 15, "messageTooShort"}, + {5, 21, "unknowReferenceNumber"} /* This list is extensible */ }; static unsigned int asn_MAP_ErrorCodes_enum2value_1[] = { - 2, /* incorrectData(2) */ - 4, /* messageTooShort(4) */ - 1, /* missingComponet(1) */ - 3, /* missingIEorComponentElement(3) */ - 0, /* unDefined(0) */ - 5 /* unknowReferenceNumber(5) */ - /* This list is extensible */ + 2, /* incorrectData(2) */ + 4, /* messageTooShort(4) */ + 1, /* missingComponet(1) */ + 3, /* missingIEorComponentElement(3) */ + 0, /* unDefined(0) */ + 5 /* unknowReferenceNumber(5) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_ErrorCodes_specs_1 = { - asn_MAP_ErrorCodes_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_ErrorCodes_enum2value_1, /* N => "tag"; sorted by N */ - 6, /* Number of elements in the maps */ - 7, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_ErrorCodes_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ErrorCodes_enum2value_1, /* N => "tag"; sorted by N */ + 6, /* Number of elements in the maps */ + 7, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_ErrorCodes_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_ErrorCodes = { "ErrorCodes", "ErrorCodes", @@ -141,15 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_ErrorCodes = { ErrorCodes_encode_xer, ErrorCodes_decode_uper, ErrorCodes_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ErrorCodes_tags_1, - sizeof(asn_DEF_ErrorCodes_tags_1) - /sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ - asn_DEF_ErrorCodes_tags_1, /* Same as above */ - sizeof(asn_DEF_ErrorCodes_tags_1) - /sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ + sizeof(asn_DEF_ErrorCodes_tags_1) / + sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ + asn_DEF_ErrorCodes_tags_1, /* Same as above */ + sizeof(asn_DEF_ErrorCodes_tags_1) / + sizeof(asn_DEF_ErrorCodes_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ERROR_CODES_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_ErrorCodes_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_ErrorCodes_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ErrorCodes.h b/src/core/libs/supl/asn-rrlp/ErrorCodes.h index b89da417d..c7c7bf36f 100644 --- a/src/core/libs/supl/asn-rrlp/ErrorCodes.h +++ b/src/core/libs/supl/asn-rrlp/ErrorCodes.h @@ -7,7 +7,6 @@ #ifndef _ErrorCodes_H_ #define _ErrorCodes_H_ - #include /* Including external dependencies */ @@ -28,8 +27,8 @@ extern "C" ErrorCodes_messageTooShort = 4, ErrorCodes_unknowReferenceNumber = 5 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_ErrorCodes; /* ErrorCodes */ diff --git a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c index 8f704c1bf..e37e3df44 100644 --- a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c +++ b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.c @@ -6,119 +6,141 @@ #include "ExpOTDUncertainty.h" -int -ExpOTDUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ExpOTDUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -ExpOTDUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void ExpOTDUncertainty_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -ExpOTDUncertainty_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ExpOTDUncertainty_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ExpOTDUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ExpOTDUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ExpOTDUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ExpOTDUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ExpOTDUncertainty_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExpOTDUncertainty_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ExpOTDUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ExpOTDUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ExpOTDUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExpOTDUncertainty_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ExpOTDUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ExpOTDUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ExpOTDUncertainty_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ExpOTDUncertainty_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ ExpOTDUncertainty_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_EXP_OTD_UNCERTAINTY_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_ExpOTDUncertainty_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_ExpOTDUncertainty = { "ExpOTDUncertainty", "ExpOTDUncertainty", @@ -131,15 +153,15 @@ asn_TYPE_descriptor_t asn_DEF_ExpOTDUncertainty = { ExpOTDUncertainty_encode_xer, ExpOTDUncertainty_decode_uper, ExpOTDUncertainty_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ExpOTDUncertainty_tags_1, - sizeof(asn_DEF_ExpOTDUncertainty_tags_1) - /sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ - asn_DEF_ExpOTDUncertainty_tags_1, /* Same as above */ - sizeof(asn_DEF_ExpOTDUncertainty_tags_1) - /sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ + sizeof(asn_DEF_ExpOTDUncertainty_tags_1) / + sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ + asn_DEF_ExpOTDUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_ExpOTDUncertainty_tags_1) / + sizeof(asn_DEF_ExpOTDUncertainty_tags_1[0]), /* 1 */ &ASN_PER_TYPE_EXP_OTD_UNCERTAINTY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h index 43f643ebd..549dc1b69 100644 --- a/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h +++ b/src/core/libs/supl/asn-rrlp/ExpOTDUncertainty.h @@ -7,7 +7,6 @@ #ifndef _ExpOTDUncertainty_H_ #define _ExpOTDUncertainty_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ExpectedOTD.c b/src/core/libs/supl/asn-rrlp/ExpectedOTD.c index 90c7396fe..9f18a2fe4 100644 --- a/src/core/libs/supl/asn-rrlp/ExpectedOTD.c +++ b/src/core/libs/supl/asn-rrlp/ExpectedOTD.c @@ -6,119 +6,135 @@ #include "ExpectedOTD.h" -int -ExpectedOTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ExpectedOTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1250)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1250)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -ExpectedOTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void ExpectedOTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -ExpectedOTD_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ExpectedOTD_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ExpectedOTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ExpectedOTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ExpectedOTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ExpectedOTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ExpectedOTD_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExpectedOTD_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ExpectedOTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ExpectedOTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ExpectedOTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExpectedOTD_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ExpectedOTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ExpectedOTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ExpectedOTD_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ExpectedOTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ ExpectedOTD_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_EXPECTED_OTD_CONSTR_1 = { - { APC_CONSTRAINED, 11, 11, 0, 1250 } /* (0..1250) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, 0, 1250} /* (0..1250) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_ExpectedOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_ExpectedOTD = { "ExpectedOTD", "ExpectedOTD", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_ExpectedOTD = { ExpectedOTD_encode_xer, ExpectedOTD_decode_uper, ExpectedOTD_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ExpectedOTD_tags_1, - sizeof(asn_DEF_ExpectedOTD_tags_1) - /sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ - asn_DEF_ExpectedOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_ExpectedOTD_tags_1) - /sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_ExpectedOTD_tags_1) / + sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ + asn_DEF_ExpectedOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_ExpectedOTD_tags_1) / + sizeof(asn_DEF_ExpectedOTD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_EXPECTED_OTD_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ExpectedOTD.h b/src/core/libs/supl/asn-rrlp/ExpectedOTD.h index 688cd0bf3..963f10917 100644 --- a/src/core/libs/supl/asn-rrlp/ExpectedOTD.h +++ b/src/core/libs/supl/asn-rrlp/ExpectedOTD.h @@ -7,7 +7,6 @@ #ifndef _ExpectedOTD_H_ #define _ExpectedOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c index a6048b907..0db12f144 100644 --- a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c +++ b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.c @@ -6,120 +6,134 @@ #include "Ext-GeographicalInformation.h" -int -Ext_GeographicalInformation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int Ext_GeographicalInformation_constraint( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 20)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 20)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using OCTET_STRING, * so here we adjust the DEF accordingly. */ -static void -Ext_GeographicalInformation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_OCTET_STRING.free_struct; - td->print_struct = asn_DEF_OCTET_STRING.print_struct; - td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; - td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; - td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; - td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; - td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; - td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; - if(!td->per_constraints) +static void Ext_GeographicalInformation_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; - td->elements = asn_DEF_OCTET_STRING.elements; + td->elements = asn_DEF_OCTET_STRING.elements; td->elements_count = asn_DEF_OCTET_STRING.elements_count; - td->specifics = asn_DEF_OCTET_STRING.specifics; + td->specifics = asn_DEF_OCTET_STRING.specifics; } -void -Ext_GeographicalInformation_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void Ext_GeographicalInformation_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -Ext_GeographicalInformation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int Ext_GeographicalInformation_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, + void *app_key) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -Ext_GeographicalInformation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t Ext_GeographicalInformation_decode_ber( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -Ext_GeographicalInformation_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Ext_GeographicalInformation_encode_der( + asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -Ext_GeographicalInformation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t Ext_GeographicalInformation_decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, size_t size) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -Ext_GeographicalInformation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Ext_GeographicalInformation_encode_xer( + asn_TYPE_descriptor_t *td, void *structure, int ilevel, + enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -Ext_GeographicalInformation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t Ext_GeographicalInformation_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -Ext_GeographicalInformation_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t Ext_GeographicalInformation_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ Ext_GeographicalInformation_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static asn_per_constraints_t ASN_PER_TYPE_EXT_GEOGRAPHICAL_INFORMATION_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 20 } /* (SIZE(1..20)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_EXT_GEOGRAPHICAL_INFORMATION_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 20} /* (SIZE(1..20)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_Ext_GeographicalInformation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; asn_TYPE_descriptor_t asn_DEF_Ext_GeographicalInformation = { "Ext-GeographicalInformation", "Ext-GeographicalInformation", @@ -132,15 +146,15 @@ asn_TYPE_descriptor_t asn_DEF_Ext_GeographicalInformation = { Ext_GeographicalInformation_encode_xer, Ext_GeographicalInformation_decode_uper, Ext_GeographicalInformation_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Ext_GeographicalInformation_tags_1, - sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) - /sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ - asn_DEF_Ext_GeographicalInformation_tags_1, /* Same as above */ - sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) - /sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) / + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ + asn_DEF_Ext_GeographicalInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1) / + sizeof(asn_DEF_Ext_GeographicalInformation_tags_1[0]), /* 1 */ &ASN_PER_TYPE_EXT_GEOGRAPHICAL_INFORMATION_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h index 1228203cf..268f354b6 100644 --- a/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h +++ b/src/core/libs/supl/asn-rrlp/Ext-GeographicalInformation.h @@ -7,7 +7,6 @@ #ifndef _Ext_GeographicalInformation_H_ #define _Ext_GeographicalInformation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/Extended-reference.c b/src/core/libs/supl/asn-rrlp/Extended-reference.c index fe44f5111..71ec54c0d 100644 --- a/src/core/libs/supl/asn-rrlp/Extended-reference.c +++ b/src/core/libs/supl/asn-rrlp/Extended-reference.c @@ -6,101 +6,101 @@ #include "Extended-reference.h" -static int -memb_smlc_code_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_smlc_code_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_transaction_ID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_transaction_ID_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 262143)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 262143)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_SMLC_CODE_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TRANSACTION_ID_CONSTR_3 = { - { APC_CONSTRAINED, 18, -1, 0, 262143 } /* (0..262143) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 18, -1, 0, 262143} /* (0..262143) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Extended_reference_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Extended_reference, smlc_code), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_smlc_code_constraint_1, - &ASN_PER_MEMB_SMLC_CODE_CONSTR_2, - 0, - "smlc-code" - }, - { ATF_NOFLAGS, 0, offsetof(struct Extended_reference, transaction_ID), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_transaction_ID_constraint_1, - &ASN_PER_MEMB_TRANSACTION_ID_CONSTR_3, - 0, - "transaction-ID" - }, + {ATF_NOFLAGS, 0, offsetof(struct Extended_reference, smlc_code), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_smlc_code_constraint_1, + &ASN_PER_MEMB_SMLC_CODE_CONSTR_2, 0, "smlc-code"}, + {ATF_NOFLAGS, 0, offsetof(struct Extended_reference, transaction_ID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_transaction_ID_constraint_1, + &ASN_PER_MEMB_TRANSACTION_ID_CONSTR_3, 0, "transaction-ID"}, }; static ber_tlv_tag_t asn_DEF_Extended_reference_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Extended_reference_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* smlc-code at 999 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* transaction-ID at 1000 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* smlc-code at 999 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* transaction-ID at 1000 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Extended_reference_specs_1 = { sizeof(struct Extended_reference), offsetof(struct Extended_reference, _asn_ctx), asn_MAP_Extended_reference_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Extended_reference = { "Extended-reference", @@ -114,16 +114,15 @@ asn_TYPE_descriptor_t asn_DEF_Extended_reference = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Extended_reference_tags_1, - sizeof(asn_DEF_Extended_reference_tags_1) - /sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ - asn_DEF_Extended_reference_tags_1, /* Same as above */ - sizeof(asn_DEF_Extended_reference_tags_1) - /sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Extended_reference_tags_1) / + sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ + asn_DEF_Extended_reference_tags_1, /* Same as above */ + sizeof(asn_DEF_Extended_reference_tags_1) / + sizeof(asn_DEF_Extended_reference_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Extended_reference_1, - 2, /* Elements count */ - &asn_SPC_Extended_reference_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_Extended_reference_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Extended-reference.h b/src/core/libs/supl/asn-rrlp/Extended-reference.h index c96623181..05cd1d4ac 100644 --- a/src/core/libs/supl/asn-rrlp/Extended-reference.h +++ b/src/core/libs/supl/asn-rrlp/Extended-reference.h @@ -7,7 +7,6 @@ #ifndef _Extended_reference_H_ #define _Extended_reference_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ExtensionContainer.c b/src/core/libs/supl/asn-rrlp/ExtensionContainer.c index 98c012ced..d24b49255 100644 --- a/src/core/libs/supl/asn-rrlp/ExtensionContainer.c +++ b/src/core/libs/supl/asn-rrlp/ExtensionContainer.c @@ -6,9 +6,10 @@ #include "ExtensionContainer.h" -int -ExtensionContainer_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ExtensionContainer_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,85 +19,101 @@ ExtensionContainer_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ -static void -ExtensionContainer_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_INTEGER.free_struct; - td->print_struct = asn_DEF_INTEGER.print_struct; - td->ber_decoder = asn_DEF_INTEGER.ber_decoder; - td->der_encoder = asn_DEF_INTEGER.der_encoder; - td->xer_decoder = asn_DEF_INTEGER.xer_decoder; - td->xer_encoder = asn_DEF_INTEGER.xer_encoder; - td->uper_decoder = asn_DEF_INTEGER.uper_decoder; - td->uper_encoder = asn_DEF_INTEGER.uper_encoder; - if(!td->per_constraints) +static void ExtensionContainer_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; - td->elements = asn_DEF_INTEGER.elements; + td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; - td->specifics = asn_DEF_INTEGER.specifics; + td->specifics = asn_DEF_INTEGER.specifics; } -void -ExtensionContainer_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ExtensionContainer_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ExtensionContainer_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ExtensionContainer_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ExtensionContainer_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ExtensionContainer_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ExtensionContainer_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExtensionContainer_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ExtensionContainer_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ExtensionContainer_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ExtensionContainer_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ExtensionContainer_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ExtensionContainer_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ExtensionContainer_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ExtensionContainer_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ExtensionContainer_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ ExtensionContainer_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_ExtensionContainer_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_ExtensionContainer = { "ExtensionContainer", "ExtensionContainer", @@ -109,15 +126,15 @@ asn_TYPE_descriptor_t asn_DEF_ExtensionContainer = { ExtensionContainer_encode_xer, ExtensionContainer_decode_uper, ExtensionContainer_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensionContainer_tags_1, - sizeof(asn_DEF_ExtensionContainer_tags_1) - /sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ - asn_DEF_ExtensionContainer_tags_1, /* Same as above */ - sizeof(asn_DEF_ExtensionContainer_tags_1) - /sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_ExtensionContainer_tags_1) / + sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ + asn_DEF_ExtensionContainer_tags_1, /* Same as above */ + sizeof(asn_DEF_ExtensionContainer_tags_1) / + sizeof(asn_DEF_ExtensionContainer_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ExtensionContainer.h b/src/core/libs/supl/asn-rrlp/ExtensionContainer.h index e20079e14..d59d4f9ca 100644 --- a/src/core/libs/supl/asn-rrlp/ExtensionContainer.h +++ b/src/core/libs/supl/asn-rrlp/ExtensionContainer.h @@ -7,7 +7,6 @@ #ifndef _ExtensionContainer_H_ #define _ExtensionContainer_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/FineRTD.c b/src/core/libs/supl/asn-rrlp/FineRTD.c index 41a5426d6..6beb1abdb 100644 --- a/src/core/libs/supl/asn-rrlp/FineRTD.c +++ b/src/core/libs/supl/asn-rrlp/FineRTD.c @@ -6,119 +6,129 @@ #include "FineRTD.h" -int -FineRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FineRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -FineRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void FineRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -FineRTD_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FineRTD_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ FineRTD_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FineRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FineRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ FineRTD_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FineRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FineRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ FineRTD_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FineRTD_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FineRTD_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ FineRTD_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FineRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FineRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ FineRTD_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FineRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FineRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ FineRTD_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FineRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FineRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ FineRTD_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FineRTD_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FineRTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ FineRTD_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FINE_RTD_CONSTR_1 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_FineRTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_FineRTD = { "FineRTD", "FineRTD", @@ -131,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_FineRTD = { FineRTD_encode_xer, FineRTD_decode_uper, FineRTD_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FineRTD_tags_1, - sizeof(asn_DEF_FineRTD_tags_1) - /sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ - asn_DEF_FineRTD_tags_1, /* Same as above */ - sizeof(asn_DEF_FineRTD_tags_1) - /sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FineRTD_tags_1) / sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ + asn_DEF_FineRTD_tags_1, /* Same as above */ + sizeof(asn_DEF_FineRTD_tags_1) / sizeof(asn_DEF_FineRTD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FINE_RTD_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/FineRTD.h b/src/core/libs/supl/asn-rrlp/FineRTD.h index 7c6971574..268a10025 100644 --- a/src/core/libs/supl/asn-rrlp/FineRTD.h +++ b/src/core/libs/supl/asn-rrlp/FineRTD.h @@ -7,7 +7,6 @@ #ifndef _FineRTD_H_ #define _FineRTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/FixType.c b/src/core/libs/supl/asn-rrlp/FixType.c index b5ff5a361..cd73f76d7 100644 --- a/src/core/libs/supl/asn-rrlp/FixType.c +++ b/src/core/libs/supl/asn-rrlp/FixType.c @@ -6,119 +6,129 @@ #include "FixType.h" -int -FixType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FixType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -FixType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void FixType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -FixType_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FixType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ FixType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FixType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FixType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ FixType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FixType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FixType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ FixType_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FixType_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FixType_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ FixType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FixType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FixType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ FixType_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FixType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FixType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ FixType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FixType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FixType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ FixType_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FixType_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FixType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ FixType_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FIX_TYPE_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_FixType_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_FixType = { "FixType", "FixType", @@ -131,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_FixType = { FixType_encode_xer, FixType_decode_uper, FixType_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FixType_tags_1, - sizeof(asn_DEF_FixType_tags_1) - /sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ - asn_DEF_FixType_tags_1, /* Same as above */ - sizeof(asn_DEF_FixType_tags_1) - /sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FixType_tags_1) / sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ + asn_DEF_FixType_tags_1, /* Same as above */ + sizeof(asn_DEF_FixType_tags_1) / sizeof(asn_DEF_FixType_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FIX_TYPE_CONSTR_1, - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ + 0, + 0, /* Defined elsewhere */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/FixType.h b/src/core/libs/supl/asn-rrlp/FixType.h index b243790f2..154d3cd33 100644 --- a/src/core/libs/supl/asn-rrlp/FixType.h +++ b/src/core/libs/supl/asn-rrlp/FixType.h @@ -7,7 +7,6 @@ #ifndef _FixType_H_ #define _FixType_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/FrameDrift.c b/src/core/libs/supl/asn-rrlp/FrameDrift.c index 8aa172d2a..d5f72e0ab 100644 --- a/src/core/libs/supl/asn-rrlp/FrameDrift.c +++ b/src/core/libs/supl/asn-rrlp/FrameDrift.c @@ -6,119 +6,131 @@ #include "FrameDrift.h" -int -FrameDrift_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FrameDrift_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -64 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -64 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -FrameDrift_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void FrameDrift_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -FrameDrift_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FrameDrift_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ FrameDrift_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FrameDrift_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FrameDrift_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ FrameDrift_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FrameDrift_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FrameDrift_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ FrameDrift_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FrameDrift_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FrameDrift_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ FrameDrift_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FrameDrift_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FrameDrift_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ FrameDrift_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FrameDrift_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FrameDrift_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ FrameDrift_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FrameDrift_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FrameDrift_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ FrameDrift_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FrameDrift_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FrameDrift_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ FrameDrift_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FRAME_DRIFT_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, -64, 63 } /* (-64..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, -64, 63} /* (-64..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_FrameDrift_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_FrameDrift = { "FrameDrift", "FrameDrift", @@ -131,15 +143,15 @@ asn_TYPE_descriptor_t asn_DEF_FrameDrift = { FrameDrift_encode_xer, FrameDrift_decode_uper, FrameDrift_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FrameDrift_tags_1, - sizeof(asn_DEF_FrameDrift_tags_1) - /sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ - asn_DEF_FrameDrift_tags_1, /* Same as above */ - sizeof(asn_DEF_FrameDrift_tags_1) - /sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FrameDrift_tags_1) / + sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ + asn_DEF_FrameDrift_tags_1, /* Same as above */ + sizeof(asn_DEF_FrameDrift_tags_1) / + sizeof(asn_DEF_FrameDrift_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FRAME_DRIFT_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/FrameDrift.h b/src/core/libs/supl/asn-rrlp/FrameDrift.h index a40f78a72..70df2eaba 100644 --- a/src/core/libs/supl/asn-rrlp/FrameDrift.h +++ b/src/core/libs/supl/asn-rrlp/FrameDrift.h @@ -7,7 +7,6 @@ #ifndef _FrameDrift_H_ #define _FrameDrift_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/FrameNumber.c b/src/core/libs/supl/asn-rrlp/FrameNumber.c index bc72042ae..5381f28c6 100644 --- a/src/core/libs/supl/asn-rrlp/FrameNumber.c +++ b/src/core/libs/supl/asn-rrlp/FrameNumber.c @@ -6,119 +6,135 @@ #include "FrameNumber.h" -int -FrameNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FrameNumber_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 2097151)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 2097151)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -FrameNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void FrameNumber_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -FrameNumber_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FrameNumber_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ FrameNumber_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FrameNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FrameNumber_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ FrameNumber_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FrameNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FrameNumber_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ FrameNumber_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FrameNumber_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FrameNumber_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ FrameNumber_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FrameNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FrameNumber_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ FrameNumber_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FrameNumber_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FrameNumber_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ FrameNumber_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FrameNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FrameNumber_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ FrameNumber_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FrameNumber_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FrameNumber_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ FrameNumber_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FRAME_NUMBER_CONSTR_1 = { - { APC_CONSTRAINED, 21, -1, 0, 2097151 } /* (0..2097151) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 21, -1, 0, 2097151} /* (0..2097151) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_FrameNumber_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_FrameNumber = { "FrameNumber", "FrameNumber", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_FrameNumber = { FrameNumber_encode_xer, FrameNumber_decode_uper, FrameNumber_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FrameNumber_tags_1, - sizeof(asn_DEF_FrameNumber_tags_1) - /sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ - asn_DEF_FrameNumber_tags_1, /* Same as above */ - sizeof(asn_DEF_FrameNumber_tags_1) - /sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FrameNumber_tags_1) / + sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ + asn_DEF_FrameNumber_tags_1, /* Same as above */ + sizeof(asn_DEF_FrameNumber_tags_1) / + sizeof(asn_DEF_FrameNumber_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FRAME_NUMBER_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/FrameNumber.h b/src/core/libs/supl/asn-rrlp/FrameNumber.h index b9789b351..254394f0f 100644 --- a/src/core/libs/supl/asn-rrlp/FrameNumber.h +++ b/src/core/libs/supl/asn-rrlp/FrameNumber.h @@ -7,7 +7,6 @@ #ifndef _FrameNumber_H_ #define _FrameNumber_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c index 520b9f38b..35c7f983b 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c +++ b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.c @@ -7,30 +7,29 @@ #include "GANSS-AssistData.h" static asn_TYPE_member_t asn_MBR_GANSS_AssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSS_AssistData, ganss_controlHeader), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSS_ControlHeader, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganss-controlHeader" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_AssistData, ganss_controlHeader), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_ControlHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganss-controlHeader"}, }; static ber_tlv_tag_t asn_DEF_GANSS_AssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSS_AssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganss-controlHeader at 1062 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* ganss-controlHeader at 1062 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSS_AssistData_specs_1 = { sizeof(struct GANSS_AssistData), offsetof(struct GANSS_AssistData, _asn_ctx), asn_MAP_GANSS_AssistData_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSS_AssistData = { "GANSS-AssistData", @@ -44,16 +43,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSS_AssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSS_AssistData_tags_1, - sizeof(asn_DEF_GANSS_AssistData_tags_1) - /sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ - asn_DEF_GANSS_AssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSS_AssistData_tags_1) - /sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSS_AssistData_tags_1) / + sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ + asn_DEF_GANSS_AssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_AssistData_tags_1) / + sizeof(asn_DEF_GANSS_AssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSS_AssistData_1, - 1, /* Elements count */ - &asn_SPC_GANSS_AssistData_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSS_AssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h index 5b44507b2..6e2c48431 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h +++ b/src/core/libs/supl/asn-rrlp/GANSS-AssistData.h @@ -7,7 +7,6 @@ #ifndef _GANSS_AssistData_H_ #define _GANSS_AssistData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c index c4cc9d6a7..a7f2d2fe6 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c +++ b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.c @@ -7,42 +7,40 @@ #include "GANSS-ControlHeader.h" static asn_TYPE_member_t asn_MBR_GANSS_ControlHeader_1[] = { - { ATF_POINTER, 2, offsetof(struct GANSS_ControlHeader, ganssCommonAssistData), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSCommonAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssCommonAssistData" - }, - { ATF_POINTER, 1, offsetof(struct GANSS_ControlHeader, ganssGenericAssistDataList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSSGenericAssistDataElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssGenericAssistDataList" - }, + {ATF_POINTER, 2, + offsetof(struct GANSS_ControlHeader, ganssCommonAssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSCommonAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssCommonAssistData"}, + {ATF_POINTER, 1, + offsetof(struct GANSS_ControlHeader, ganssGenericAssistDataList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSGenericAssistDataElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssGenericAssistDataList"}, }; -static int asn_MAP_GANSS_ControlHeader_oms_1[] = { 0, 1 }; +static int asn_MAP_GANSS_ControlHeader_oms_1[] = {0, 1}; static ber_tlv_tag_t asn_DEF_GANSS_ControlHeader_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSS_ControlHeader_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssCommonAssistData at 1065 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssGenericAssistDataList at 1066 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* ganssCommonAssistData at 1065 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* ganssGenericAssistDataList at 1066 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSS_ControlHeader_specs_1 = { sizeof(struct GANSS_ControlHeader), offsetof(struct GANSS_ControlHeader, _asn_ctx), asn_MAP_GANSS_ControlHeader_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_GANSS_ControlHeader_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_GANSS_ControlHeader_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSS_ControlHeader = { "GANSS-ControlHeader", @@ -56,16 +54,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSS_ControlHeader = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSS_ControlHeader_tags_1, - sizeof(asn_DEF_GANSS_ControlHeader_tags_1) - /sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ - asn_DEF_GANSS_ControlHeader_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSS_ControlHeader_tags_1) - /sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSS_ControlHeader_tags_1) / + sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ + asn_DEF_GANSS_ControlHeader_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_ControlHeader_tags_1) / + sizeof(asn_DEF_GANSS_ControlHeader_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSS_ControlHeader_1, - 2, /* Elements count */ - &asn_SPC_GANSS_ControlHeader_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSS_ControlHeader_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h index 6932e08cd..bef8e238c 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h +++ b/src/core/libs/supl/asn-rrlp/GANSS-ControlHeader.h @@ -7,7 +7,6 @@ #ifndef _GANSS_ControlHeader_H_ #define _GANSS_ControlHeader_H_ - #include /* Including external dependencies */ @@ -26,7 +25,8 @@ extern "C" typedef struct GANSS_ControlHeader { struct GANSSCommonAssistData *ganssCommonAssistData /* OPTIONAL */; - struct SeqOfGANSSGenericAssistDataElement *ganssGenericAssistDataList /* OPTIONAL */; + struct SeqOfGANSSGenericAssistDataElement + *ganssGenericAssistDataList /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c index 7347a840f..770d5a5fe 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.c @@ -6,103 +6,91 @@ #include "GANSS-MsrSetElement.h" -static int -memb_deltaGNASSTOD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaGNASSTOD_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DELTA_GNASSTOD_CONSTR_4 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSS_MsrSetElement_1[] = { - { ATF_POINTER, 4, offsetof(struct GANSS_MsrSetElement, referenceFrame), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceFrame, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceFrame" - }, - { ATF_POINTER, 3, offsetof(struct GANSS_MsrSetElement, ganssTODm), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTODm, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODm" - }, - { ATF_POINTER, 2, offsetof(struct GANSS_MsrSetElement, deltaGNASSTOD), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaGNASSTOD_constraint_1, - &ASN_PER_MEMB_DELTA_GNASSTOD_CONSTR_4, - 0, - "deltaGNASSTOD" - }, - { ATF_POINTER, 1, offsetof(struct GANSS_MsrSetElement, ganssTODUncertainty), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTODUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODUncertainty" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_MsrSetElement, ganss_SgnTypeList), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSS_SgnTypeElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganss-SgnTypeList" - }, + {ATF_POINTER, 4, offsetof(struct GANSS_MsrSetElement, referenceFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceFrame, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceFrame"}, + {ATF_POINTER, 3, offsetof(struct GANSS_MsrSetElement, ganssTODm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODm, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODm"}, + {ATF_POINTER, 2, offsetof(struct GANSS_MsrSetElement, deltaGNASSTOD), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaGNASSTOD_constraint_1, + &ASN_PER_MEMB_DELTA_GNASSTOD_CONSTR_4, 0, "deltaGNASSTOD"}, + {ATF_POINTER, 1, offsetof(struct GANSS_MsrSetElement, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODUncertainty"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_MsrSetElement, ganss_SgnTypeList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganss-SgnTypeList"}, }; -static int asn_MAP_GANSS_MsrSetElement_oms_1[] = { 0, 1, 2, 3 }; +static int asn_MAP_GANSS_MsrSetElement_oms_1[] = {0, 1, 2, 3}; static ber_tlv_tag_t asn_DEF_GANSS_MsrSetElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSS_MsrSetElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrame at 1456 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTODm at 1457 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* deltaGNASSTOD at 1458 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssTODUncertainty at 1459 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganss-SgnTypeList at 1463 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceFrame at 1456 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ganssTODm at 1457 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* deltaGNASSTOD at 1458 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* ganssTODUncertainty at 1459 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0} /* ganss-SgnTypeList at 1463 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSS_MsrSetElement_specs_1 = { sizeof(struct GANSS_MsrSetElement), offsetof(struct GANSS_MsrSetElement, _asn_ctx), asn_MAP_GANSS_MsrSetElement_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_GANSS_MsrSetElement_oms_1, /* Optional members */ - 4, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_GANSS_MsrSetElement_oms_1, /* Optional members */ + 4, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSS_MsrSetElement = { "GANSS-MsrSetElement", @@ -116,16 +104,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSS_MsrSetElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSS_MsrSetElement_tags_1, - sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) - /sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ - asn_DEF_GANSS_MsrSetElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) - /sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) / + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1) / + sizeof(asn_DEF_GANSS_MsrSetElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSS_MsrSetElement_1, - 5, /* Elements count */ - &asn_SPC_GANSS_MsrSetElement_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GANSS_MsrSetElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h index 3c8b600ed..2b746f809 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSS-MsrSetElement.h @@ -7,7 +7,6 @@ #ifndef _GANSS_MsrSetElement_H_ #define _GANSS_MsrSetElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c index 348f96993..f83bc6b87 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.c @@ -6,323 +6,313 @@ #include "GANSS-SgnElement.h" -static int -memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_carrierQualityInd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_carrierQualityInd_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 2097151)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 2097151)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_integerCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_integerCodePhase_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhaseRMSError_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhaseRMSError_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_adr_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_adr_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 33554431)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 33554431)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_C_NO_CONSTR_3 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CARRIER_QUALITY_IND_CONSTR_5 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_CONSTR_6 = { - { APC_CONSTRAINED, 21, -1, 0, 2097151 } /* (0..2097151) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 21, -1, 0, 2097151} /* (0..2097151) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_INTEGER_CODE_PHASE_CONSTR_7 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_RMS_ERROR_CONSTR_8 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DOPPLER_CONSTR_9 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ADR_CONSTR_10 = { - { APC_CONSTRAINED, 25, -1, 0, 33554431 } /* (0..33554431) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 25, -1, 0, 33554431} /* (0..33554431) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSS_SgnElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, svID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, cNo), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_cNo_constraint_1, - &ASN_PER_MEMB_C_NO_CONSTR_3, - 0, - "cNo" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, mpathDet), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MpathIndic, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "mpathDet" - }, - { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, carrierQualityInd), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_carrierQualityInd_constraint_1, - &ASN_PER_MEMB_CARRIER_QUALITY_IND_CONSTR_5, - 0, - "carrierQualityInd" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhase), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhase_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_CONSTR_6, - 0, - "codePhase" - }, - { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, integerCodePhase), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_integerCodePhase_constraint_1, - &ASN_PER_MEMB_INTEGER_CODE_PHASE_CONSTR_7, - 0, - "integerCodePhase" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhaseRMSError), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhaseRMSError_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_RMS_ERROR_CONSTR_8, - 0, - "codePhaseRMSError" - }, - { ATF_POINTER, 2, offsetof(struct GANSS_SgnElement, doppler), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler_constraint_1, - &ASN_PER_MEMB_DOPPLER_CONSTR_9, - 0, - "doppler" - }, - { ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, adr), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_adr_constraint_1, - &ASN_PER_MEMB_ADR_CONSTR_10, - 0, - "adr" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, cNo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_cNo_constraint_1, &ASN_PER_MEMB_C_NO_CONSTR_3, + 0, "cNo"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, mpathDet), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MpathIndic, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "mpathDet"}, + {ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, carrierQualityInd), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_carrierQualityInd_constraint_1, + &ASN_PER_MEMB_CARRIER_QUALITY_IND_CONSTR_5, 0, "carrierQualityInd"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhase_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_CONSTR_6, 0, "codePhase"}, + {ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, integerCodePhase), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_integerCodePhase_constraint_1, + &ASN_PER_MEMB_INTEGER_CODE_PHASE_CONSTR_7, 0, "integerCodePhase"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnElement, codePhaseRMSError), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhaseRMSError_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_RMS_ERROR_CONSTR_8, 0, "codePhaseRMSError"}, + {ATF_POINTER, 2, offsetof(struct GANSS_SgnElement, doppler), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler_constraint_1, + &ASN_PER_MEMB_DOPPLER_CONSTR_9, 0, "doppler"}, + {ATF_POINTER, 1, offsetof(struct GANSS_SgnElement, adr), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_adr_constraint_1, &ASN_PER_MEMB_ADR_CONSTR_10, + 0, "adr"}, }; -static int asn_MAP_GANSS_SgnElement_oms_1[] = { 3, 5, 7, 8 }; +static int asn_MAP_GANSS_SgnElement_oms_1[] = {3, 5, 7, 8}; static ber_tlv_tag_t asn_DEF_GANSS_SgnElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSS_SgnElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1479 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cNo at 1480 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* mpathDet at 1481 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* carrierQualityInd at 1482 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* codePhase at 1483 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* integerCodePhase at 1484 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* codePhaseRMSError at 1485 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* doppler at 1486 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* adr at 1487 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* svID at 1479 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* cNo at 1480 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* mpathDet at 1481 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* carrierQualityInd at 1482 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* codePhase at 1483 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* integerCodePhase at 1484 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* codePhaseRMSError at 1485 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0}, /* doppler at 1486 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0} /* adr at 1487 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSS_SgnElement_specs_1 = { sizeof(struct GANSS_SgnElement), offsetof(struct GANSS_SgnElement, _asn_ctx), asn_MAP_GANSS_SgnElement_tag2el_1, - 9, /* Count of tags in the map */ - asn_MAP_GANSS_SgnElement_oms_1, /* Optional members */ - 4, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 9, /* Count of tags in the map */ + asn_MAP_GANSS_SgnElement_oms_1, /* Optional members */ + 4, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSS_SgnElement = { "GANSS-SgnElement", @@ -336,16 +326,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSS_SgnElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSS_SgnElement_tags_1, - sizeof(asn_DEF_GANSS_SgnElement_tags_1) - /sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ - asn_DEF_GANSS_SgnElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSS_SgnElement_tags_1) - /sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSS_SgnElement_tags_1) / + sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_SgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_SgnElement_tags_1) / + sizeof(asn_DEF_GANSS_SgnElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSS_SgnElement_1, - 9, /* Elements count */ - &asn_SPC_GANSS_SgnElement_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_GANSS_SgnElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h index 9729dfb59..401ab2b99 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnElement.h @@ -7,7 +7,6 @@ #ifndef _GANSS_SgnElement_H_ #define _GANSS_SgnElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c index 8f1a6fcd0..fac6a087f 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.c @@ -6,71 +6,68 @@ #include "GANSS-SgnTypeElement.h" -static int -memb_ganssSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssSignalID_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 15)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 15)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2 = { - { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 15} /* (0..15) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSS_SgnTypeElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganssSignalID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssSignalID_constraint_1, - &ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2, - 0, - "ganssSignalID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganss_SgnList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSS_SgnElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganss-SgnList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssSignalID_constraint_1, + &ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2, 0, "ganssSignalID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSS_SgnTypeElement, ganss_SgnList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_SgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganss-SgnList"}, }; static ber_tlv_tag_t asn_DEF_GANSS_SgnTypeElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSS_SgnTypeElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1469 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganss-SgnList at 1472 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssSignalID at 1469 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* ganss-SgnList at 1472 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSS_SgnTypeElement_specs_1 = { sizeof(struct GANSS_SgnTypeElement), offsetof(struct GANSS_SgnTypeElement, _asn_ctx), asn_MAP_GANSS_SgnTypeElement_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSS_SgnTypeElement = { "GANSS-SgnTypeElement", @@ -84,16 +81,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSS_SgnTypeElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSS_SgnTypeElement_tags_1, - sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) - /sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ - asn_DEF_GANSS_SgnTypeElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) - /sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) / + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_GANSS_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1) / + sizeof(asn_DEF_GANSS_SgnTypeElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSS_SgnTypeElement_1, - 2, /* Elements count */ - &asn_SPC_GANSS_SgnTypeElement_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSS_SgnTypeElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h index ac20e74de..2f74a5c22 100644 --- a/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSS-SgnTypeElement.h @@ -7,7 +7,6 @@ #ifndef _GANSS_SgnTypeElement_H_ #define _GANSS_SgnTypeElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c index c02123d57..65e7a38d8 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.c @@ -7,23 +7,23 @@ #include "GANSSAlmanacElement.h" static asn_per_constraints_t ASN_PER_TYPE_GANSS_ALMANAC_ELEMENT_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0} /* (0..0,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSAlmanacElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacElement, choice.keplerianAlmanacSet), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Almanac_KeplerianSet, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "keplerianAlmanacSet" - }, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSAlmanacElement, choice.keplerianAlmanacSet), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Almanac_KeplerianSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "keplerianAlmanacSet"}, }; static asn_TYPE_tag2member_t asn_MAP_GANSSAlmanacElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* keplerianAlmanacSet at 1362 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* keplerianAlmanacSet at 1362 */ }; static asn_CHOICE_specifics_t asn_SPC_GANSSAlmanacElement_specs_1 = { sizeof(struct GANSSAlmanacElement), @@ -31,9 +31,9 @@ static asn_CHOICE_specifics_t asn_SPC_GANSSAlmanacElement_specs_1 = { offsetof(struct GANSSAlmanacElement, present), sizeof(((struct GANSSAlmanacElement *)0)->present), asn_MAP_GANSSAlmanacElement_tag2el_1, - 1, /* Count of tags in the map */ + 1, /* Count of tags in the map */ 0, - 1 /* Extensions start */ + 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacElement = { "GANSSAlmanacElement", @@ -48,13 +48,12 @@ asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacElement = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_GANSS_ALMANAC_ELEMENT_CONSTR_1, asn_MBR_GANSSAlmanacElement_1, - 1, /* Elements count */ - &asn_SPC_GANSSAlmanacElement_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSAlmanacElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h index c401c4f50..0b7980fdd 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacElement.h @@ -7,7 +7,6 @@ #ifndef _GANSSAlmanacElement_H_ #define _GANSSAlmanacElement_H_ - #include /* Including external dependencies */ @@ -35,9 +34,9 @@ extern "C" { Almanac_KeplerianSet_t keplerianAlmanacSet; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c index ba558fa9a..857969d08 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.c @@ -6,163 +6,154 @@ #include "GANSSAlmanacModel.h" -static int -memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_toa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_toa_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ioda_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ioda_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_WEEK_NUMBER_CONSTR_2 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TOA_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IODA_CONSTR_5 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSAlmanacModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, weekNumber), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_weekNumber_constraint_1, - &ASN_PER_MEMB_WEEK_NUMBER_CONSTR_2, - 0, - "weekNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, svIDMask), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVIDMASK, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svIDMask" - }, - { ATF_POINTER, 2, offsetof(struct GANSSAlmanacModel, toa), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_toa_constraint_1, - &ASN_PER_MEMB_TOA_CONSTR_4, - 0, - "toa" - }, - { ATF_POINTER, 1, offsetof(struct GANSSAlmanacModel, ioda), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ioda_constraint_1, - &ASN_PER_MEMB_IODA_CONSTR_5, - 0, - "ioda" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, ganssAlmanacList), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSSAlmanacElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssAlmanacList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, weekNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_weekNumber_constraint_1, + &ASN_PER_MEMB_WEEK_NUMBER_CONSTR_2, 0, "weekNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, svIDMask), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVIDMASK, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svIDMask"}, + {ATF_POINTER, 2, offsetof(struct GANSSAlmanacModel, toa), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_toa_constraint_1, &ASN_PER_MEMB_TOA_CONSTR_4, + 0, "toa"}, + {ATF_POINTER, 1, offsetof(struct GANSSAlmanacModel, ioda), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ioda_constraint_1, + &ASN_PER_MEMB_IODA_CONSTR_5, 0, "ioda"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSAlmanacModel, ganssAlmanacList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssAlmanacList"}, }; -static int asn_MAP_GANSSAlmanacModel_oms_1[] = { 2, 3 }; +static int asn_MAP_GANSSAlmanacModel_oms_1[] = {2, 3}; static ber_tlv_tag_t asn_DEF_GANSSAlmanacModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSAlmanacModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* weekNumber at 1348 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svIDMask at 1349 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toa at 1350 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ioda at 1351 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssAlmanacList at 1353 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* weekNumber at 1348 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* svIDMask at 1349 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* toa at 1350 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* ioda at 1351 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* ganssAlmanacList at 1353 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSAlmanacModel_specs_1 = { sizeof(struct GANSSAlmanacModel), offsetof(struct GANSSAlmanacModel, _asn_ctx), asn_MAP_GANSSAlmanacModel_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_GANSSAlmanacModel_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_GANSSAlmanacModel_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacModel = { "GANSSAlmanacModel", @@ -176,16 +167,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSAlmanacModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSAlmanacModel_tags_1, - sizeof(asn_DEF_GANSSAlmanacModel_tags_1) - /sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ - asn_DEF_GANSSAlmanacModel_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSAlmanacModel_tags_1) - /sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSAlmanacModel_tags_1) / + sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSAlmanacModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSAlmanacModel_tags_1) / + sizeof(asn_DEF_GANSSAlmanacModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSAlmanacModel_1, - 5, /* Elements count */ - &asn_SPC_GANSSAlmanacModel_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GANSSAlmanacModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h index 5bb2b6f85..a07f94bb3 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSAlmanacModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSAlmanacModel_H_ #define _GANSSAlmanacModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c index 48687320f..76cf1fd99 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c +++ b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.c @@ -6,120 +6,140 @@ #include "GANSSAssistanceData.h" -int -GANSSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 40)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 40)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using OCTET_STRING, * so here we adjust the DEF accordingly. */ -static void -GANSSAssistanceData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_OCTET_STRING.free_struct; - td->print_struct = asn_DEF_OCTET_STRING.print_struct; - td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; - td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; - td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; - td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; - td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; - td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; - if(!td->per_constraints) +static void GANSSAssistanceData_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; - td->elements = asn_DEF_OCTET_STRING.elements; + td->elements = asn_DEF_OCTET_STRING.elements; td->elements_count = asn_DEF_OCTET_STRING.elements_count; - td->specifics = asn_DEF_OCTET_STRING.specifics; + td->specifics = asn_DEF_OCTET_STRING.specifics; } -void -GANSSAssistanceData_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSAssistanceData_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSAssistanceData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSAssistanceData_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSAssistanceData_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSAssistanceData_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GANSSAssistanceData_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSS_ASSISTANCE_DATA_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 40 } /* (SIZE(1..40)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 40} /* (SIZE(1..40)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSAssistanceData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSAssistanceData = { "GANSSAssistanceData", "GANSSAssistanceData", @@ -132,15 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSAssistanceData = { GANSSAssistanceData_encode_xer, GANSSAssistanceData_decode_uper, GANSSAssistanceData_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSAssistanceData_tags_1, - sizeof(asn_DEF_GANSSAssistanceData_tags_1) - /sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ - asn_DEF_GANSSAssistanceData_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSAssistanceData_tags_1) - /sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSAssistanceData_tags_1) / + sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_GANSSAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSAssistanceData_tags_1) / + sizeof(asn_DEF_GANSSAssistanceData_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSS_ASSISTANCE_DATA_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h index 4ab2beaef..fb8833b59 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h +++ b/src/core/libs/supl/asn-rrlp/GANSSAssistanceData.h @@ -7,7 +7,6 @@ #ifndef _GANSSAssistanceData_H_ #define _GANSSAssistanceData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSClockModel.c b/src/core/libs/supl/asn-rrlp/GANSSClockModel.c index 5ffe6ffcb..f87425813 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSClockModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSClockModel.c @@ -7,23 +7,23 @@ #include "GANSSClockModel.h" static asn_per_constraints_t ASN_PER_TYPE_GANSS_CLOCK_MODEL_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0} /* (0..0,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSClockModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSClockModel, choice.standardClockModelList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfStandardClockModelElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "standardClockModelList" - }, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSClockModel, choice.standardClockModelList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfStandardClockModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "standardClockModelList"}, }; static asn_TYPE_tag2member_t asn_MAP_GANSSClockModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* standardClockModelList at 1274 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* standardClockModelList at 1274 */ }; static asn_CHOICE_specifics_t asn_SPC_GANSSClockModel_specs_1 = { sizeof(struct GANSSClockModel), @@ -31,9 +31,9 @@ static asn_CHOICE_specifics_t asn_SPC_GANSSClockModel_specs_1 = { offsetof(struct GANSSClockModel, present), sizeof(((struct GANSSClockModel *)0)->present), asn_MAP_GANSSClockModel_tag2el_1, - 1, /* Count of tags in the map */ + 1, /* Count of tags in the map */ 0, - 1 /* Extensions start */ + 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_GANSSClockModel = { "GANSSClockModel", @@ -48,13 +48,12 @@ asn_TYPE_descriptor_t asn_DEF_GANSSClockModel = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_GANSS_CLOCK_MODEL_CONSTR_1, asn_MBR_GANSSClockModel_1, - 1, /* Elements count */ - &asn_SPC_GANSSClockModel_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSClockModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSClockModel.h b/src/core/libs/supl/asn-rrlp/GANSSClockModel.h index 3778f4dee..77f5d0d19 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSClockModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSClockModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSClockModel_H_ #define _GANSSClockModel_H_ - #include /* Including external dependencies */ @@ -35,9 +34,9 @@ extern "C" { SeqOfStandardClockModelElement_t standardClockModelList; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c index 0529c2ee5..ff6e0a2d2 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c +++ b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.c @@ -7,52 +7,47 @@ #include "GANSSCommonAssistData.h" static asn_TYPE_member_t asn_MBR_GANSSCommonAssistData_1[] = { - { ATF_POINTER, 3, offsetof(struct GANSSCommonAssistData, ganssReferenceTime), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSReferenceTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssReferenceTime" - }, - { ATF_POINTER, 2, offsetof(struct GANSSCommonAssistData, ganssRefLocation), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSRefLocation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssRefLocation" - }, - { ATF_POINTER, 1, offsetof(struct GANSSCommonAssistData, ganssIonosphericModel), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSIonosphericModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssIonosphericModel" - }, + {ATF_POINTER, 3, offsetof(struct GANSSCommonAssistData, ganssReferenceTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSReferenceTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssReferenceTime"}, + {ATF_POINTER, 2, offsetof(struct GANSSCommonAssistData, ganssRefLocation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefLocation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssRefLocation"}, + {ATF_POINTER, 1, + offsetof(struct GANSSCommonAssistData, ganssIonosphericModel), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonosphericModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssIonosphericModel"}, }; -static int asn_MAP_GANSSCommonAssistData_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_GANSSCommonAssistData_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_GANSSCommonAssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSCommonAssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssReferenceTime at 1071 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssRefLocation at 1072 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssIonosphericModel at 1073 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* ganssReferenceTime at 1071 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssRefLocation at 1072 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* ganssIonosphericModel at 1073 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSCommonAssistData_specs_1 = { sizeof(struct GANSSCommonAssistData), offsetof(struct GANSSCommonAssistData, _asn_ctx), asn_MAP_GANSSCommonAssistData_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_GANSSCommonAssistData_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_GANSSCommonAssistData_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSCommonAssistData = { "GANSSCommonAssistData", @@ -66,16 +61,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSCommonAssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSCommonAssistData_tags_1, - sizeof(asn_DEF_GANSSCommonAssistData_tags_1) - /sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ - asn_DEF_GANSSCommonAssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSCommonAssistData_tags_1) - /sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSCommonAssistData_tags_1) / + sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ + asn_DEF_GANSSCommonAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSCommonAssistData_tags_1) / + sizeof(asn_DEF_GANSSCommonAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSCommonAssistData_1, - 3, /* Elements count */ - &asn_SPC_GANSSCommonAssistData_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_GANSSCommonAssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h index 3b94f49c6..0ea6e438c 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h +++ b/src/core/libs/supl/asn-rrlp/GANSSCommonAssistData.h @@ -7,7 +7,6 @@ #ifndef _GANSSCommonAssistData_H_ #define _GANSSCommonAssistData_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" struct GANSSRefLocation *ganssRefLocation /* OPTIONAL */; struct GANSSIonosphericModel *ganssIonosphericModel /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBit.c b/src/core/libs/supl/asn-rrlp/GANSSDataBit.c index 74f8d00fa..c074d685e 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDataBit.c +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBit.c @@ -6,119 +6,137 @@ #include "GANSSDataBit.h" -int -GANSSDataBit_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSDataBit_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GANSSDataBit_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GANSSDataBit_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GANSSDataBit_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSDataBit_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSDataBit_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSDataBit_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSDataBit_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSDataBit_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSDataBit_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSDataBit_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSDataBit_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSDataBit_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSDataBit_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSDataBit_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSDataBit_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSDataBit_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSDataBit_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSDataBit_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ GANSSDataBit_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSS_DATA_BIT_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSDataBit_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSDataBit = { "GANSSDataBit", "GANSSDataBit", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSDataBit = { GANSSDataBit_encode_xer, GANSSDataBit_decode_uper, GANSSDataBit_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSDataBit_tags_1, - sizeof(asn_DEF_GANSSDataBit_tags_1) - /sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ - asn_DEF_GANSSDataBit_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSDataBit_tags_1) - /sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSDataBit_tags_1) / + sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ + asn_DEF_GANSSDataBit_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDataBit_tags_1) / + sizeof(asn_DEF_GANSSDataBit_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSS_DATA_BIT_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBit.h b/src/core/libs/supl/asn-rrlp/GANSSDataBit.h index 82945d884..1e896732f 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDataBit.h +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBit.h @@ -7,7 +7,6 @@ #ifndef _GANSSDataBit_H_ #define _GANSSDataBit_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c index 211ce6d99..d09a05716 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.c @@ -6,121 +6,114 @@ #include "GANSSDataBitAssist.h" -static int -memb_ganssTOD_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssTOD_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 59)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 59)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssDataTypeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssDataTypeID_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 2)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 2)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_TOD_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 59 } /* (0..59) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 59} /* (0..59) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_DATA_TYPE_ID_CONSTR_4 = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 2} /* (0..2) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSDataBitAssist_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssTOD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssTOD_constraint_1, - &ASN_PER_MEMB_GANSS_TOD_CONSTR_2, - 0, - "ganssTOD" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, svID), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataTypeID), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssDataTypeID_constraint_1, - &ASN_PER_MEMB_GANSS_DATA_TYPE_ID_CONSTR_4, - 0, - "ganssDataTypeID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataBits), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOf_GANSSDataBits, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssDataBits" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssTOD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssTOD_constraint_1, + &ASN_PER_MEMB_GANSS_TOD_CONSTR_2, 0, "ganssTOD"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, svID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataTypeID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssDataTypeID_constraint_1, + &ASN_PER_MEMB_GANSS_DATA_TYPE_ID_CONSTR_4, 0, "ganssDataTypeID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDataBitAssist, ganssDataBits), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOf_GANSSDataBits, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssDataBits"}, }; static ber_tlv_tag_t asn_DEF_GANSSDataBitAssist_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSDataBitAssist_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssTOD at 1307 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svID at 1308 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssDataTypeID at 1309 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ganssDataBits at 1313 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssTOD at 1307 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* svID at 1308 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* ganssDataTypeID at 1309 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* ganssDataBits at 1313 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSDataBitAssist_specs_1 = { sizeof(struct GANSSDataBitAssist), offsetof(struct GANSSDataBitAssist, _asn_ctx), asn_MAP_GANSSDataBitAssist_tag2el_1, - 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSDataBitAssist = { "GANSSDataBitAssist", @@ -134,16 +127,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSDataBitAssist = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSDataBitAssist_tags_1, - sizeof(asn_DEF_GANSSDataBitAssist_tags_1) - /sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ - asn_DEF_GANSSDataBitAssist_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSDataBitAssist_tags_1) - /sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSDataBitAssist_tags_1) / + sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ + asn_DEF_GANSSDataBitAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDataBitAssist_tags_1) / + sizeof(asn_DEF_GANSSDataBitAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSDataBitAssist_1, - 4, /* Elements count */ - &asn_SPC_GANSSDataBitAssist_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_GANSSDataBitAssist_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h index 5372dedc8..a3a8b9ff4 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h +++ b/src/core/libs/supl/asn-rrlp/GANSSDataBitAssist.h @@ -7,7 +7,6 @@ #ifndef _GANSSDataBitAssist_H_ #define _GANSSDataBitAssist_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c index c0f0ffc24..ee79f0470 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c +++ b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.c @@ -6,71 +6,68 @@ #include "GANSSDiffCorrections.h" -static int -memb_dganssRefTime_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_dganssRefTime_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 119)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 119)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DGANSS_REF_TIME_CONSTR_2 = { - { APC_CONSTRAINED, 7, 7, 0, 119 } /* (0..119) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 119} /* (0..119) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSDiffCorrections_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, dganssRefTime), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_dganssRefTime_constraint_1, - &ASN_PER_MEMB_DGANSS_REF_TIME_CONSTR_2, - 0, - "dganssRefTime" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, sgnTypeList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfSgnTypeElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sgnTypeList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, dganssRefTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_dganssRefTime_constraint_1, + &ASN_PER_MEMB_DGANSS_REF_TIME_CONSTR_2, 0, "dganssRefTime"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSDiffCorrections, sgnTypeList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sgnTypeList"}, }; static ber_tlv_tag_t asn_DEF_GANSSDiffCorrections_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSDiffCorrections_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dganssRefTime at 1186 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* sgnTypeList at 1190 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* dganssRefTime at 1186 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* sgnTypeList at 1190 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSDiffCorrections_specs_1 = { sizeof(struct GANSSDiffCorrections), offsetof(struct GANSSDiffCorrections, _asn_ctx), asn_MAP_GANSSDiffCorrections_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSDiffCorrections = { "GANSSDiffCorrections", @@ -84,16 +81,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSDiffCorrections = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSDiffCorrections_tags_1, - sizeof(asn_DEF_GANSSDiffCorrections_tags_1) - /sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ - asn_DEF_GANSSDiffCorrections_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSDiffCorrections_tags_1) - /sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSDiffCorrections_tags_1) / + sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ + asn_DEF_GANSSDiffCorrections_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSDiffCorrections_tags_1) / + sizeof(asn_DEF_GANSSDiffCorrections_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSDiffCorrections_1, - 2, /* Elements count */ - &asn_SPC_GANSSDiffCorrections_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSSDiffCorrections_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h index 74b73d47b..a50a1d558 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h +++ b/src/core/libs/supl/asn-rrlp/GANSSDiffCorrections.h @@ -7,7 +7,6 @@ #ifndef _GANSSDiffCorrections_H_ #define _GANSSDiffCorrections_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c index da465e237..6c6fa96e9 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.c @@ -6,143 +6,138 @@ #include "GANSSGenericAssistDataElement.h" -static int -memb_ganssID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_ID_CONSTR_2 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSGenericAssistDataElement_1[] = { - { ATF_POINTER, 9, offsetof(struct GANSSGenericAssistDataElement, ganssID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssID_constraint_1, - &ASN_PER_MEMB_GANSS_ID_CONSTR_2, - 0, - "ganssID" - }, - { ATF_POINTER, 8, offsetof(struct GANSSGenericAssistDataElement, ganssTimeModel), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSSTimeModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTimeModel" - }, - { ATF_POINTER, 7, offsetof(struct GANSSGenericAssistDataElement, ganssDiffCorrections), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSDiffCorrections, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssDiffCorrections" - }, - { ATF_POINTER, 6, offsetof(struct GANSSGenericAssistDataElement, ganssNavigationModel), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSNavModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssNavigationModel" - }, - { ATF_POINTER, 5, offsetof(struct GANSSGenericAssistDataElement, ganssRealTimeIntegrity), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSRealTimeIntegrity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssRealTimeIntegrity" - }, - { ATF_POINTER, 4, offsetof(struct GANSSGenericAssistDataElement, ganssDataBitAssist), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSDataBitAssist, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssDataBitAssist" - }, - { ATF_POINTER, 3, offsetof(struct GANSSGenericAssistDataElement, ganssRefMeasurementAssist), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSRefMeasurementAssist, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssRefMeasurementAssist" - }, - { ATF_POINTER, 2, offsetof(struct GANSSGenericAssistDataElement, ganssAlmanacModel), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSAlmanacModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssAlmanacModel" - }, - { ATF_POINTER, 1, offsetof(struct GANSSGenericAssistDataElement, ganssUTCModel), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSUTCModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssUTCModel" - }, + {ATF_POINTER, 9, offsetof(struct GANSSGenericAssistDataElement, ganssID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssID_constraint_1, + &ASN_PER_MEMB_GANSS_ID_CONSTR_2, 0, "ganssID"}, + {ATF_POINTER, 8, + offsetof(struct GANSSGenericAssistDataElement, ganssTimeModel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSTimeModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTimeModel"}, + {ATF_POINTER, 7, + offsetof(struct GANSSGenericAssistDataElement, ganssDiffCorrections), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSDiffCorrections, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssDiffCorrections"}, + {ATF_POINTER, 6, + offsetof(struct GANSSGenericAssistDataElement, ganssNavigationModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSNavModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssNavigationModel"}, + {ATF_POINTER, 5, + offsetof(struct GANSSGenericAssistDataElement, ganssRealTimeIntegrity), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRealTimeIntegrity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssRealTimeIntegrity"}, + {ATF_POINTER, 4, + offsetof(struct GANSSGenericAssistDataElement, ganssDataBitAssist), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSDataBitAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssDataBitAssist"}, + {ATF_POINTER, 3, + offsetof(struct GANSSGenericAssistDataElement, ganssRefMeasurementAssist), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefMeasurementAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssRefMeasurementAssist"}, + {ATF_POINTER, 2, + offsetof(struct GANSSGenericAssistDataElement, ganssAlmanacModel), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSAlmanacModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssAlmanacModel"}, + {ATF_POINTER, 1, + offsetof(struct GANSSGenericAssistDataElement, ganssUTCModel), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSUTCModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssUTCModel"}, }; -static int asn_MAP_GANSSGenericAssistDataElement_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static int asn_MAP_GANSSGenericAssistDataElement_oms_1[] = {0, 1, 2, 3, 4, + 5, 6, 7, 8}; static ber_tlv_tag_t asn_DEF_GANSSGenericAssistDataElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_GANSSGenericAssistDataElement_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssID at 1082 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssTimeModel at 1083 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* ganssDiffCorrections at 1084 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* ganssNavigationModel at 1085 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* ganssRealTimeIntegrity at 1086 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* ganssDataBitAssist at 1087 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* ganssRefMeasurementAssist at 1088 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* ganssAlmanacModel at 1089 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, + 0} /* ganssUTCModel at 1090 */ }; -static asn_TYPE_tag2member_t asn_MAP_GANSSGenericAssistDataElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssID at 1082 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTimeModel at 1083 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssDiffCorrections at 1084 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssNavigationModel at 1085 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssRealTimeIntegrity at 1086 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ganssDataBitAssist at 1087 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ganssRefMeasurementAssist at 1088 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ganssAlmanacModel at 1089 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* ganssUTCModel at 1090 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_GANSSGenericAssistDataElement_specs_1 = { - sizeof(struct GANSSGenericAssistDataElement), - offsetof(struct GANSSGenericAssistDataElement, _asn_ctx), - asn_MAP_GANSSGenericAssistDataElement_tag2el_1, - 9, /* Count of tags in the map */ - asn_MAP_GANSSGenericAssistDataElement_oms_1, /* Optional members */ - 9, 0, /* Root/Additions */ - 8, /* Start extensions */ - 10 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_GANSSGenericAssistDataElement_specs_1 = + { + sizeof(struct GANSSGenericAssistDataElement), + offsetof(struct GANSSGenericAssistDataElement, _asn_ctx), + asn_MAP_GANSSGenericAssistDataElement_tag2el_1, + 9, /* Count of tags in the map */ + asn_MAP_GANSSGenericAssistDataElement_oms_1, /* Optional members */ + 9, + 0, /* Root/Additions */ + 8, /* Start extensions */ + 10 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSGenericAssistDataElement = { "GANSSGenericAssistDataElement", @@ -156,16 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSGenericAssistDataElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSGenericAssistDataElement_tags_1, - sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) - /sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ - asn_DEF_GANSSGenericAssistDataElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) - /sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) / + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSGenericAssistDataElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1) / + sizeof(asn_DEF_GANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSGenericAssistDataElement_1, - 9, /* Elements count */ - &asn_SPC_GANSSGenericAssistDataElement_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_GANSSGenericAssistDataElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h index 02c4ff5e8..ef9310716 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSSGenericAssistDataElement.h @@ -7,7 +7,6 @@ #ifndef _GANSSGenericAssistDataElement_H_ #define _GANSSGenericAssistDataElement_H_ - #include /* Including external dependencies */ @@ -38,13 +37,14 @@ extern "C" struct GANSSNavModel *ganssNavigationModel /* OPTIONAL */; struct GANSSRealTimeIntegrity *ganssRealTimeIntegrity /* OPTIONAL */; struct GANSSDataBitAssist *ganssDataBitAssist /* OPTIONAL */; - struct GANSSRefMeasurementAssist *ganssRefMeasurementAssist /* OPTIONAL */; + struct GANSSRefMeasurementAssist + *ganssRefMeasurementAssist /* OPTIONAL */; struct GANSSAlmanacModel *ganssAlmanacModel /* OPTIONAL */; struct GANSSUTCModel *ganssUTCModel /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c index b7deaeebc..5fc30c9e4 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c +++ b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.c @@ -6,221 +6,217 @@ #include "GANSSIonoStormFlags.h" -static int -memb_ionoStormFlag1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ionoStormFlag1_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ionoStormFlag2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ionoStormFlag2_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ionoStormFlag3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ionoStormFlag3_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ionoStormFlag4_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ionoStormFlag4_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ionoStormFlag5_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ionoStormFlag5_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_IONO_STORM_FLAG1_CONSTR_2 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IONO_STORM_FLAG2_CONSTR_3 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IONO_STORM_FLAG3_CONSTR_4 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IONO_STORM_FLAG4_CONSTR_5 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IONO_STORM_FLAG5_CONSTR_6 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSIonoStormFlags_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ionoStormFlag1_constraint_1, - &ASN_PER_MEMB_IONO_STORM_FLAG1_CONSTR_2, - 0, - "ionoStormFlag1" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag2), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ionoStormFlag2_constraint_1, - &ASN_PER_MEMB_IONO_STORM_FLAG2_CONSTR_3, - 0, - "ionoStormFlag2" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag3), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ionoStormFlag3_constraint_1, - &ASN_PER_MEMB_IONO_STORM_FLAG3_CONSTR_4, - 0, - "ionoStormFlag3" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag4), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ionoStormFlag4_constraint_1, - &ASN_PER_MEMB_IONO_STORM_FLAG4_CONSTR_5, - 0, - "ionoStormFlag4" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag5), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ionoStormFlag5_constraint_1, - &ASN_PER_MEMB_IONO_STORM_FLAG5_CONSTR_6, - 0, - "ionoStormFlag5" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ionoStormFlag1_constraint_1, + &ASN_PER_MEMB_IONO_STORM_FLAG1_CONSTR_2, 0, "ionoStormFlag1"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ionoStormFlag2_constraint_1, + &ASN_PER_MEMB_IONO_STORM_FLAG2_CONSTR_3, 0, "ionoStormFlag2"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag3), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ionoStormFlag3_constraint_1, + &ASN_PER_MEMB_IONO_STORM_FLAG3_CONSTR_4, 0, "ionoStormFlag3"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ionoStormFlag4_constraint_1, + &ASN_PER_MEMB_IONO_STORM_FLAG4_CONSTR_5, 0, "ionoStormFlag4"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonoStormFlags, ionoStormFlag5), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ionoStormFlag5_constraint_1, + &ASN_PER_MEMB_IONO_STORM_FLAG5_CONSTR_6, 0, "ionoStormFlag5"}, }; static ber_tlv_tag_t asn_DEF_GANSSIonoStormFlags_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSIonoStormFlags_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ionoStormFlag1 at 1152 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ionoStormFlag2 at 1153 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ionoStormFlag3 at 1154 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ionoStormFlag4 at 1155 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ionoStormFlag5 at 1156 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ionoStormFlag1 at 1152 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ionoStormFlag2 at 1153 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* ionoStormFlag3 at 1154 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* ionoStormFlag4 at 1155 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* ionoStormFlag5 at 1156 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonoStormFlags_specs_1 = { sizeof(struct GANSSIonoStormFlags), offsetof(struct GANSSIonoStormFlags, _asn_ctx), asn_MAP_GANSSIonoStormFlags_tag2el_1, - 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSIonoStormFlags = { "GANSSIonoStormFlags", @@ -234,16 +230,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSIonoStormFlags = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSIonoStormFlags_tags_1, - sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) - /sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ - asn_DEF_GANSSIonoStormFlags_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) - /sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) / + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonoStormFlags_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1) / + sizeof(asn_DEF_GANSSIonoStormFlags_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSIonoStormFlags_1, - 5, /* Elements count */ - &asn_SPC_GANSSIonoStormFlags_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GANSSIonoStormFlags_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h index 2260625a7..6457c4f27 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h +++ b/src/core/libs/supl/asn-rrlp/GANSSIonoStormFlags.h @@ -7,7 +7,6 @@ #ifndef _GANSSIonoStormFlags_H_ #define _GANSSIonoStormFlags_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c index 3bf32e4b2..5b0e9d6a9 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.c @@ -6,141 +6,139 @@ #include "GANSSIonosphereModel.h" -static int -memb_ai0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ai0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 4095)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 4095)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ai1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ai1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 4095)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 4095)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ai2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ai2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 4095)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 4095)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_AI0_CONSTR_2 = { - { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, 0, 4095} /* (0..4095) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_AI1_CONSTR_3 = { - { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, 0, 4095} /* (0..4095) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_AI2_CONSTR_4 = { - { APC_CONSTRAINED, 12, 12, 0, 4095 } /* (0..4095) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, 0, 4095} /* (0..4095) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSIonosphereModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai0), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ai0_constraint_1, - &ASN_PER_MEMB_AI0_CONSTR_2, - 0, - "ai0" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai1), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ai1_constraint_1, - &ASN_PER_MEMB_AI1_CONSTR_3, - 0, - "ai1" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai2), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ai2_constraint_1, - &ASN_PER_MEMB_AI2_CONSTR_4, - 0, - "ai2" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ai0_constraint_1, &ASN_PER_MEMB_AI0_CONSTR_2, + 0, "ai0"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai1), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ai1_constraint_1, &ASN_PER_MEMB_AI1_CONSTR_3, + 0, "ai1"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphereModel, ai2), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ai2_constraint_1, &ASN_PER_MEMB_AI2_CONSTR_4, + 0, "ai2"}, }; static ber_tlv_tag_t asn_DEF_GANSSIonosphereModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSIonosphereModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ai0 at 1145 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ai1 at 1146 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ai2 at 1147 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ai0 at 1145 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ai1 at 1146 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* ai2 at 1147 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonosphereModel_specs_1 = { sizeof(struct GANSSIonosphereModel), offsetof(struct GANSSIonosphereModel, _asn_ctx), asn_MAP_GANSSIonosphereModel_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSIonosphereModel = { "GANSSIonosphereModel", @@ -154,16 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSIonosphereModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSIonosphereModel_tags_1, - sizeof(asn_DEF_GANSSIonosphereModel_tags_1) - /sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ - asn_DEF_GANSSIonosphereModel_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSIonosphereModel_tags_1) - /sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSIonosphereModel_tags_1) / + sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonosphereModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonosphereModel_tags_1) / + sizeof(asn_DEF_GANSSIonosphereModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSIonosphereModel_1, - 3, /* Elements count */ - &asn_SPC_GANSSIonosphereModel_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_GANSSIonosphereModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h index 816ef288f..5f98a4ef9 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphereModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSIonosphereModel_H_ #define _GANSSIonosphereModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c index 5a1ff73e8..7700242c7 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.c @@ -7,42 +7,38 @@ #include "GANSSIonosphericModel.h" static asn_TYPE_member_t asn_MBR_GANSSIonosphericModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphericModel, ganssIonoModel), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSIonosphereModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssIonoModel" - }, - { ATF_POINTER, 1, offsetof(struct GANSSIonosphericModel, ganssIonoStormFlags), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSIonoStormFlags, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssIonoStormFlags" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSIonosphericModel, ganssIonoModel), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonosphereModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssIonoModel"}, + {ATF_POINTER, 1, + offsetof(struct GANSSIonosphericModel, ganssIonoStormFlags), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSIonoStormFlags, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssIonoStormFlags"}, }; -static int asn_MAP_GANSSIonosphericModel_oms_1[] = { 1 }; +static int asn_MAP_GANSSIonosphericModel_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_GANSSIonosphericModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSIonosphericModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssIonoModel at 1138 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssIonoStormFlags at 1139 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssIonoModel at 1138 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* ganssIonoStormFlags at 1139 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSIonosphericModel_specs_1 = { sizeof(struct GANSSIonosphericModel), offsetof(struct GANSSIonosphericModel, _asn_ctx), asn_MAP_GANSSIonosphericModel_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_GANSSIonosphericModel_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_GANSSIonosphericModel_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSIonosphericModel = { "GANSSIonosphericModel", @@ -56,16 +52,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSIonosphericModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSIonosphericModel_tags_1, - sizeof(asn_DEF_GANSSIonosphericModel_tags_1) - /sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ - asn_DEF_GANSSIonosphericModel_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSIonosphericModel_tags_1) - /sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSIonosphericModel_tags_1) / + sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSIonosphericModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSIonosphericModel_tags_1) / + sizeof(asn_DEF_GANSSIonosphericModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSIonosphericModel_1, - 2, /* Elements count */ - &asn_SPC_GANSSIonosphericModel_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSSIonosphericModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h index 7f3413f29..7071afeed 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSIonosphericModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSIonosphericModel_H_ #define _GANSSIonosphericModel_H_ - #include /* Including external dependencies */ @@ -28,9 +27,9 @@ extern "C" GANSSIonosphereModel_t ganssIonoModel; struct GANSSIonoStormFlags *ganssIonoStormFlags /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c index 306187491..240bd3cdd 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c +++ b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.c @@ -6,203 +6,184 @@ #include "GANSSLocationInfo.h" -static int -memb_ganssTODFrac_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssTODFrac_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16384)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16384)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stationaryIndication_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stationaryIndication_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_TOD_FRAC_CONSTR_4 = { - { APC_CONSTRAINED, 15, 15, 0, 16384 } /* (0..16384) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 15, 15, 0, 16384} /* (0..16384) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_6 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STATIONARY_INDICATION_CONSTR_9 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSLocationInfo_1[] = { - { ATF_POINTER, 5, offsetof(struct GANSSLocationInfo, referenceFrame), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceFrame, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceFrame" - }, - { ATF_POINTER, 4, offsetof(struct GANSSLocationInfo, ganssTODm), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTODm, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODm" - }, - { ATF_POINTER, 3, offsetof(struct GANSSLocationInfo, ganssTODFrac), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssTODFrac_constraint_1, - &ASN_PER_MEMB_GANSS_TOD_FRAC_CONSTR_4, - 0, - "ganssTODFrac" - }, - { ATF_POINTER, 2, offsetof(struct GANSSLocationInfo, ganssTODUncertainty), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTODUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODUncertainty" - }, - { ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, ganssTimeID), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssTimeID_constraint_1, - &ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_6, - 0, - "ganssTimeID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, fixType), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FixType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fixType" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posData), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PositionData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posData" - }, - { ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, stationaryIndication), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stationaryIndication_constraint_1, - &ASN_PER_MEMB_STATIONARY_INDICATION_CONSTR_9, - 0, - "stationaryIndication" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posEstimate), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ext_GeographicalInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posEstimate" - }, + {ATF_POINTER, 5, offsetof(struct GANSSLocationInfo, referenceFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceFrame, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceFrame"}, + {ATF_POINTER, 4, offsetof(struct GANSSLocationInfo, ganssTODm), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODm, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODm"}, + {ATF_POINTER, 3, offsetof(struct GANSSLocationInfo, ganssTODFrac), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssTODFrac_constraint_1, + &ASN_PER_MEMB_GANSS_TOD_FRAC_CONSTR_4, 0, "ganssTODFrac"}, + {ATF_POINTER, 2, offsetof(struct GANSSLocationInfo, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODUncertainty"}, + {ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, ganssTimeID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssTimeID_constraint_1, + &ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_6, 0, "ganssTimeID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, fixType), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FixType, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fixType"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posData), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posData"}, + {ATF_POINTER, 1, offsetof(struct GANSSLocationInfo, stationaryIndication), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stationaryIndication_constraint_1, + &ASN_PER_MEMB_STATIONARY_INDICATION_CONSTR_9, 0, "stationaryIndication"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSLocationInfo, posEstimate), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posEstimate"}, }; -static int asn_MAP_GANSSLocationInfo_oms_1[] = { 0, 1, 2, 3, 4, 7 }; +static int asn_MAP_GANSSLocationInfo_oms_1[] = {0, 1, 2, 3, 4, 7}; static ber_tlv_tag_t asn_DEF_GANSSLocationInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSLocationInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrame at 1411 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTODm at 1412 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssTODFrac at 1413 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssTODUncertainty at 1414 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssTimeID at 1415 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* fixType at 1416 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* posData at 1417 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* stationaryIndication at 1418 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* posEstimate at 1424 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceFrame at 1411 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ganssTODm at 1412 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* ganssTODFrac at 1413 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* ganssTODUncertainty at 1414 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* ganssTimeID at 1415 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* fixType at 1416 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* posData at 1417 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* stationaryIndication at 1418 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0} /* posEstimate at 1424 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSLocationInfo_specs_1 = { sizeof(struct GANSSLocationInfo), offsetof(struct GANSSLocationInfo, _asn_ctx), asn_MAP_GANSSLocationInfo_tag2el_1, - 9, /* Count of tags in the map */ - asn_MAP_GANSSLocationInfo_oms_1, /* Optional members */ - 6, 0, /* Root/Additions */ - 8, /* Start extensions */ - 10 /* Stop extensions */ + 9, /* Count of tags in the map */ + asn_MAP_GANSSLocationInfo_oms_1, /* Optional members */ + 6, + 0, /* Root/Additions */ + 8, /* Start extensions */ + 10 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSLocationInfo = { "GANSSLocationInfo", @@ -216,16 +197,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSLocationInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSLocationInfo_tags_1, - sizeof(asn_DEF_GANSSLocationInfo_tags_1) - /sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ - asn_DEF_GANSSLocationInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSLocationInfo_tags_1) - /sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSLocationInfo_tags_1) / + sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSLocationInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSLocationInfo_tags_1) / + sizeof(asn_DEF_GANSSLocationInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSLocationInfo_1, - 9, /* Elements count */ - &asn_SPC_GANSSLocationInfo_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_GANSSLocationInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h index 2e500ae96..4c9c2eb32 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h +++ b/src/core/libs/supl/asn-rrlp/GANSSLocationInfo.h @@ -7,7 +7,6 @@ #ifndef _GANSSLocationInfo_H_ #define _GANSSLocationInfo_H_ - #include /* Including external dependencies */ @@ -40,9 +39,9 @@ extern "C" long *stationaryIndication /* OPTIONAL */; Ext_GeographicalInformation_t posEstimate; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c index 96c0c1d88..9f4f2871b 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c +++ b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.c @@ -7,30 +7,28 @@ #include "GANSSMeasureInfo.h" static asn_TYPE_member_t asn_MBR_GANSSMeasureInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSMeasureInfo, ganssMsrSetList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSS_MsrSetElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssMsrSetList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSMeasureInfo, ganssMsrSetList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssMsrSetList"}, }; static ber_tlv_tag_t asn_DEF_GANSSMeasureInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSMeasureInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganssMsrSetList at 1451 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* ganssMsrSetList at 1451 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSMeasureInfo_specs_1 = { sizeof(struct GANSSMeasureInfo), offsetof(struct GANSSMeasureInfo, _asn_ctx), asn_MAP_GANSSMeasureInfo_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSMeasureInfo = { "GANSSMeasureInfo", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSMeasureInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSMeasureInfo_tags_1, - sizeof(asn_DEF_GANSSMeasureInfo_tags_1) - /sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ - asn_DEF_GANSSMeasureInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSMeasureInfo_tags_1) - /sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSMeasureInfo_tags_1) / + sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSMeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSMeasureInfo_tags_1) / + sizeof(asn_DEF_GANSSMeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSMeasureInfo_1, - 1, /* Elements count */ - &asn_SPC_GANSSMeasureInfo_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSMeasureInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h index d62efd84d..dc9de9f1d 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h +++ b/src/core/libs/supl/asn-rrlp/GANSSMeasureInfo.h @@ -7,7 +7,6 @@ #ifndef _GANSSMeasureInfo_H_ #define _GANSSMeasureInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSNavModel.c b/src/core/libs/supl/asn-rrlp/GANSSNavModel.c index 51da025c6..6aee05e96 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSNavModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSNavModel.c @@ -6,193 +6,189 @@ #include "GANSSNavModel.h" -static int -memb_nonBroadcastIndFlag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_nonBroadcastIndFlag_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_toeMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_toeMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_eMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_eMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_sqrtAMBS_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_sqrtAMBS_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_NON_BROADCAST_IND_FLAG_CONSTR_2 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TOE_MSB_CONSTR_3 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_E_MSB_CONSTR_4 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_SQRT_AMBS_CONSTR_5 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSNavModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, nonBroadcastIndFlag), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_nonBroadcastIndFlag_constraint_1, - &ASN_PER_MEMB_NON_BROADCAST_IND_FLAG_CONSTR_2, - 0, - "nonBroadcastIndFlag" - }, - { ATF_POINTER, 3, offsetof(struct GANSSNavModel, toeMSB), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_toeMSB_constraint_1, - &ASN_PER_MEMB_TOE_MSB_CONSTR_3, - 0, - "toeMSB" - }, - { ATF_POINTER, 2, offsetof(struct GANSSNavModel, eMSB), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_eMSB_constraint_1, - &ASN_PER_MEMB_E_MSB_CONSTR_4, - 0, - "eMSB" - }, - { ATF_POINTER, 1, offsetof(struct GANSSNavModel, sqrtAMBS), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_sqrtAMBS_constraint_1, - &ASN_PER_MEMB_SQRT_AMBS_CONSTR_5, - 0, - "sqrtAMBS" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, ganssSatelliteList), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSSSatelliteElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssSatelliteList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, nonBroadcastIndFlag), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_nonBroadcastIndFlag_constraint_1, + &ASN_PER_MEMB_NON_BROADCAST_IND_FLAG_CONSTR_2, 0, "nonBroadcastIndFlag"}, + {ATF_POINTER, 3, offsetof(struct GANSSNavModel, toeMSB), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_toeMSB_constraint_1, + &ASN_PER_MEMB_TOE_MSB_CONSTR_3, 0, "toeMSB"}, + {ATF_POINTER, 2, offsetof(struct GANSSNavModel, eMSB), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_eMSB_constraint_1, + &ASN_PER_MEMB_E_MSB_CONSTR_4, 0, "eMSB"}, + {ATF_POINTER, 1, offsetof(struct GANSSNavModel, sqrtAMBS), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_sqrtAMBS_constraint_1, + &ASN_PER_MEMB_SQRT_AMBS_CONSTR_5, 0, "sqrtAMBS"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSNavModel, ganssSatelliteList), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSSatelliteElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssSatelliteList"}, }; -static int asn_MAP_GANSSNavModel_oms_1[] = { 1, 2, 3 }; +static int asn_MAP_GANSSNavModel_oms_1[] = {1, 2, 3}; static ber_tlv_tag_t asn_DEF_GANSSNavModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSNavModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nonBroadcastIndFlag at 1228 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* toeMSB at 1229 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* eMSB at 1230 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sqrtAMBS at 1231 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssSatelliteList at 1233 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* nonBroadcastIndFlag at 1228 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* toeMSB at 1229 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* eMSB at 1230 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* sqrtAMBS at 1231 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0} /* ganssSatelliteList at 1233 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSNavModel_specs_1 = { sizeof(struct GANSSNavModel), offsetof(struct GANSSNavModel, _asn_ctx), asn_MAP_GANSSNavModel_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_GANSSNavModel_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_GANSSNavModel_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSNavModel = { "GANSSNavModel", @@ -206,16 +202,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSNavModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSNavModel_tags_1, - sizeof(asn_DEF_GANSSNavModel_tags_1) - /sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ - asn_DEF_GANSSNavModel_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSNavModel_tags_1) - /sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSNavModel_tags_1) / + sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSNavModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSNavModel_tags_1) / + sizeof(asn_DEF_GANSSNavModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSNavModel_1, - 5, /* Elements count */ - &asn_SPC_GANSSNavModel_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GANSSNavModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSNavModel.h b/src/core/libs/supl/asn-rrlp/GANSSNavModel.h index f73324580..d9ac45bb4 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSNavModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSNavModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSNavModel_H_ #define _GANSSNavModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c index 3b3cad90e..47b8e034e 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.c @@ -7,23 +7,21 @@ #include "GANSSOrbitModel.h" static asn_per_constraints_t ASN_PER_TYPE_GANSS_ORBIT_MODEL_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0} /* (0..0,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSOrbitModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSOrbitModel, choice.keplerianSet), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NavModel_KeplerianSet, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "keplerianSet" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSOrbitModel, choice.keplerianSet), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NavModel_KeplerianSet, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "keplerianSet"}, }; static asn_TYPE_tag2member_t asn_MAP_GANSSOrbitModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* keplerianSet at 1248 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* keplerianSet at 1248 */ }; static asn_CHOICE_specifics_t asn_SPC_GANSSOrbitModel_specs_1 = { sizeof(struct GANSSOrbitModel), @@ -31,9 +29,9 @@ static asn_CHOICE_specifics_t asn_SPC_GANSSOrbitModel_specs_1 = { offsetof(struct GANSSOrbitModel, present), sizeof(((struct GANSSOrbitModel *)0)->present), asn_MAP_GANSSOrbitModel_tag2el_1, - 1, /* Count of tags in the map */ + 1, /* Count of tags in the map */ 0, - 1 /* Extensions start */ + 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_GANSSOrbitModel = { "GANSSOrbitModel", @@ -48,13 +46,12 @@ asn_TYPE_descriptor_t asn_DEF_GANSSOrbitModel = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_GANSS_ORBIT_MODEL_CONSTR_1, asn_MBR_GANSSOrbitModel_1, - 1, /* Elements count */ - &asn_SPC_GANSSOrbitModel_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSOrbitModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h index b78a6c562..2deaa1db5 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSOrbitModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSOrbitModel_H_ #define _GANSSOrbitModel_H_ - #include /* Including external dependencies */ @@ -35,9 +34,9 @@ extern "C" { NavModel_KeplerianSet_t keplerianSet; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c index 22c0d0d9e..026dff1a8 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c +++ b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.c @@ -6,125 +6,147 @@ #include "GANSSPositioningMethod.h" -int -GANSSPositioningMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSPositioningMethod_constraint(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if(st->size > 0) { - /* Size in bits */ - size = 8 * st->size - (st->bits_unused & 0x07); - } else { - size = 0; - } - - if((size >= 2 && size <= 16)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if (st->size > 0) + { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } + else + { + size = 0; + } + + if ((size >= 2 && size <= 16)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -GANSSPositioningMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_BIT_STRING.free_struct; - td->print_struct = asn_DEF_BIT_STRING.print_struct; - td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; - td->der_encoder = asn_DEF_BIT_STRING.der_encoder; - td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; - td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; - td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; - td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; - if(!td->per_constraints) +static void GANSSPositioningMethod_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; - td->elements = asn_DEF_BIT_STRING.elements; + td->elements = asn_DEF_BIT_STRING.elements; td->elements_count = asn_DEF_BIT_STRING.elements_count; - td->specifics = asn_DEF_BIT_STRING.specifics; + td->specifics = asn_DEF_BIT_STRING.specifics; } -void -GANSSPositioningMethod_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSPositioningMethod_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSPositioningMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSPositioningMethod_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSPositioningMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSPositioningMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, + size_t size, int tag_mode) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSPositioningMethod_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSPositioningMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSPositioningMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSPositioningMethod_decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, size_t size) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSPositioningMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSPositioningMethod_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSPositioningMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSPositioningMethod_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSPositioningMethod_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSPositioningMethod_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GANSSPositioningMethod_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSS_POSITIONING_METHOD_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 2, 16 } /* (SIZE(2..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 2, 16} /* (SIZE(2..16)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSPositioningMethod_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSPositioningMethod = { "GANSSPositioningMethod", "GANSSPositioningMethod", @@ -137,15 +159,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSPositioningMethod = { GANSSPositioningMethod_encode_xer, GANSSPositioningMethod_decode_uper, GANSSPositioningMethod_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSPositioningMethod_tags_1, - sizeof(asn_DEF_GANSSPositioningMethod_tags_1) - /sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ - asn_DEF_GANSSPositioningMethod_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSPositioningMethod_tags_1) - /sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSPositioningMethod_tags_1) / + sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ + asn_DEF_GANSSPositioningMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSPositioningMethod_tags_1) / + sizeof(asn_DEF_GANSSPositioningMethod_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSS_POSITIONING_METHOD_CONSTR_1, - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ + 0, + 0, /* Defined elsewhere */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h index 424f07e22..7f0cbbde3 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h +++ b/src/core/libs/supl/asn-rrlp/GANSSPositioningMethod.h @@ -7,7 +7,6 @@ #ifndef _GANSSPositioningMethod_H_ #define _GANSSPositioningMethod_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c index 5e79fd758..c94d255cf 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c +++ b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.c @@ -7,30 +7,30 @@ #include "GANSSRealTimeIntegrity.h" static asn_TYPE_member_t asn_MBR_GANSSRealTimeIntegrity_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSRealTimeIntegrity, ganssBadSignalList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfBadSignalElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssBadSignalList" - }, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSRealTimeIntegrity, ganssBadSignalList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfBadSignalElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssBadSignalList"}, }; static ber_tlv_tag_t asn_DEF_GANSSRealTimeIntegrity_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSRealTimeIntegrity_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ganssBadSignalList at 1295 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* ganssBadSignalList at 1295 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSRealTimeIntegrity_specs_1 = { sizeof(struct GANSSRealTimeIntegrity), offsetof(struct GANSSRealTimeIntegrity, _asn_ctx), asn_MAP_GANSSRealTimeIntegrity_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSRealTimeIntegrity = { "GANSSRealTimeIntegrity", @@ -44,16 +44,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSRealTimeIntegrity = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSRealTimeIntegrity_tags_1, - sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) - /sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ - asn_DEF_GANSSRealTimeIntegrity_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) - /sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) / + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ + asn_DEF_GANSSRealTimeIntegrity_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1) / + sizeof(asn_DEF_GANSSRealTimeIntegrity_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSRealTimeIntegrity_1, - 1, /* Elements count */ - &asn_SPC_GANSSRealTimeIntegrity_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSRealTimeIntegrity_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h index b757cd2e3..a6c2703b7 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h +++ b/src/core/libs/supl/asn-rrlp/GANSSRealTimeIntegrity.h @@ -7,7 +7,6 @@ #ifndef _GANSSRealTimeIntegrity_H_ #define _GANSSRealTimeIntegrity_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c index db399b776..8dc1c8674 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c +++ b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.c @@ -7,30 +7,28 @@ #include "GANSSRefLocation.h" static asn_TYPE_member_t asn_MBR_GANSSRefLocation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefLocation, threeDLocation), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ext_GeographicalInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "threeDLocation" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefLocation, threeDLocation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "threeDLocation"}, }; static ber_tlv_tag_t asn_DEF_GANSSRefLocation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSRefLocation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* threeDLocation at 1132 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* threeDLocation at 1132 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefLocation_specs_1 = { sizeof(struct GANSSRefLocation), offsetof(struct GANSSRefLocation, _asn_ctx), asn_MAP_GANSSRefLocation_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSRefLocation = { "GANSSRefLocation", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSRefLocation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSRefLocation_tags_1, - sizeof(asn_DEF_GANSSRefLocation_tags_1) - /sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ - asn_DEF_GANSSRefLocation_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSRefLocation_tags_1) - /sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSRefLocation_tags_1) / + sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefLocation_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefLocation_tags_1) / + sizeof(asn_DEF_GANSSRefLocation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSRefLocation_1, - 1, /* Elements count */ - &asn_SPC_GANSSRefLocation_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GANSSRefLocation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h index 805bef273..58547b264 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h +++ b/src/core/libs/supl/asn-rrlp/GANSSRefLocation.h @@ -7,7 +7,6 @@ #ifndef _GANSSRefLocation_H_ #define _GANSSRefLocation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c index 48f340201..198517df0 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.c @@ -6,73 +6,71 @@ #include "GANSSRefMeasurementAssist.h" -static int -memb_ganssSignalID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssSignalID_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSRefMeasurementAssist_1[] = { - { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementAssist, ganssSignalID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssSignalID_constraint_1, - &ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2, - 0, - "ganssSignalID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementAssist, ganssRefMeasAssitList), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGANSSRefMeasurementElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssRefMeasAssitList" - }, + {ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementAssist, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssSignalID_constraint_1, + &ASN_PER_MEMB_GANSS_SIGNAL_ID_CONSTR_2, 0, "ganssSignalID"}, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSRefMeasurementAssist, ganssRefMeasAssitList), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGANSSRefMeasurementElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssRefMeasAssitList"}, }; -static int asn_MAP_GANSSRefMeasurementAssist_oms_1[] = { 0 }; +static int asn_MAP_GANSSRefMeasurementAssist_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_GANSSRefMeasurementAssist_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSRefMeasurementAssist_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1321 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssRefMeasAssitList at 1323 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssSignalID at 1321 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* ganssRefMeasAssitList at 1323 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefMeasurementAssist_specs_1 = { sizeof(struct GANSSRefMeasurementAssist), offsetof(struct GANSSRefMeasurementAssist, _asn_ctx), asn_MAP_GANSSRefMeasurementAssist_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_GANSSRefMeasurementAssist_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_GANSSRefMeasurementAssist_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementAssist = { "GANSSRefMeasurementAssist", @@ -86,16 +84,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementAssist = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSRefMeasurementAssist_tags_1, - sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) - /sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ - asn_DEF_GANSSRefMeasurementAssist_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) - /sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) / + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefMeasurementAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1) / + sizeof(asn_DEF_GANSSRefMeasurementAssist_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSRefMeasurementAssist_1, - 2, /* Elements count */ - &asn_SPC_GANSSRefMeasurementAssist_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSSRefMeasurementAssist_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h index fd38e4c9c..25b79d343 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementAssist.h @@ -7,7 +7,6 @@ #ifndef _GANSSRefMeasurementAssist_H_ #define _GANSSRefMeasurementAssist_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c index 540ca6468..de84afcb0 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.c @@ -6,213 +6,208 @@ #include "GANSSRefMeasurementElement.h" -static int -memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2048 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2048 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhase_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1022)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1022)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_intCodePhase_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_codePhaseSearchWindow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_codePhaseSearchWindow_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_DOPPLER0_CONSTR_3 = { - { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, -2048, 2047} /* (-2048..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_CONSTR_5 = { - { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1022} /* (0..1022) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_7 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSRefMeasurementElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, svID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, doppler0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler0_constraint_1, - &ASN_PER_MEMB_DOPPLER0_CONSTR_3, - 0, - "doppler0" - }, - { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementElement, additionalDoppler), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AdditionalDopplerFields, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "additionalDoppler" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, codePhase), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhase_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_CONSTR_5, - 0, - "codePhase" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, intCodePhase), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_intCodePhase_constraint_1, - &ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6, - 0, - "intCodePhase" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, codePhaseSearchWindow), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_codePhaseSearchWindow_constraint_1, - &ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_7, - 0, - "codePhaseSearchWindow" - }, - { ATF_POINTER, 1, offsetof(struct GANSSRefMeasurementElement, additionalAngle), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AddionalAngleFields, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "additionalAngle" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, doppler0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler0_constraint_1, + &ASN_PER_MEMB_DOPPLER0_CONSTR_3, 0, "doppler0"}, + {ATF_POINTER, 1, + offsetof(struct GANSSRefMeasurementElement, additionalDoppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AdditionalDopplerFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "additionalDoppler"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, codePhase), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhase_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_CONSTR_5, 0, "codePhase"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefMeasurementElement, intCodePhase), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_intCodePhase_constraint_1, + &ASN_PER_MEMB_INT_CODE_PHASE_CONSTR_6, 0, "intCodePhase"}, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSRefMeasurementElement, codePhaseSearchWindow), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_codePhaseSearchWindow_constraint_1, + &ASN_PER_MEMB_CODE_PHASE_SEARCH_WINDOW_CONSTR_7, 0, + "codePhaseSearchWindow"}, + {ATF_POINTER, 1, + offsetof(struct GANSSRefMeasurementElement, additionalAngle), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AddionalAngleFields, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "additionalAngle"}, }; -static int asn_MAP_GANSSRefMeasurementElement_oms_1[] = { 2, 6 }; +static int asn_MAP_GANSSRefMeasurementElement_oms_1[] = {2, 6}; static ber_tlv_tag_t asn_DEF_GANSSRefMeasurementElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSRefMeasurementElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1328 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* doppler0 at 1331 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* additionalDoppler at 1332 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* codePhase at 1333 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* intCodePhase at 1334 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* codePhaseSearchWindow at 1335 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* additionalAngle at 1336 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* svID at 1328 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* doppler0 at 1331 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* additionalDoppler at 1332 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* codePhase at 1333 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* intCodePhase at 1334 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* codePhaseSearchWindow at 1335 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0} /* additionalAngle at 1336 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefMeasurementElement_specs_1 = { sizeof(struct GANSSRefMeasurementElement), offsetof(struct GANSSRefMeasurementElement, _asn_ctx), asn_MAP_GANSSRefMeasurementElement_tag2el_1, - 7, /* Count of tags in the map */ - asn_MAP_GANSSRefMeasurementElement_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - 6, /* Start extensions */ - 8 /* Stop extensions */ + 7, /* Count of tags in the map */ + asn_MAP_GANSSRefMeasurementElement_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + 6, /* Start extensions */ + 8 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementElement = { "GANSSRefMeasurementElement", @@ -226,16 +221,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSRefMeasurementElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSRefMeasurementElement_tags_1, - sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) - /sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ - asn_DEF_GANSSRefMeasurementElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) - /sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) / + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefMeasurementElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1) / + sizeof(asn_DEF_GANSSRefMeasurementElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSRefMeasurementElement_1, - 7, /* Elements count */ - &asn_SPC_GANSSRefMeasurementElement_specs_1 /* Additional specs */ + 7, /* Elements count */ + &asn_SPC_GANSSRefMeasurementElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h index ddd021cee..a19446648 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSSRefMeasurementElement.h @@ -7,7 +7,6 @@ #ifndef _GANSSRefMeasurementElement_H_ #define _GANSSRefMeasurementElement_H_ - #include /* Including external dependencies */ @@ -35,9 +34,9 @@ extern "C" long codePhaseSearchWindow; struct AddionalAngleFields *additionalAngle /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c index 634d3f17a..6bfa91d9f 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c +++ b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.c @@ -6,123 +6,117 @@ #include "GANSSRefTimeInfo.h" -static int -memb_ganssDay_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssDay_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 8191)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 8191)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssTimeID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_DAY_CONSTR_2 = { - { APC_CONSTRAINED, 13, 13, 0, 8191 } /* (0..8191) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 13, 13, 0, 8191} /* (0..8191) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_5 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSRefTimeInfo_1[] = { - { ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssDay), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssDay_constraint_1, - &ASN_PER_MEMB_GANSS_DAY_CONSTR_2, - 0, - "ganssDay" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSRefTimeInfo, ganssTOD), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTOD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTOD" - }, - { ATF_POINTER, 2, offsetof(struct GANSSRefTimeInfo, ganssTODUncertainty), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTODUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODUncertainty" - }, - { ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssTimeID), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssTimeID_constraint_1, - &ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_5, - 0, - "ganssTimeID" - }, + {ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssDay), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssDay_constraint_1, + &ASN_PER_MEMB_GANSS_DAY_CONSTR_2, 0, "ganssDay"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSRefTimeInfo, ganssTOD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTOD, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTOD"}, + {ATF_POINTER, 2, offsetof(struct GANSSRefTimeInfo, ganssTODUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTODUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODUncertainty"}, + {ATF_POINTER, 1, offsetof(struct GANSSRefTimeInfo, ganssTimeID), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssTimeID_constraint_1, + &ASN_PER_MEMB_GANSS_TIME_ID_CONSTR_5, 0, "ganssTimeID"}, }; -static int asn_MAP_GANSSRefTimeInfo_oms_1[] = { 0, 2, 3 }; +static int asn_MAP_GANSSRefTimeInfo_oms_1[] = {0, 2, 3}; static ber_tlv_tag_t asn_DEF_GANSSRefTimeInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSRefTimeInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssDay at 1104 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssTOD at 1105 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssTODUncertainty at 1106 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ganssTimeID at 1107 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssDay at 1104 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ganssTOD at 1105 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* ganssTODUncertainty at 1106 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* ganssTimeID at 1107 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSRefTimeInfo_specs_1 = { sizeof(struct GANSSRefTimeInfo), offsetof(struct GANSSRefTimeInfo, _asn_ctx), asn_MAP_GANSSRefTimeInfo_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_GANSSRefTimeInfo_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_GANSSRefTimeInfo_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSRefTimeInfo = { "GANSSRefTimeInfo", @@ -136,16 +130,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSRefTimeInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSRefTimeInfo_tags_1, - sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) - /sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ - asn_DEF_GANSSRefTimeInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) - /sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) / + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ + asn_DEF_GANSSRefTimeInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1) / + sizeof(asn_DEF_GANSSRefTimeInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSRefTimeInfo_1, - 4, /* Elements count */ - &asn_SPC_GANSSRefTimeInfo_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_GANSSRefTimeInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h index 50614e55b..cd3af9d62 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h +++ b/src/core/libs/supl/asn-rrlp/GANSSRefTimeInfo.h @@ -7,7 +7,6 @@ #ifndef _GANSSRefTimeInfo_H_ #define _GANSSRefTimeInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c index 4960bd140..c00226e0a 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c +++ b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.c @@ -7,42 +7,39 @@ #include "GANSSReferenceTime.h" static asn_TYPE_member_t asn_MBR_GANSSReferenceTime_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSReferenceTime, ganssRefTimeInfo), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSRefTimeInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssRefTimeInfo" - }, - { ATF_POINTER, 1, offsetof(struct GANSSReferenceTime, ganssTOD_GSMTimeAssociation), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSTOD_GSMTimeAssociation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTOD-GSMTimeAssociation" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSReferenceTime, ganssRefTimeInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSRefTimeInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssRefTimeInfo"}, + {ATF_POINTER, 1, + offsetof(struct GANSSReferenceTime, ganssTOD_GSMTimeAssociation), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSTOD_GSMTimeAssociation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTOD-GSMTimeAssociation"}, }; -static int asn_MAP_GANSSReferenceTime_oms_1[] = { 1 }; +static int asn_MAP_GANSSReferenceTime_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_GANSSReferenceTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSReferenceTime_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssRefTimeInfo at 1098 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ganssTOD-GSMTimeAssociation at 1099 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* ganssRefTimeInfo at 1098 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* ganssTOD-GSMTimeAssociation at 1099 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSReferenceTime_specs_1 = { sizeof(struct GANSSReferenceTime), offsetof(struct GANSSReferenceTime, _asn_ctx), asn_MAP_GANSSReferenceTime_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_GANSSReferenceTime_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_GANSSReferenceTime_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSReferenceTime = { "GANSSReferenceTime", @@ -56,16 +53,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSReferenceTime = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSReferenceTime_tags_1, - sizeof(asn_DEF_GANSSReferenceTime_tags_1) - /sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ - asn_DEF_GANSSReferenceTime_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSReferenceTime_tags_1) - /sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSReferenceTime_tags_1) / + sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ + asn_DEF_GANSSReferenceTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSReferenceTime_tags_1) / + sizeof(asn_DEF_GANSSReferenceTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSReferenceTime_1, - 2, /* Elements count */ - &asn_SPC_GANSSReferenceTime_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GANSSReferenceTime_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h index 40620f4ed..245f8cf62 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h +++ b/src/core/libs/supl/asn-rrlp/GANSSReferenceTime.h @@ -7,7 +7,6 @@ #ifndef _GANSSReferenceTime_H_ #define _GANSSReferenceTime_H_ - #include /* Including external dependencies */ @@ -26,7 +25,8 @@ extern "C" typedef struct GANSSReferenceTime { GANSSRefTimeInfo_t ganssRefTimeInfo; - struct GANSSTOD_GSMTimeAssociation *ganssTOD_GSMTimeAssociation /* OPTIONAL */; + struct GANSSTOD_GSMTimeAssociation + *ganssTOD_GSMTimeAssociation /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c index bcaf1fc92..f362c4df7 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.c @@ -6,131 +6,121 @@ #include "GANSSSatelliteElement.h" -static int -memb_svHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_svHealth_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -7 && value <= 13)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -7 && value <= 13)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_iod_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_SV_HEALTH_CONSTR_3 = { - { APC_CONSTRAINED, 5, 5, -7, 13 } /* (-7..13) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, -7, 13} /* (-7..13) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IOD_CONSTR_4 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSSatelliteElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SVID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "svID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svHealth), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_svHealth_constraint_1, - &ASN_PER_MEMB_SV_HEALTH_CONSTR_3, - 0, - "svHealth" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, iod), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_iod_constraint_1, - &ASN_PER_MEMB_IOD_CONSTR_4, - 0, - "iod" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssClockModel), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_GANSSClockModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssClockModel" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssOrbitModel), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_GANSSOrbitModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssOrbitModel" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SVID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "svID"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, svHealth), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_svHealth_constraint_1, + &ASN_PER_MEMB_SV_HEALTH_CONSTR_3, 0, "svHealth"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, iod), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_iod_constraint_1, &ASN_PER_MEMB_IOD_CONSTR_4, + 0, "iod"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssClockModel), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_GANSSClockModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssClockModel"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSSatelliteElement, ganssOrbitModel), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_GANSSOrbitModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssOrbitModel"}, }; static ber_tlv_tag_t asn_DEF_GANSSSatelliteElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSSatelliteElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* svID at 1238 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* svHealth at 1239 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* iod at 1240 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssClockModel at 1241 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ganssOrbitModel at 1242 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* svID at 1238 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* svHealth at 1239 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* iod at 1240 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* ganssClockModel at 1241 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* ganssOrbitModel at 1242 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSSatelliteElement_specs_1 = { sizeof(struct GANSSSatelliteElement), offsetof(struct GANSSSatelliteElement, _asn_ctx), asn_MAP_GANSSSatelliteElement_tag2el_1, - 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 4, /* Start extensions */ - 6 /* Stop extensions */ + 5, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 4, /* Start extensions */ + 6 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSSatelliteElement = { "GANSSSatelliteElement", @@ -144,16 +134,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSSatelliteElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSSatelliteElement_tags_1, - sizeof(asn_DEF_GANSSSatelliteElement_tags_1) - /sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ - asn_DEF_GANSSSatelliteElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSSatelliteElement_tags_1) - /sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSSatelliteElement_tags_1) / + sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSSatelliteElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSSatelliteElement_tags_1) / + sizeof(asn_DEF_GANSSSatelliteElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSSatelliteElement_1, - 5, /* Elements count */ - &asn_SPC_GANSSSatelliteElement_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GANSSSatelliteElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h index b8957e9ac..92f8ec837 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSSSatelliteElement.h @@ -7,7 +7,6 @@ #ifndef _GANSSSatelliteElement_H_ #define _GANSSSatelliteElement_H_ - #include /* Including external dependencies */ @@ -31,9 +30,9 @@ extern "C" GANSSClockModel_t ganssClockModel; GANSSOrbitModel_t ganssOrbitModel; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GANSSSignalID.c b/src/core/libs/supl/asn-rrlp/GANSSSignalID.c index d738729a4..2f299b49c 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSSignalID.c +++ b/src/core/libs/supl/asn-rrlp/GANSSSignalID.c @@ -6,119 +6,137 @@ #include "GANSSSignalID.h" -int -GANSSSignalID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSSignalID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GANSSSignalID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GANSSSignalID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GANSSSignalID_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSSignalID_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSSignalID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSSignalID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSSignalID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSSignalID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSSignalID_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSSignalID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSSignalID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSSignalID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSSignalID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSSignalID_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSSignalID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSSignalID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSSignalID_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSSignalID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ GANSSSignalID_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSS_SIGNAL_ID_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSSignalID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSSignalID = { "GANSSSignalID", "GANSSSignalID", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSSignalID = { GANSSSignalID_encode_xer, GANSSSignalID_decode_uper, GANSSSignalID_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSSignalID_tags_1, - sizeof(asn_DEF_GANSSSignalID_tags_1) - /sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ - asn_DEF_GANSSSignalID_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSSignalID_tags_1) - /sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSSignalID_tags_1) / + sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ + asn_DEF_GANSSSignalID_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSSignalID_tags_1) / + sizeof(asn_DEF_GANSSSignalID_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSS_SIGNAL_ID_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSSignalID.h b/src/core/libs/supl/asn-rrlp/GANSSSignalID.h index 864f14ecd..af6fed29e 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSSignalID.h +++ b/src/core/libs/supl/asn-rrlp/GANSSSignalID.h @@ -7,7 +7,6 @@ #ifndef _GANSSSignalID_H_ #define _GANSSSignalID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c index b3fc91795..446ec823b 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.c @@ -7,82 +7,60 @@ #include "GANSSTOD-GSMTimeAssociation.h" static asn_TYPE_member_t asn_MBR_GANSSTOD_GSMTimeAssociation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bcchCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bcchCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bsic), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, frameNumber), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrameNumber, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "frameNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, timeSlot), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeSlot" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bitNumber), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BitNumber, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bitNumber" - }, - { ATF_POINTER, 1, offsetof(struct GANSSTOD_GSMTimeAssociation, frameDrift), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrameDrift, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "frameDrift" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bcchCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, frameNumber), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "frameNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, timeSlot), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlot, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeSlot"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTOD_GSMTimeAssociation, bitNumber), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BitNumber, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bitNumber"}, + {ATF_POINTER, 1, offsetof(struct GANSSTOD_GSMTimeAssociation, frameDrift), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameDrift, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "frameDrift"}, }; -static int asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1[] = { 5 }; +static int asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1[] = {5}; static ber_tlv_tag_t asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSTOD_GSMTimeAssociation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 1118 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 1119 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frameNumber at 1120 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlot at 1121 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* bitNumber at 1122 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* frameDrift at 1123 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bcchCarrier at 1118 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bsic at 1119 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* frameNumber at 1120 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* timeSlot at 1121 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* bitNumber at 1122 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* frameDrift at 1123 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSTOD_GSMTimeAssociation_specs_1 = { sizeof(struct GANSSTOD_GSMTimeAssociation), offsetof(struct GANSSTOD_GSMTimeAssociation, _asn_ctx), asn_MAP_GANSSTOD_GSMTimeAssociation_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_GANSSTOD_GSMTimeAssociation_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSTOD_GSMTimeAssociation = { "GANSSTOD-GSMTimeAssociation", @@ -96,16 +74,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSTOD_GSMTimeAssociation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1, - sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) - /sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ - asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) - /sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) / + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ + asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1) / + sizeof(asn_DEF_GANSSTOD_GSMTimeAssociation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSTOD_GSMTimeAssociation_1, - 6, /* Elements count */ - &asn_SPC_GANSSTOD_GSMTimeAssociation_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_GANSSTOD_GSMTimeAssociation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h index d39805e51..001741c41 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD-GSMTimeAssociation.h @@ -7,7 +7,6 @@ #ifndef _GANSSTOD_GSMTimeAssociation_H_ #define _GANSSTOD_GSMTimeAssociation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD.c b/src/core/libs/supl/asn-rrlp/GANSSTOD.c index 8b99bc64f..350b46d82 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTOD.c +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD.c @@ -6,119 +6,130 @@ #include "GANSSTOD.h" -int -GANSSTOD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSTOD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 86399)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 86399)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GANSSTOD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GANSSTOD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GANSSTOD_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSTOD_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSTOD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSTOD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSTOD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSTOD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSTOD_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTOD_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSTOD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSTOD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSTOD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTOD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSTOD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSTOD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSTOD_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSTOD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GANSSTOD_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSSTOD_CONSTR_1 = { - { APC_CONSTRAINED, 17, -1, 0, 86399 } /* (0..86399) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 17, -1, 0, 86399} /* (0..86399) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSTOD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSTOD = { "GANSSTOD", "GANSSTOD", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSTOD = { GANSSTOD_encode_xer, GANSSTOD_decode_uper, GANSSTOD_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSTOD_tags_1, - sizeof(asn_DEF_GANSSTOD_tags_1) - /sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ - asn_DEF_GANSSTOD_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSTOD_tags_1) - /sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSTOD_tags_1) / + sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ + asn_DEF_GANSSTOD_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTOD_tags_1) / + sizeof(asn_DEF_GANSSTOD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSSTOD_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSTOD.h b/src/core/libs/supl/asn-rrlp/GANSSTOD.h index 64c662be6..0373885ba 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTOD.h +++ b/src/core/libs/supl/asn-rrlp/GANSSTOD.h @@ -7,7 +7,6 @@ #ifndef _GANSSTOD_H_ #define _GANSSTOD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c index 4fb414df5..0d5f36b88 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c +++ b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.c @@ -6,119 +6,139 @@ #include "GANSSTODUncertainty.h" -int -GANSSTODUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSTODUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GANSSTODUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GANSSTODUncertainty_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GANSSTODUncertainty_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSTODUncertainty_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSTODUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSTODUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSTODUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSTODUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSTODUncertainty_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTODUncertainty_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSTODUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSTODUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSTODUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTODUncertainty_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSTODUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSTODUncertainty_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSTODUncertainty_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSTODUncertainty_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GANSSTODUncertainty_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSSTOD_UNCERTAINTY_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSTODUncertainty_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSTODUncertainty = { "GANSSTODUncertainty", "GANSSTODUncertainty", @@ -131,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSTODUncertainty = { GANSSTODUncertainty_encode_xer, GANSSTODUncertainty_decode_uper, GANSSTODUncertainty_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSTODUncertainty_tags_1, - sizeof(asn_DEF_GANSSTODUncertainty_tags_1) - /sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ - asn_DEF_GANSSTODUncertainty_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSTODUncertainty_tags_1) - /sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSTODUncertainty_tags_1) / + sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ + asn_DEF_GANSSTODUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTODUncertainty_tags_1) / + sizeof(asn_DEF_GANSSTODUncertainty_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSSTOD_UNCERTAINTY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h index 07185ef2a..250317452 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h +++ b/src/core/libs/supl/asn-rrlp/GANSSTODUncertainty.h @@ -7,7 +7,6 @@ #ifndef _GANSSTODUncertainty_H_ #define _GANSSTODUncertainty_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODm.c b/src/core/libs/supl/asn-rrlp/GANSSTODm.c index 6f2aa2a8d..b4c51052d 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTODm.c +++ b/src/core/libs/supl/asn-rrlp/GANSSTODm.c @@ -6,119 +6,130 @@ #include "GANSSTODm.h" -int -GANSSTODm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GANSSTODm_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3599999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3599999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GANSSTODm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GANSSTODm_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GANSSTODm_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GANSSTODm_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GANSSTODm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GANSSTODm_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GANSSTODm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GANSSTODm_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GANSSTODm_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTODm_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GANSSTODm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GANSSTODm_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GANSSTODm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GANSSTODm_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GANSSTODm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GANSSTODm_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GANSSTODm_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GANSSTODm_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GANSSTODm_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GANSSTO_DM_CONSTR_1 = { - { APC_CONSTRAINED, 22, -1, 0, 3599999 } /* (0..3599999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 22, -1, 0, 3599999} /* (0..3599999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GANSSTODm_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GANSSTODm = { "GANSSTODm", "GANSSTODm", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSTODm = { GANSSTODm_encode_xer, GANSSTODm_decode_uper, GANSSTODm_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSTODm_tags_1, - sizeof(asn_DEF_GANSSTODm_tags_1) - /sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ - asn_DEF_GANSSTODm_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSTODm_tags_1) - /sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GANSSTODm_tags_1) / + sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ + asn_DEF_GANSSTODm_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTODm_tags_1) / + sizeof(asn_DEF_GANSSTODm_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GANSSTO_DM_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSTODm.h b/src/core/libs/supl/asn-rrlp/GANSSTODm.h index 923157d7b..ba468f020 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTODm.h +++ b/src/core/libs/supl/asn-rrlp/GANSSTODm.h @@ -7,7 +7,6 @@ #ifndef _GANSSTODm_H_ #define _GANSSTODm_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c index 97517dd57..78c662bab 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c +++ b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.c @@ -6,173 +6,163 @@ #include "GANSSTimeModelElement.h" -static int -memb_ganssTimeModelRefTime_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssTimeModelRefTime_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_gnssTOID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gnssTOID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_weekNumber_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 8191)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 8191)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_TIME_MODEL_REF_TIME_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GNSS_TOID_CONSTR_6 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_WEEK_NUMBER_CONSTR_7 = { - { APC_CONSTRAINED, 13, 13, 0, 8191 } /* (0..8191) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 13, 13, 0, 8191} /* (0..8191) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSTimeModelElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, ganssTimeModelRefTime), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssTimeModelRefTime_constraint_1, - &ASN_PER_MEMB_GANSS_TIME_MODEL_REF_TIME_CONSTR_2, - 0, - "ganssTimeModelRefTime" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, tA0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TA0, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tA0" - }, - { ATF_POINTER, 2, offsetof(struct GANSSTimeModelElement, tA1), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TA1, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tA1" - }, - { ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, tA2), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TA2, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tA2" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, gnssTOID), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gnssTOID_constraint_1, - &ASN_PER_MEMB_GNSS_TOID_CONSTR_6, - 0, - "gnssTOID" - }, - { ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, weekNumber), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_weekNumber_constraint_1, - &ASN_PER_MEMB_WEEK_NUMBER_CONSTR_7, - 0, - "weekNumber" - }, + {ATF_NOFLAGS, 0, + offsetof(struct GANSSTimeModelElement, ganssTimeModelRefTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssTimeModelRefTime_constraint_1, + &ASN_PER_MEMB_GANSS_TIME_MODEL_REF_TIME_CONSTR_2, 0, + "ganssTimeModelRefTime"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, tA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA0, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tA0"}, + {ATF_POINTER, 2, offsetof(struct GANSSTimeModelElement, tA1), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA1, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tA1"}, + {ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, tA2), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TA2, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tA2"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSTimeModelElement, gnssTOID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gnssTOID_constraint_1, + &ASN_PER_MEMB_GNSS_TOID_CONSTR_6, 0, "gnssTOID"}, + {ATF_POINTER, 1, offsetof(struct GANSSTimeModelElement, weekNumber), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_weekNumber_constraint_1, + &ASN_PER_MEMB_WEEK_NUMBER_CONSTR_7, 0, "weekNumber"}, }; -static int asn_MAP_GANSSTimeModelElement_oms_1[] = { 2, 3, 5 }; +static int asn_MAP_GANSSTimeModelElement_oms_1[] = {2, 3, 5}; static ber_tlv_tag_t asn_DEF_GANSSTimeModelElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSTimeModelElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssTimeModelRefTime at 1167 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tA0 at 1168 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* tA1 at 1169 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* tA2 at 1170 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gnssTOID at 1171 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* weekNumber at 1172 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* ganssTimeModelRefTime at 1167 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* tA0 at 1168 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* tA1 at 1169 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* tA2 at 1170 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* gnssTOID at 1171 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* weekNumber at 1172 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSTimeModelElement_specs_1 = { sizeof(struct GANSSTimeModelElement), offsetof(struct GANSSTimeModelElement, _asn_ctx), asn_MAP_GANSSTimeModelElement_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_GANSSTimeModelElement_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_GANSSTimeModelElement_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSTimeModelElement = { "GANSSTimeModelElement", @@ -186,16 +176,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSTimeModelElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSTimeModelElement_tags_1, - sizeof(asn_DEF_GANSSTimeModelElement_tags_1) - /sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ - asn_DEF_GANSSTimeModelElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSTimeModelElement_tags_1) - /sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSTimeModelElement_tags_1) / + sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ + asn_DEF_GANSSTimeModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSTimeModelElement_tags_1) / + sizeof(asn_DEF_GANSSTimeModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSTimeModelElement_1, - 6, /* Elements count */ - &asn_SPC_GANSSTimeModelElement_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_GANSSTimeModelElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h index ae9651882..fd67d57c9 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h +++ b/src/core/libs/supl/asn-rrlp/GANSSTimeModelElement.h @@ -7,7 +7,6 @@ #ifndef _GANSSTimeModelElement_H_ #define _GANSSTimeModelElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c index 2af83b12b..e943a5b26 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c +++ b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.c @@ -6,341 +6,342 @@ #include "GANSSUTCModel.h" -static int -memb_ganssUtcA1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcA1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcA0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcTot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcTot_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcWNt_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcWNt_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcDeltaTls_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcDeltaTls_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcWNlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcWNlsf_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcDN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcDN_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ganssUtcDeltaTlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssUtcDeltaTlsf_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_A1_CONSTR_2 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_A0_CONSTR_3 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_TOT_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_W_NT_CONSTR_5 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_DELTA_TLS_CONSTR_6 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_W_NLSF_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_DN_CONSTR_8 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GANSS_UTC_DELTA_TLSF_CONSTR_9 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GANSSUTCModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcA1_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_A1_CONSTR_2, - 0, - "ganssUtcA1" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcA0_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_A0_CONSTR_3, - 0, - "ganssUtcA0" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcTot), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcTot_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_TOT_CONSTR_4, - 0, - "ganssUtcTot" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNt), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcWNt_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_W_NT_CONSTR_5, - 0, - "ganssUtcWNt" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTls), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcDeltaTls_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_DELTA_TLS_CONSTR_6, - 0, - "ganssUtcDeltaTls" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNlsf), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcWNlsf_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_W_NLSF_CONSTR_7, - 0, - "ganssUtcWNlsf" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDN), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcDN_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_DN_CONSTR_8, - 0, - "ganssUtcDN" - }, - { ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTlsf), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssUtcDeltaTlsf_constraint_1, - &ASN_PER_MEMB_GANSS_UTC_DELTA_TLSF_CONSTR_9, - 0, - "ganssUtcDeltaTlsf" - }, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcA1_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_A1_CONSTR_2, 0, "ganssUtcA1"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcA0_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_A0_CONSTR_3, 0, "ganssUtcA0"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcTot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcTot_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_TOT_CONSTR_4, 0, "ganssUtcTot"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNt), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcWNt_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_W_NT_CONSTR_5, 0, "ganssUtcWNt"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTls), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcDeltaTls_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_DELTA_TLS_CONSTR_6, 0, "ganssUtcDeltaTls"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcWNlsf), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcWNlsf_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_W_NLSF_CONSTR_7, 0, "ganssUtcWNlsf"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDN), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcDN_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_DN_CONSTR_8, 0, "ganssUtcDN"}, + {ATF_NOFLAGS, 0, offsetof(struct GANSSUTCModel, ganssUtcDeltaTlsf), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssUtcDeltaTlsf_constraint_1, + &ASN_PER_MEMB_GANSS_UTC_DELTA_TLSF_CONSTR_9, 0, "ganssUtcDeltaTlsf"}, }; static ber_tlv_tag_t asn_DEF_GANSSUTCModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GANSSUTCModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssUtcA1 at 1382 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssUtcA0 at 1383 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganssUtcTot at 1384 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssUtcWNt at 1385 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssUtcDeltaTls at 1386 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ganssUtcWNlsf at 1387 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ganssUtcDN at 1388 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* ganssUtcDeltaTlsf at 1389 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssUtcA1 at 1382 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ganssUtcA0 at 1383 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* ganssUtcTot at 1384 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* ganssUtcWNt at 1385 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* ganssUtcDeltaTls at 1386 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* ganssUtcWNlsf at 1387 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* ganssUtcDN at 1388 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0} /* ganssUtcDeltaTlsf at 1389 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GANSSUTCModel_specs_1 = { sizeof(struct GANSSUTCModel), offsetof(struct GANSSUTCModel, _asn_ctx), asn_MAP_GANSSUTCModel_tag2el_1, - 8, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 8, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GANSSUTCModel = { "GANSSUTCModel", @@ -354,16 +355,15 @@ asn_TYPE_descriptor_t asn_DEF_GANSSUTCModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GANSSUTCModel_tags_1, - sizeof(asn_DEF_GANSSUTCModel_tags_1) - /sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ - asn_DEF_GANSSUTCModel_tags_1, /* Same as above */ - sizeof(asn_DEF_GANSSUTCModel_tags_1) - /sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GANSSUTCModel_tags_1) / + sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ + asn_DEF_GANSSUTCModel_tags_1, /* Same as above */ + sizeof(asn_DEF_GANSSUTCModel_tags_1) / + sizeof(asn_DEF_GANSSUTCModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GANSSUTCModel_1, - 8, /* Elements count */ - &asn_SPC_GANSSUTCModel_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_GANSSUTCModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h index fa6595017..9dae48604 100644 --- a/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h +++ b/src/core/libs/supl/asn-rrlp/GANSSUTCModel.h @@ -7,7 +7,6 @@ #ifndef _GANSSUTCModel_H_ #define _GANSSUTCModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPS-AssistData.c b/src/core/libs/supl/asn-rrlp/GPS-AssistData.c index 9b99a040e..e9421d0d8 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-AssistData.c +++ b/src/core/libs/supl/asn-rrlp/GPS-AssistData.c @@ -7,30 +7,28 @@ #include "GPS-AssistData.h" static asn_TYPE_member_t asn_MBR_GPS_AssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPS_AssistData, controlHeader), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ControlHeader, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "controlHeader" - }, + {ATF_NOFLAGS, 0, offsetof(struct GPS_AssistData, controlHeader), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ControlHeader, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "controlHeader"}, }; static ber_tlv_tag_t asn_DEF_GPS_AssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPS_AssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* controlHeader at 556 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* controlHeader at 556 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPS_AssistData_specs_1 = { sizeof(struct GPS_AssistData), offsetof(struct GPS_AssistData, _asn_ctx), asn_MAP_GPS_AssistData_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPS_AssistData = { "GPS-AssistData", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_GPS_AssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPS_AssistData_tags_1, - sizeof(asn_DEF_GPS_AssistData_tags_1) - /sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ - asn_DEF_GPS_AssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_GPS_AssistData_tags_1) - /sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPS_AssistData_tags_1) / + sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ + asn_DEF_GPS_AssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_AssistData_tags_1) / + sizeof(asn_DEF_GPS_AssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPS_AssistData_1, - 1, /* Elements count */ - &asn_SPC_GPS_AssistData_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GPS_AssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPS-AssistData.h b/src/core/libs/supl/asn-rrlp/GPS-AssistData.h index 18871b2f2..af8054543 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-AssistData.h +++ b/src/core/libs/supl/asn-rrlp/GPS-AssistData.h @@ -7,7 +7,6 @@ #ifndef _GPS_AssistData_H_ #define _GPS_AssistData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c index d88311553..30bb4b60b 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c +++ b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.c @@ -7,30 +7,28 @@ #include "GPS-MeasureInfo.h" static asn_TYPE_member_t asn_MBR_GPS_MeasureInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPS_MeasureInfo, gpsMsrSetList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGPS_MsrSetElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsMsrSetList" - }, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MeasureInfo, gpsMsrSetList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGPS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsMsrSetList"}, }; static ber_tlv_tag_t asn_DEF_GPS_MeasureInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPS_MeasureInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* gpsMsrSetList at 445 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* gpsMsrSetList at 445 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPS_MeasureInfo_specs_1 = { sizeof(struct GPS_MeasureInfo), offsetof(struct GPS_MeasureInfo, _asn_ctx), asn_MAP_GPS_MeasureInfo_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPS_MeasureInfo = { "GPS-MeasureInfo", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_GPS_MeasureInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPS_MeasureInfo_tags_1, - sizeof(asn_DEF_GPS_MeasureInfo_tags_1) - /sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ - asn_DEF_GPS_MeasureInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_GPS_MeasureInfo_tags_1) - /sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPS_MeasureInfo_tags_1) / + sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_GPS_MeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MeasureInfo_tags_1) / + sizeof(asn_DEF_GPS_MeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPS_MeasureInfo_1, - 1, /* Elements count */ - &asn_SPC_GPS_MeasureInfo_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_GPS_MeasureInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h index 7c57e174e..2196b04c3 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h +++ b/src/core/libs/supl/asn-rrlp/GPS-MeasureInfo.h @@ -7,7 +7,6 @@ #ifndef _GPS_MeasureInfo_H_ #define _GPS_MeasureInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c index 2a76da684..7ff02fdc1 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.c @@ -6,241 +6,233 @@ #include "GPS-MsrElement.h" -static int -memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_cNo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_doppler_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_wholeChips_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_wholeChips_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1022)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1022)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_fracChips_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_fracChips_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1024)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1024)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_pseuRangeRMSErr_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_pseuRangeRMSErr_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_C_NO_CONSTR_3 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DOPPLER_CONSTR_4 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_WHOLE_CHIPS_CONSTR_5 = { - { APC_CONSTRAINED, 10, 10, 0, 1022 } /* (0..1022) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1022} /* (0..1022) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_FRAC_CHIPS_CONSTR_6 = { - { APC_CONSTRAINED, 11, 11, 0, 1024 } /* (0..1024) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, 0, 1024} /* (0..1024) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_PSEU_RANGE_RMS_ERR_CONSTR_8 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GPS_MsrElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, satelliteID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satelliteID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, cNo), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_cNo_constraint_1, - &ASN_PER_MEMB_C_NO_CONSTR_3, - 0, - "cNo" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, doppler), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_doppler_constraint_1, - &ASN_PER_MEMB_DOPPLER_CONSTR_4, - 0, - "doppler" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, wholeChips), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_wholeChips_constraint_1, - &ASN_PER_MEMB_WHOLE_CHIPS_CONSTR_5, - 0, - "wholeChips" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, fracChips), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_fracChips_constraint_1, - &ASN_PER_MEMB_FRAC_CHIPS_CONSTR_6, - 0, - "fracChips" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, mpathIndic), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MpathIndic, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "mpathIndic" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, pseuRangeRMSErr), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_pseuRangeRMSErr_constraint_1, - &ASN_PER_MEMB_PSEU_RANGE_RMS_ERR_CONSTR_8, - 0, - "pseuRangeRMSErr" - }, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satelliteID"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, cNo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_cNo_constraint_1, &ASN_PER_MEMB_C_NO_CONSTR_3, + 0, "cNo"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, doppler), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_doppler_constraint_1, + &ASN_PER_MEMB_DOPPLER_CONSTR_4, 0, "doppler"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, wholeChips), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_wholeChips_constraint_1, + &ASN_PER_MEMB_WHOLE_CHIPS_CONSTR_5, 0, "wholeChips"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, fracChips), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_fracChips_constraint_1, + &ASN_PER_MEMB_FRAC_CHIPS_CONSTR_6, 0, "fracChips"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, mpathIndic), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MpathIndic, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "mpathIndic"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrElement, pseuRangeRMSErr), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_pseuRangeRMSErr_constraint_1, + &ASN_PER_MEMB_PSEU_RANGE_RMS_ERR_CONSTR_8, 0, "pseuRangeRMSErr"}, }; static ber_tlv_tag_t asn_DEF_GPS_MsrElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPS_MsrElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 466 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cNo at 467 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* doppler at 468 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* wholeChips at 469 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* fracChips at 470 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* mpathIndic at 474 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* pseuRangeRMSErr at 475 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satelliteID at 466 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* cNo at 467 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* doppler at 468 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* wholeChips at 469 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* fracChips at 470 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* mpathIndic at 474 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0} /* pseuRangeRMSErr at 475 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPS_MsrElement_specs_1 = { sizeof(struct GPS_MsrElement), offsetof(struct GPS_MsrElement, _asn_ctx), asn_MAP_GPS_MsrElement_tag2el_1, - 7, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 7, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPS_MsrElement = { "GPS-MsrElement", @@ -254,16 +246,15 @@ asn_TYPE_descriptor_t asn_DEF_GPS_MsrElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPS_MsrElement_tags_1, - sizeof(asn_DEF_GPS_MsrElement_tags_1) - /sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ - asn_DEF_GPS_MsrElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GPS_MsrElement_tags_1) - /sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPS_MsrElement_tags_1) / + sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ + asn_DEF_GPS_MsrElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MsrElement_tags_1) / + sizeof(asn_DEF_GPS_MsrElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPS_MsrElement_1, - 7, /* Elements count */ - &asn_SPC_GPS_MsrElement_specs_1 /* Additional specs */ + 7, /* Elements count */ + &asn_SPC_GPS_MsrElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h index 4609e9cf4..1df83c8f9 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrElement.h @@ -7,7 +7,6 @@ #ifndef _GPS_MsrElement_H_ #define _GPS_MsrElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c index 8e83fc9bc..d0b1fea43 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.c @@ -6,83 +6,76 @@ #include "GPS-MsrSetElement.h" -static int -memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_FRAME_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GPS_MsrSetElement_1[] = { - { ATF_POINTER, 1, offsetof(struct GPS_MsrSetElement, refFrame), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refFrame_constraint_1, - &ASN_PER_MEMB_REF_FRAME_CONSTR_2, - 0, - "refFrame" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gpsTOW), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTOW24b, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTOW" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gps_msrList), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfGPS_MsrElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gps-msrList" - }, + {ATF_POINTER, 1, offsetof(struct GPS_MsrSetElement, refFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refFrame_constraint_1, + &ASN_PER_MEMB_REF_FRAME_CONSTR_2, 0, "refFrame"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW24b, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTOW"}, + {ATF_NOFLAGS, 0, offsetof(struct GPS_MsrSetElement, gps_msrList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfGPS_MsrElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gps-msrList"}, }; -static int asn_MAP_GPS_MsrSetElement_oms_1[] = { 0 }; +static int asn_MAP_GPS_MsrSetElement_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_GPS_MsrSetElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPS_MsrSetElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrame at 450 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTOW at 451 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gps-msrList at 457 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refFrame at 450 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* gpsTOW at 451 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* gps-msrList at 457 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPS_MsrSetElement_specs_1 = { sizeof(struct GPS_MsrSetElement), offsetof(struct GPS_MsrSetElement, _asn_ctx), asn_MAP_GPS_MsrSetElement_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_GPS_MsrSetElement_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_GPS_MsrSetElement_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPS_MsrSetElement = { "GPS-MsrSetElement", @@ -96,16 +89,15 @@ asn_TYPE_descriptor_t asn_DEF_GPS_MsrSetElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPS_MsrSetElement_tags_1, - sizeof(asn_DEF_GPS_MsrSetElement_tags_1) - /sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ - asn_DEF_GPS_MsrSetElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GPS_MsrSetElement_tags_1) - /sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPS_MsrSetElement_tags_1) / + sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_GPS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPS_MsrSetElement_tags_1) / + sizeof(asn_DEF_GPS_MsrSetElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPS_MsrSetElement_1, - 3, /* Elements count */ - &asn_SPC_GPS_MsrSetElement_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_GPS_MsrSetElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h index 8de11ca6d..b9ba63dad 100644 --- a/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h +++ b/src/core/libs/supl/asn-rrlp/GPS-MsrSetElement.h @@ -7,7 +7,6 @@ #ifndef _GPS_MsrSetElement_H_ #define _GPS_MsrSetElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c index 21a2be7ad..55e7d7e1f 100644 --- a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c +++ b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.c @@ -6,120 +6,142 @@ #include "GPSAssistanceData.h" -int -GPSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GPSAssistanceData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 40)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 40)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using OCTET_STRING, * so here we adjust the DEF accordingly. */ -static void -GPSAssistanceData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_OCTET_STRING.free_struct; - td->print_struct = asn_DEF_OCTET_STRING.print_struct; - td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; - td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; - td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; - td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; - td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; - td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; - if(!td->per_constraints) +static void GPSAssistanceData_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_OCTET_STRING.free_struct; + td->print_struct = asn_DEF_OCTET_STRING.print_struct; + td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; + td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; + td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; + td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; + td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; + td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; - td->elements = asn_DEF_OCTET_STRING.elements; + td->elements = asn_DEF_OCTET_STRING.elements; td->elements_count = asn_DEF_OCTET_STRING.elements_count; - td->specifics = asn_DEF_OCTET_STRING.specifics; + td->specifics = asn_DEF_OCTET_STRING.specifics; } -void -GPSAssistanceData_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GPSAssistanceData_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GPSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GPSAssistanceData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GPSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GPSAssistanceData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GPSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSAssistanceData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GPSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GPSAssistanceData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GPSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSAssistanceData_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GPSAssistanceData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GPSAssistanceData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GPSAssistanceData_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GPSAssistanceData_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ GPSAssistanceData_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GPS_ASSISTANCE_DATA_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 40 } /* (SIZE(1..40)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 40} /* (SIZE(1..40)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GPSAssistanceData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; asn_TYPE_descriptor_t asn_DEF_GPSAssistanceData = { "GPSAssistanceData", "GPSAssistanceData", @@ -132,15 +154,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSAssistanceData = { GPSAssistanceData_encode_xer, GPSAssistanceData_decode_uper, GPSAssistanceData_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSAssistanceData_tags_1, - sizeof(asn_DEF_GPSAssistanceData_tags_1) - /sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ - asn_DEF_GPSAssistanceData_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSAssistanceData_tags_1) - /sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSAssistanceData_tags_1) / + sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ + asn_DEF_GPSAssistanceData_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSAssistanceData_tags_1) / + sizeof(asn_DEF_GPSAssistanceData_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPS_ASSISTANCE_DATA_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h index 4776c9ef5..3621b689b 100644 --- a/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h +++ b/src/core/libs/supl/asn-rrlp/GPSAssistanceData.h @@ -7,7 +7,6 @@ #ifndef _GPSAssistanceData_H_ #define _GPSAssistanceData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c index 73adddea9..20b54dc1b 100644 --- a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c +++ b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.c @@ -6,119 +6,133 @@ #include "GPSReferenceTimeUncertainty.h" -int -GPSReferenceTimeUncertainty_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GPSReferenceTimeUncertainty_constraint( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GPSReferenceTimeUncertainty_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GPSReferenceTimeUncertainty_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GPSReferenceTimeUncertainty_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GPSReferenceTimeUncertainty_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GPSReferenceTimeUncertainty_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GPSReferenceTimeUncertainty_decode_ber( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GPSReferenceTimeUncertainty_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSReferenceTimeUncertainty_encode_der( + asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GPSReferenceTimeUncertainty_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GPSReferenceTimeUncertainty_decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, size_t size) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GPSReferenceTimeUncertainty_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSReferenceTimeUncertainty_encode_xer( + asn_TYPE_descriptor_t *td, void *structure, int ilevel, + enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GPSReferenceTimeUncertainty_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GPSReferenceTimeUncertainty_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GPSReferenceTimeUncertainty_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GPSReferenceTimeUncertainty_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GPSReferenceTimeUncertainty_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static asn_per_constraints_t ASN_PER_TYPE_GPS_REFERENCE_TIME_UNCERTAINTY_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_GPS_REFERENCE_TIME_UNCERTAINTY_CONSTR_1 = { + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GPSReferenceTimeUncertainty_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GPSReferenceTimeUncertainty = { "GPSReferenceTimeUncertainty", "GPSReferenceTimeUncertainty", @@ -131,15 +145,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSReferenceTimeUncertainty = { GPSReferenceTimeUncertainty_encode_xer, GPSReferenceTimeUncertainty_decode_uper, GPSReferenceTimeUncertainty_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSReferenceTimeUncertainty_tags_1, - sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) - /sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ - asn_DEF_GPSReferenceTimeUncertainty_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) - /sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) / + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ + asn_DEF_GPSReferenceTimeUncertainty_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1) / + sizeof(asn_DEF_GPSReferenceTimeUncertainty_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPS_REFERENCE_TIME_UNCERTAINTY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h index e556c42d8..5eb12cdca 100644 --- a/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h +++ b/src/core/libs/supl/asn-rrlp/GPSReferenceTimeUncertainty.h @@ -7,7 +7,6 @@ #ifndef _GPSReferenceTimeUncertainty_H_ #define _GPSReferenceTimeUncertainty_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW23b.c b/src/core/libs/supl/asn-rrlp/GPSTOW23b.c index baae5187b..b5f776ec9 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOW23b.c +++ b/src/core/libs/supl/asn-rrlp/GPSTOW23b.c @@ -6,119 +6,130 @@ #include "GPSTOW23b.h" -int -GPSTOW23b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GPSTOW23b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7559999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7559999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GPSTOW23b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GPSTOW23b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GPSTOW23b_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GPSTOW23b_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GPSTOW23b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GPSTOW23b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GPSTOW23b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GPSTOW23b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GPSTOW23b_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSTOW23b_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GPSTOW23b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GPSTOW23b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GPSTOW23b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSTOW23b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GPSTOW23b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GPSTOW23b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GPSTOW23b_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GPSTOW23b_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GPSTOW23b_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GPSTO_W23B_CONSTR_1 = { - { APC_CONSTRAINED, 23, -1, 0, 7559999 } /* (0..7559999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 23, -1, 0, 7559999} /* (0..7559999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GPSTOW23b_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GPSTOW23b = { "GPSTOW23b", "GPSTOW23b", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSTOW23b = { GPSTOW23b_encode_xer, GPSTOW23b_decode_uper, GPSTOW23b_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTOW23b_tags_1, - sizeof(asn_DEF_GPSTOW23b_tags_1) - /sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ - asn_DEF_GPSTOW23b_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTOW23b_tags_1) - /sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSTOW23b_tags_1) / + sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ + asn_DEF_GPSTOW23b_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOW23b_tags_1) / + sizeof(asn_DEF_GPSTOW23b_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPSTO_W23B_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW23b.h b/src/core/libs/supl/asn-rrlp/GPSTOW23b.h index 2f41dcfa9..dd14855e8 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOW23b.h +++ b/src/core/libs/supl/asn-rrlp/GPSTOW23b.h @@ -7,7 +7,6 @@ #ifndef _GPSTOW23b_H_ #define _GPSTOW23b_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW24b.c b/src/core/libs/supl/asn-rrlp/GPSTOW24b.c index 77c775a07..c4ba18751 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOW24b.c +++ b/src/core/libs/supl/asn-rrlp/GPSTOW24b.c @@ -6,119 +6,130 @@ #include "GPSTOW24b.h" -int -GPSTOW24b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GPSTOW24b_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 14399999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 14399999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GPSTOW24b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GPSTOW24b_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GPSTOW24b_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GPSTOW24b_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GPSTOW24b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GPSTOW24b_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GPSTOW24b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GPSTOW24b_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GPSTOW24b_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSTOW24b_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GPSTOW24b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GPSTOW24b_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GPSTOW24b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSTOW24b_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GPSTOW24b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GPSTOW24b_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GPSTOW24b_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GPSTOW24b_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GPSTOW24b_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GPSTO_W24B_CONSTR_1 = { - { APC_CONSTRAINED, 24, -1, 0, 14399999 } /* (0..14399999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, 0, 14399999} /* (0..14399999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GPSTOW24b_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GPSTOW24b = { "GPSTOW24b", "GPSTOW24b", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSTOW24b = { GPSTOW24b_encode_xer, GPSTOW24b_decode_uper, GPSTOW24b_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTOW24b_tags_1, - sizeof(asn_DEF_GPSTOW24b_tags_1) - /sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ - asn_DEF_GPSTOW24b_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTOW24b_tags_1) - /sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSTOW24b_tags_1) / + sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ + asn_DEF_GPSTOW24b_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOW24b_tags_1) / + sizeof(asn_DEF_GPSTOW24b_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPSTO_W24B_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTOW24b.h b/src/core/libs/supl/asn-rrlp/GPSTOW24b.h index 4a99e1bb4..d92da2a38 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOW24b.h +++ b/src/core/libs/supl/asn-rrlp/GPSTOW24b.h @@ -7,7 +7,6 @@ #ifndef _GPSTOW24b_H_ #define _GPSTOW24b_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c index 1d2cce140..09d2ec7dc 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.c @@ -7,28 +7,23 @@ #include "GPSTOWAssist.h" static asn_per_constraints_t ASN_PER_TYPE_GPSTOW_ASSIST_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 12} /* (SIZE(1..12)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GPSTOWAssist_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GPSTOWAssistElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GPSTOWAssistElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_GPSTOWAssist_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_GPSTOWAssist_specs_1 = { - sizeof(struct GPSTOWAssist), - offsetof(struct GPSTOWAssist, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + sizeof(struct GPSTOWAssist), offsetof(struct GPSTOWAssist, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_GPSTOWAssist = { "GPSTOWAssist", @@ -42,16 +37,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSTOWAssist = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTOWAssist_tags_1, - sizeof(asn_DEF_GPSTOWAssist_tags_1) - /sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ - asn_DEF_GPSTOWAssist_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTOWAssist_tags_1) - /sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSTOWAssist_tags_1) / + sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ + asn_DEF_GPSTOWAssist_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOWAssist_tags_1) / + sizeof(asn_DEF_GPSTOWAssist_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPSTOW_ASSIST_CONSTR_1, asn_MBR_GPSTOWAssist_1, - 1, /* Single element */ - &asn_SPC_GPSTOWAssist_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_GPSTOWAssist_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h index fd083d7a1..64dfddb43 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssist.h @@ -7,7 +7,6 @@ #ifndef _GPSTOWAssist_H_ #define _GPSTOWAssist_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c index 16dd6d93f..e6db25efd 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.c @@ -7,70 +7,54 @@ #include "GPSTOWAssistElement.h" static asn_TYPE_member_t asn_MBR_GPSTOWAssistElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, satelliteID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satelliteID" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmWord), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TLMWord, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tlmWord" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, antiSpoof), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AntiSpoofFlag, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "antiSpoof" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, alert), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AlertFlag, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "alert" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmRsvdBits), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TLMReservedBits, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tlmRsvdBits" - }, + {ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satelliteID"}, + {ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmWord), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TLMWord, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tlmWord"}, + {ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, antiSpoof), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AntiSpoofFlag, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "antiSpoof"}, + {ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, alert), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AlertFlag, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "alert"}, + {ATF_NOFLAGS, 0, offsetof(struct GPSTOWAssistElement, tlmRsvdBits), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TLMReservedBits, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tlmRsvdBits"}, }; static ber_tlv_tag_t asn_DEF_GPSTOWAssistElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPSTOWAssistElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 610 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tlmWord at 611 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* antiSpoof at 612 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* alert at 613 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* tlmRsvdBits at 615 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satelliteID at 610 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* tlmWord at 611 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* antiSpoof at 612 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* alert at 613 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* tlmRsvdBits at 615 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPSTOWAssistElement_specs_1 = { sizeof(struct GPSTOWAssistElement), offsetof(struct GPSTOWAssistElement, _asn_ctx), asn_MAP_GPSTOWAssistElement_tag2el_1, - 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPSTOWAssistElement = { "GPSTOWAssistElement", @@ -84,16 +68,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSTOWAssistElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTOWAssistElement_tags_1, - sizeof(asn_DEF_GPSTOWAssistElement_tags_1) - /sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ - asn_DEF_GPSTOWAssistElement_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTOWAssistElement_tags_1) - /sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPSTOWAssistElement_tags_1) / + sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ + asn_DEF_GPSTOWAssistElement_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTOWAssistElement_tags_1) / + sizeof(asn_DEF_GPSTOWAssistElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPSTOWAssistElement_1, - 5, /* Elements count */ - &asn_SPC_GPSTOWAssistElement_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GPSTOWAssistElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h index d5b41a9b1..c8074077a 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h +++ b/src/core/libs/supl/asn-rrlp/GPSTOWAssistElement.h @@ -7,7 +7,6 @@ #ifndef _GPSTOWAssistElement_H_ #define _GPSTOWAssistElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTime.c b/src/core/libs/supl/asn-rrlp/GPSTime.c index 0c1f4d00f..5c7c35b9f 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTime.c +++ b/src/core/libs/supl/asn-rrlp/GPSTime.c @@ -7,40 +7,33 @@ #include "GPSTime.h" static asn_TYPE_member_t asn_MBR_GPSTime_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsTOW23b), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTOW23b, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTOW23b" - }, - { ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsWeek), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSWeek, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsWeek" - }, + {ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsTOW23b), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW23b, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTOW23b"}, + {ATF_NOFLAGS, 0, offsetof(struct GPSTime, gpsWeek), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSWeek, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsWeek"}, }; static ber_tlv_tag_t asn_DEF_GPSTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GPSTime_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW23b at 594 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gpsWeek at 596 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gpsTOW23b at 594 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* gpsWeek at 596 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GPSTime_specs_1 = { sizeof(struct GPSTime), offsetof(struct GPSTime, _asn_ctx), asn_MAP_GPSTime_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPSTime = { "GPSTime", @@ -54,16 +47,13 @@ asn_TYPE_descriptor_t asn_DEF_GPSTime = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTime_tags_1, - sizeof(asn_DEF_GPSTime_tags_1) - /sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ - asn_DEF_GPSTime_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTime_tags_1) - /sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPSTime_tags_1) / sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ + asn_DEF_GPSTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTime_tags_1) / sizeof(asn_DEF_GPSTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPSTime_1, - 2, /* Elements count */ - &asn_SPC_GPSTime_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_GPSTime_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTime.h b/src/core/libs/supl/asn-rrlp/GPSTime.h index 56d8721c0..84bc75a41 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTime.h +++ b/src/core/libs/supl/asn-rrlp/GPSTime.h @@ -7,7 +7,6 @@ #ifndef _GPSTime_H_ #define _GPSTime_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c index f1b73fdb0..e0f208e5c 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c +++ b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.c @@ -6,153 +6,157 @@ #include "GPSTimeAssistanceMeasurements.h" -static int -memb_referenceFrameMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_referenceFrameMSB_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_gpsTowSubms_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsTowSubms_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 9999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 9999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_deltaTow_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaTow_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REFERENCE_FRAME_MSB_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GPS_TOW_SUBMS_CONSTR_3 = { - { APC_CONSTRAINED, 14, 14, 0, 9999 } /* (0..9999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, 0, 9999} /* (0..9999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELTA_TOW_CONSTR_4 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GPSTimeAssistanceMeasurements_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GPSTimeAssistanceMeasurements, referenceFrameMSB), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_referenceFrameMSB_constraint_1, - &ASN_PER_MEMB_REFERENCE_FRAME_MSB_CONSTR_2, - 0, - "referenceFrameMSB" - }, - { ATF_POINTER, 3, offsetof(struct GPSTimeAssistanceMeasurements, gpsTowSubms), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsTowSubms_constraint_1, - &ASN_PER_MEMB_GPS_TOW_SUBMS_CONSTR_3, - 0, - "gpsTowSubms" - }, - { ATF_POINTER, 2, offsetof(struct GPSTimeAssistanceMeasurements, deltaTow), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaTow_constraint_1, - &ASN_PER_MEMB_DELTA_TOW_CONSTR_4, - 0, - "deltaTow" - }, - { ATF_POINTER, 1, offsetof(struct GPSTimeAssistanceMeasurements, gpsReferenceTimeUncertainty), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSReferenceTimeUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsReferenceTimeUncertainty" - }, + {ATF_NOFLAGS, 0, + offsetof(struct GPSTimeAssistanceMeasurements, referenceFrameMSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_referenceFrameMSB_constraint_1, + &ASN_PER_MEMB_REFERENCE_FRAME_MSB_CONSTR_2, 0, "referenceFrameMSB"}, + {ATF_POINTER, 3, + offsetof(struct GPSTimeAssistanceMeasurements, gpsTowSubms), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsTowSubms_constraint_1, + &ASN_PER_MEMB_GPS_TOW_SUBMS_CONSTR_3, 0, "gpsTowSubms"}, + {ATF_POINTER, 2, offsetof(struct GPSTimeAssistanceMeasurements, deltaTow), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaTow_constraint_1, + &ASN_PER_MEMB_DELTA_TOW_CONSTR_4, 0, "deltaTow"}, + {ATF_POINTER, 1, + offsetof(struct GPSTimeAssistanceMeasurements, + gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsReferenceTimeUncertainty"}, }; -static int asn_MAP_GPSTimeAssistanceMeasurements_oms_1[] = { 1, 2, 3 }; +static int asn_MAP_GPSTimeAssistanceMeasurements_oms_1[] = {1, 2, 3}; static ber_tlv_tag_t asn_DEF_GPSTimeAssistanceMeasurements_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* referenceFrameMSB at 950 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* gpsTowSubms at 951 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* deltaTow at 952 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0} /* gpsReferenceTimeUncertainty at 953 */ }; -static asn_TYPE_tag2member_t asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFrameMSB at 950 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTowSubms at 951 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* deltaTow at 952 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* gpsReferenceTimeUncertainty at 953 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_GPSTimeAssistanceMeasurements_specs_1 = { - sizeof(struct GPSTimeAssistanceMeasurements), - offsetof(struct GPSTimeAssistanceMeasurements, _asn_ctx), - asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_GPSTimeAssistanceMeasurements_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_GPSTimeAssistanceMeasurements_specs_1 = + { + sizeof(struct GPSTimeAssistanceMeasurements), + offsetof(struct GPSTimeAssistanceMeasurements, _asn_ctx), + asn_MAP_GPSTimeAssistanceMeasurements_tag2el_1, + 4, /* Count of tags in the map */ + asn_MAP_GPSTimeAssistanceMeasurements_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GPSTimeAssistanceMeasurements = { "GPSTimeAssistanceMeasurements", @@ -166,16 +170,15 @@ asn_TYPE_descriptor_t asn_DEF_GPSTimeAssistanceMeasurements = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSTimeAssistanceMeasurements_tags_1, - sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) - /sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ - asn_DEF_GPSTimeAssistanceMeasurements_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) - /sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) / + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ + asn_DEF_GPSTimeAssistanceMeasurements_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1) / + sizeof(asn_DEF_GPSTimeAssistanceMeasurements_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GPSTimeAssistanceMeasurements_1, - 4, /* Elements count */ - &asn_SPC_GPSTimeAssistanceMeasurements_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_GPSTimeAssistanceMeasurements_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h index 797d911d5..fb743aa47 100644 --- a/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h +++ b/src/core/libs/supl/asn-rrlp/GPSTimeAssistanceMeasurements.h @@ -7,7 +7,6 @@ #ifndef _GPSTimeAssistanceMeasurements_H_ #define _GPSTimeAssistanceMeasurements_H_ - #include /* Including external dependencies */ @@ -26,7 +25,8 @@ extern "C" long referenceFrameMSB; long *gpsTowSubms /* OPTIONAL */; long *deltaTow /* OPTIONAL */; - GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + GPSReferenceTimeUncertainty_t + *gpsReferenceTimeUncertainty /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/GPSWeek.c b/src/core/libs/supl/asn-rrlp/GPSWeek.c index 1a64391b7..1eb00b295 100644 --- a/src/core/libs/supl/asn-rrlp/GPSWeek.c +++ b/src/core/libs/supl/asn-rrlp/GPSWeek.c @@ -6,119 +6,129 @@ #include "GPSWeek.h" -int -GPSWeek_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GPSWeek_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -GPSWeek_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void GPSWeek_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -GPSWeek_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void GPSWeek_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ GPSWeek_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -GPSWeek_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int GPSWeek_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSWeek_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -GPSWeek_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t GPSWeek_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ GPSWeek_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -GPSWeek_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSWeek_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSWeek_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -GPSWeek_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t GPSWeek_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ GPSWeek_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -GPSWeek_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GPSWeek_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ GPSWeek_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -GPSWeek_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t GPSWeek_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ GPSWeek_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -GPSWeek_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t GPSWeek_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ GPSWeek_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_GPS_WEEK_CONSTR_1 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_GPSWeek_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_GPSWeek = { "GPSWeek", "GPSWeek", @@ -131,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_GPSWeek = { GPSWeek_encode_xer, GPSWeek_decode_uper, GPSWeek_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GPSWeek_tags_1, - sizeof(asn_DEF_GPSWeek_tags_1) - /sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ - asn_DEF_GPSWeek_tags_1, /* Same as above */ - sizeof(asn_DEF_GPSWeek_tags_1) - /sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ + sizeof(asn_DEF_GPSWeek_tags_1) / sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ + asn_DEF_GPSWeek_tags_1, /* Same as above */ + sizeof(asn_DEF_GPSWeek_tags_1) / sizeof(asn_DEF_GPSWeek_tags_1[0]), /* 1 */ &ASN_PER_TYPE_GPS_WEEK_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GPSWeek.h b/src/core/libs/supl/asn-rrlp/GPSWeek.h index 033c63d2c..5268cd48a 100644 --- a/src/core/libs/supl/asn-rrlp/GPSWeek.h +++ b/src/core/libs/supl/asn-rrlp/GPSWeek.h @@ -7,7 +7,6 @@ #ifndef _GPSWeek_H_ #define _GPSWeek_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/GSMTime.c b/src/core/libs/supl/asn-rrlp/GSMTime.c index 42f5d67cf..9740fa47b 100644 --- a/src/core/libs/supl/asn-rrlp/GSMTime.c +++ b/src/core/libs/supl/asn-rrlp/GSMTime.c @@ -7,70 +7,53 @@ #include "GSMTime.h" static asn_TYPE_member_t asn_MBR_GSMTime_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bcchCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bcchCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bsic), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, - { ATF_NOFLAGS, 0, offsetof(struct GSMTime, frameNumber), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrameNumber, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "frameNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct GSMTime, timeSlot), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeSlot" - }, - { ATF_NOFLAGS, 0, offsetof(struct GSMTime, bitNumber), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BitNumber, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bitNumber" - }, + {ATF_NOFLAGS, 0, offsetof(struct GSMTime, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bcchCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct GSMTime, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, + {ATF_NOFLAGS, 0, offsetof(struct GSMTime, frameNumber), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrameNumber, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "frameNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct GSMTime, timeSlot), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlot, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeSlot"}, + {ATF_NOFLAGS, 0, offsetof(struct GSMTime, bitNumber), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BitNumber, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bitNumber"}, }; static ber_tlv_tag_t asn_DEF_GSMTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GSMTime_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 630 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 631 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* frameNumber at 632 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlot at 633 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* bitNumber at 635 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bcchCarrier at 630 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bsic at 631 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* frameNumber at 632 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* timeSlot at 633 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* bitNumber at 635 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GSMTime_specs_1 = { sizeof(struct GSMTime), offsetof(struct GSMTime, _asn_ctx), asn_MAP_GSMTime_tag2el_1, - 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GSMTime = { "GSMTime", @@ -84,16 +67,13 @@ asn_TYPE_descriptor_t asn_DEF_GSMTime = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GSMTime_tags_1, - sizeof(asn_DEF_GSMTime_tags_1) - /sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ - asn_DEF_GSMTime_tags_1, /* Same as above */ - sizeof(asn_DEF_GSMTime_tags_1) - /sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GSMTime_tags_1) / sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ + asn_DEF_GSMTime_tags_1, /* Same as above */ + sizeof(asn_DEF_GSMTime_tags_1) / sizeof(asn_DEF_GSMTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GSMTime_1, - 5, /* Elements count */ - &asn_SPC_GSMTime_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_GSMTime_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/GSMTime.h b/src/core/libs/supl/asn-rrlp/GSMTime.h index a1aa8d6b0..377c497e7 100644 --- a/src/core/libs/supl/asn-rrlp/GSMTime.h +++ b/src/core/libs/supl/asn-rrlp/GSMTime.h @@ -7,7 +7,6 @@ #ifndef _GSMTime_H_ #define _GSMTime_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/INTEGER.c b/src/core/libs/supl/asn-rrlp/INTEGER.c index cddffd8aa..67777b094 100644 --- a/src/core/libs/supl/asn-rrlp/INTEGER.c +++ b/src/core/libs/supl/asn-rrlp/INTEGER.c @@ -5,7 +5,7 @@ */ #include #include -#include /* Encoder and decoder of a primitive type */ +#include /* Encoder and decoder of a primitive type */ #include #include @@ -13,8 +13,7 @@ * INTEGER basic type description. */ static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_INTEGER = { "INTEGER", "INTEGER", @@ -25,86 +24,93 @@ asn_TYPE_descriptor_t asn_DEF_INTEGER = { INTEGER_encode_der, INTEGER_decode_xer, INTEGER_encode_xer, - INTEGER_decode_uper, /* Unaligned PER decoder */ - INTEGER_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + INTEGER_decode_uper, /* Unaligned PER decoder */ + INTEGER_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_INTEGER_tags, sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), - asn_DEF_INTEGER_tags, /* Same as above */ + asn_DEF_INTEGER_tags, /* Same as above */ sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Encode INTEGER type using DER. */ -asn_enc_rval_t -INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ INTEGER_t *st = (INTEGER_t *)sptr; - ASN_DEBUG("%s %s as INTEGER (tm=%d)", - cb?"Encoding":"Estimating", td->name, tag_mode); + ASN_DEBUG("%s %s as INTEGER (tm=%d)", cb ? "Encoding" : "Estimating", + td->name, tag_mode); /* * Canonicalize integer in the buffer. * (Remove too long sign extension, remove some first 0x00 bytes) */ - if(st->buf) { - uint8_t *buf = st->buf; - uint8_t *end1 = buf + st->size - 1; - int shift; + if (st->buf) + { + uint8_t *buf = st->buf; + uint8_t *end1 = buf + st->size - 1; + int shift; - /* Compute the number of superfluous leading bytes */ - for(; buf < end1; buf++) { - /* - * If the contents octets of an integer value encoding - * consist of more than one octet, then the bits of the - * first octet and bit 8 of the second octet: - * a) shall not all be ones; and - * b) shall not all be zero. - */ - switch(*buf) { - case 0x00: if((buf[1] & 0x80) == 0) - continue; - break; - case 0xff: if((buf[1] & 0x80)) - continue; - break; - } - break; - } + /* Compute the number of superfluous leading bytes */ + for (; buf < end1; buf++) + { + /* + * If the contents octets of an integer value encoding + * consist of more than one octet, then the bits of the + * first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + switch (*buf) + { + case 0x00: + if ((buf[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((buf[1] & 0x80)) continue; + break; + } + break; + } - /* Remove leading superfluous bytes from the integer */ - shift = buf - st->buf; - if(shift) { - uint8_t *nb = st->buf; - uint8_t *end; + /* Remove leading superfluous bytes from the integer */ + shift = buf - st->buf; + if (shift) + { + uint8_t *nb = st->buf; + uint8_t *end; - st->size -= shift; /* New size, minus bad bytes */ - end = nb + st->size; + st->size -= shift; /* New size, minus bad bytes */ + end = nb + st->size; - for(; nb < end; nb++, buf++) - *nb = *buf; - } + for (; nb < end; nb++, buf++) *nb = *buf; + } - } /* if(1) */ + } /* if(1) */ return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); } -static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value( + asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); /* * INTEGER specific human-readable output. */ -static ssize_t -INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - char scratch[32]; /* Enough for 64-bit integer */ +static ssize_t INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, + asn_app_consume_bytes_f *cb, void *app_key, + int plainOrXER) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit integer */ uint8_t *buf = st->buf; uint8_t *buf_end = st->buf + st->size; int64_t accum; @@ -119,80 +125,99 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by * (0x0000000000abcdef would yield a fine 0x00abcdef) */ /* Skip the insignificant leading bytes */ - for(; buf < buf_end-1; buf++) { - switch(*buf) { - case 0x00: if((buf[1] & 0x80) == 0) continue; break; - case 0xff: if((buf[1] & 0x80) != 0) continue; break; + for (; buf < buf_end - 1; buf++) + { + switch (*buf) + { + case 0x00: + if ((buf[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((buf[1] & 0x80) != 0) continue; + break; + } + break; } - break; - } /* Simple case: the integer size is small */ - if((size_t)(buf_end - buf) <= sizeof(accum)) { - const asn_INTEGER_enum_map_t *el; - size_t scrsize; - char *scr; + if ((size_t)(buf_end - buf) <= sizeof(accum)) + { + const asn_INTEGER_enum_map_t *el; + size_t scrsize; + char *scr; - if(buf == buf_end) { - accum = 0LL; - } else { - accum = (*buf & 0x80) ? -1LL : 0LL; - for(; buf < buf_end; buf++) - accum = (accum * 256) | *buf; - } - - el = INTEGER_map_value2enum(specs, accum); - if(el) { - scrsize = el->enum_len + 32; - scr = (char *)alloca(scrsize); - if(plainOrXER == 0) - ret = snprintf(scr, scrsize, - "%+"PRId64"(%s)", accum, el->enum_name); + if (buf == buf_end) + { + accum = 0LL; + } else - ret = snprintf(scr, scrsize, - "<%s/>", el->enum_name); - } else if(plainOrXER && specs && specs->strict_enumeration) { - ASN_DEBUG("ASN.1 forbids dealing with " + { + accum = (*buf & 0x80) ? -1LL : 0LL; + for (; buf < buf_end; buf++) accum = (accum * 256) | *buf; + } + + el = INTEGER_map_value2enum(specs, accum); + if (el) + { + scrsize = el->enum_len + 32; + scr = (char *)alloca(scrsize); + if (plainOrXER == 0) + ret = snprintf(scr, scrsize, "%+" PRId64 "(%s)", accum, + el->enum_name); + else + ret = snprintf(scr, scrsize, "<%s/>", el->enum_name); + } + else if (plainOrXER && specs && specs->strict_enumeration) + { + ASN_DEBUG( + "ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } + else + { + scrsize = sizeof(scratch); + scr = scratch; + ret = + snprintf(scr, scrsize, + (specs && specs->field_unsigned) ? "%" PRIu64 + : "%+" PRId64, + accum); + } + assert(ret > 0 && (size_t)ret < scrsize); + return (cb(scr, ret, app_key) < 0) ? -1 : ret; + } + else if (plainOrXER && specs && specs->strict_enumeration) + { + /* + * Here and earlier, we cannot encode the ENUMERATED values + * if there is no corresponding identifier. + */ + ASN_DEBUG( + "ASN.1 forbids dealing with " "unknown value of ENUMERATED type"); errno = EPERM; return -1; - } else { - scrsize = sizeof(scratch); - scr = scratch; - ret = snprintf(scr, scrsize, - (specs && specs->field_unsigned) - ?"%"PRIu64:"%+"PRId64, accum); } - assert(ret > 0 && (size_t)ret < scrsize); - return (cb(scr, ret, app_key) < 0) ? -1 : ret; - } else if(plainOrXER && specs && specs->strict_enumeration) { - /* - * Here and earlier, we cannot encode the ENUMERATED values - * if there is no corresponding identifier. - */ - ASN_DEBUG("ASN.1 forbids dealing with " - "unknown value of ENUMERATED type"); - errno = EPERM; - return -1; - } /* Output in the long xx:yy:zz... format */ /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ - for(p = scratch; buf < buf_end; buf++) { - static const char *h2c = "0123456789ABCDEF"; - if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { - /* Flush buffer */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - wrote += p - scratch; - p = scratch; + for (p = scratch; buf < buf_end; buf++) + { + static const char *h2c = "0123456789ABCDEF"; + if ((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) + { + /* Flush buffer */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + wrote += p - scratch; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x3a; /* ":" */ } - *p++ = h2c[*buf >> 4]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x3a; /* ":" */ - } - if(p != scratch) - p--; /* Remove the last ":" */ + if (p != scratch) p--; /* Remove the last ":" */ wrote += p - scratch; return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; @@ -201,16 +226,16 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by /* * INTEGER specific human-readable output. */ -int -INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ const INTEGER_t *st = (const INTEGER_t *)sptr; ssize_t ret; (void)td; (void)ilevel; - if(!st || !st->buf) + if (!st || !st->buf) ret = cb("", 8, app_key); else ret = INTEGER__dump(td, st, cb, app_key, 0); @@ -218,14 +243,15 @@ INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, return (ret < 0) ? -1 : 0; } -struct e2v_key { +struct e2v_key +{ const char *start; const char *stop; asn_INTEGER_enum_map_t *vemap; unsigned int *evmap; }; -static int -INTEGER__compar_enum2value(const void *kp, const void *am) { +static int INTEGER__compar_enum2value(const void *kp, const void *am) +{ const struct e2v_key *key = (const struct e2v_key *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; const char *ptr; @@ -236,98 +262,120 @@ INTEGER__compar_enum2value(const void *kp, const void *am) { el = key->vemap + key->evmap[el - key->vemap]; /* Compare strings */ - for(ptr = key->start, end = key->stop, name = el->enum_name; - ptr < end; ptr++, name++) { - if(*ptr != *name) - return *(const unsigned char *)ptr - - *(const unsigned char *)name; - } + for (ptr = key->start, end = key->stop, name = el->enum_name; ptr < end; + ptr++, name++) + { + if (*ptr != *name) + return *(const unsigned char *)ptr - + *(const unsigned char *)name; + } return name[0] ? -1 : 0; } -static const asn_INTEGER_enum_map_t * -INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value( + asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) +{ asn_INTEGER_enum_map_t *el_found; int count = specs ? specs->map_count : 0; struct e2v_key key; const char *lp; - if(!count) return NULL; + if (!count) return NULL; /* Guaranteed: assert(lstart < lstop); */ /* Figure out the tag name */ - for(lstart++, lp = lstart; lp < lstop; lp++) { - switch(*lp) { - case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ - case 0x2f: /* '/' */ case 0x3e: /* '>' */ + for (lstart++, lp = lstart; lp < lstop; lp++) + { + switch (*lp) + { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: /* WSP */ + case 0x2f: /* '/' */ + case 0x3e: /* '>' */ + break; + default: + continue; + } break; - default: - continue; } - break; - } - if(lp == lstop) return NULL; /* No tag found */ + if (lp == lstop) return NULL; /* No tag found */ lstop = lp; key.start = lstart; key.stop = lstop; key.vemap = specs->value2enum; key.evmap = specs->enum2value; - el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, - specs->value2enum, count, sizeof(specs->value2enum[0]), - INTEGER__compar_enum2value); - if(el_found) { - /* Remap enum2value into value2enum */ - el_found = key.vemap + key.evmap[el_found - key.vemap]; - } + el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, specs->value2enum, count, + sizeof(specs->value2enum[0]), + INTEGER__compar_enum2value); + if (el_found) + { + /* Remap enum2value into value2enum */ + el_found = key.vemap + key.evmap[el_found - key.vemap]; + } return el_found; } -static int -INTEGER__compar_value2enum(const void *kp, const void *am) { +static int INTEGER__compar_value2enum(const void *kp, const void *am) +{ int64_t a = *(const int64_t *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; int64_t b = el->nat_value; - if(a < b) return -1; - else if(a == b) return 0; - else return 1; -} - -const asn_INTEGER_enum_map_t * -INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value) { - int count = specs ? specs->map_count : 0; - if(!count) return 0; - return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, - count, sizeof(specs->value2enum[0]), - INTEGER__compar_value2enum); -} - -static int -INTEGER_st_prealloc(INTEGER_t *st, int min_size) { - void *p = MALLOC(min_size + 1); - if(p) { - void *b = st->buf; - st->size = 0; - st->buf = p; - FREEMEM(b); - return 0; - } else { + if (a < b) return -1; - } + else if (a == b) + return 0; + else + return 1; +} + +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum( + asn_INTEGER_specifics_t *specs, int64_t value) +{ + int count = specs ? specs->map_count : 0; + if (!count) return 0; + return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, count, + sizeof(specs->value2enum[0]), + INTEGER__compar_value2enum); +} + +static int INTEGER_st_prealloc(INTEGER_t *st, int min_size) +{ + void *p = MALLOC(min_size + 1); + if (p) + { + void *b = st->buf; + st->size = 0; + st->buf = p; + FREEMEM(b); + return 0; + } + else + { + return -1; + } } /* * Decode the chunk of XML text encoding INTEGER. */ -static enum xer_pbd_rval -INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { +static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, + void *sptr, + const void *chunk_buf, + size_t chunk_size) +{ INTEGER_t *st = (INTEGER_t *)sptr; int64_t sign = 1; int64_t value; const char *lp; const char *lstart = (const char *)chunk_buf; const char *lstop = lstart + chunk_size; - enum { + enum + { ST_SKIPSPACE, ST_SKIPSPHEX, ST_WAITDIGITS, @@ -338,334 +386,394 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ST_EXTRASTUFF } state = ST_SKIPSPACE; - if(chunk_size) - ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", - (int64_t)chunk_size, *lstart, lstop[-1]); + if (chunk_size) + ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", (int64_t)chunk_size, *lstart, + lstop[-1]); /* * We may have received a tag here. It will be processed inline. * Use strtoul()-like code and serialize the result. */ - for(value = 0, lp = lstart; lp < lstop; lp++) { - int lv = *lp; - switch(lv) { - case 0x09: case 0x0a: case 0x0d: case 0x20: - switch(state) { - case ST_SKIPSPACE: - case ST_SKIPSPHEX: - continue; - case ST_HEXCOLON: - if(xer_is_whitespace(lp, lstop - lp)) { - lp = lstop - 1; - continue; + for (value = 0, lp = lstart; lp < lstop; lp++) + { + int lv = *lp; + switch (lv) + { + case 0x09: + case 0x0a: + case 0x0d: + case 0x20: + switch (state) + { + case ST_SKIPSPACE: + case ST_SKIPSPHEX: + continue; + case ST_HEXCOLON: + if (xer_is_whitespace(lp, lstop - lp)) + { + lp = lstop - 1; + continue; + } + break; + default: + break; + } + break; + case 0x2d: /* '-' */ + if (state == ST_SKIPSPACE) + { + sign = -1; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x2b: /* '+' */ + if (state == ST_SKIPSPACE) + { + state = ST_WAITDIGITS; + continue; + } + break; + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + switch (state) + { + case ST_DIGITS: + break; + case ST_SKIPSPHEX: /* Fall through */ + case ST_HEXDIGIT1: + value = (lv - 0x30) << 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += (lv - 0x30); + state = ST_HEXCOLON; + st->buf[st->size++] = (uint8_t)value; + continue; + case ST_HEXCOLON: + return XPBD_BROKEN_ENCODING; + default: + state = ST_DIGITS; + break; + } + + { + int64_t new_value = value * 10; + + if (new_value / 10 != value) /* Overflow */ + return XPBD_DECODER_LIMIT; + + value = new_value + (lv - 0x30); + /* Check for two's complement overflow */ + if (value < 0) + { + /* Check whether it is a LONG_MIN */ + if (sign == -1 && + (uint64_t)value == ~((uint64_t)-1 >> 1)) + { + sign = 1; + } + else + { + /* Overflow */ + return XPBD_DECODER_LIMIT; + } + } + } + continue; + case 0x3c: /* '<' */ + if (state == ST_SKIPSPACE) + { + const asn_INTEGER_enum_map_t *el; + el = INTEGER_map_enum2value( + (asn_INTEGER_specifics_t *)td->specifics, + lstart, lstop); + if (el) + { + ASN_DEBUG("Found \"%s\" => %ld", + el->enum_name, el->nat_value); + state = ST_DIGITS; + value = el->nat_value; + lp = lstop - 1; + continue; + } + ASN_DEBUG("Unknown identifier for INTEGER"); + } + return XPBD_BROKEN_ENCODING; + case 0x3a: /* ':' */ + if (state == ST_HEXCOLON) + { + /* This colon is expected */ + state = ST_HEXDIGIT1; + continue; + } + else if (state == ST_DIGITS) + { + /* The colon here means that we have + * decoded the first two hexadecimal + * places as a decimal value. + * Switch decoding mode. */ + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if (INTEGER_st_prealloc(st, + (chunk_size / 3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + } + else + { + ASN_DEBUG("state %d at %d", state, lp - lstart); + break; + } + /* [A-Fa-f] */ + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x45: + case 0x46: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + switch (state) + { + case ST_SKIPSPHEX: + case ST_SKIPSPACE: /* Fall through */ + case ST_HEXDIGIT1: + value = lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + value <<= 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + st->buf[st->size++] = (uint8_t)value; + state = ST_HEXCOLON; + continue; + case ST_DIGITS: + ASN_DEBUG( + "INTEGER re-evaluate as hex form"); + if (INTEGER_st_prealloc( + st, (chunk_size / 3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + default: + break; + } + break; } + + /* Found extra non-numeric stuff */ + ASN_DEBUG("Found non-numeric 0x%2x at %d", lv, lp - lstart); + state = ST_EXTRASTUFF; + break; + } + + switch (state) + { + case ST_DIGITS: + /* Everything is cool */ break; - default: - break; - } - break; - case 0x2d: /* '-' */ - if(state == ST_SKIPSPACE) { - sign = -1; - state = ST_WAITDIGITS; - continue; - } - break; - case 0x2b: /* '+' */ - if(state == ST_SKIPSPACE) { - state = ST_WAITDIGITS; - continue; - } - break; - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - switch(state) { - case ST_DIGITS: break; - case ST_SKIPSPHEX: /* Fall through */ - case ST_HEXDIGIT1: - value = (lv - 0x30) << 4; - state = ST_HEXDIGIT2; - continue; - case ST_HEXDIGIT2: - value += (lv - 0x30); - state = ST_HEXCOLON; - st->buf[st->size++] = (uint8_t)value; - continue; case ST_HEXCOLON: + st->buf[st->size] = 0; /* Just in case termination */ + return XPBD_BODY_CONSUMED; + case ST_HEXDIGIT1: + case ST_HEXDIGIT2: + case ST_SKIPSPHEX: return XPBD_BROKEN_ENCODING; default: - state = ST_DIGITS; + if (xer_is_whitespace(lp, lstop - lp)) + { + if (state != ST_EXTRASTUFF) return XPBD_NOT_BODY_IGNORE; + break; + } + else + { + ASN_DEBUG("INTEGER: No useful digits (state %d)", + state); + return XPBD_BROKEN_ENCODING; /* No digits */ + } break; - } - - { - int64_t new_value = value * 10; - - if(new_value / 10 != value) - /* Overflow */ - return XPBD_DECODER_LIMIT; - - value = new_value + (lv - 0x30); - /* Check for two's complement overflow */ - if(value < 0) { - /* Check whether it is a LONG_MIN */ - if(sign == -1 - && (uint64_t)value - == ~((uint64_t)-1 >> 1)) { - sign = 1; - } else { - /* Overflow */ - return XPBD_DECODER_LIMIT; - } - } - } - continue; - case 0x3c: /* '<' */ - if(state == ST_SKIPSPACE) { - const asn_INTEGER_enum_map_t *el; - el = INTEGER_map_enum2value( - (asn_INTEGER_specifics_t *) - td->specifics, lstart, lstop); - if(el) { - ASN_DEBUG("Found \"%s\" => %ld", - el->enum_name, el->nat_value); - state = ST_DIGITS; - value = el->nat_value; - lp = lstop - 1; - continue; - } - ASN_DEBUG("Unknown identifier for INTEGER"); - } - return XPBD_BROKEN_ENCODING; - case 0x3a: /* ':' */ - if(state == ST_HEXCOLON) { - /* This colon is expected */ - state = ST_HEXDIGIT1; - continue; - } else if(state == ST_DIGITS) { - /* The colon here means that we have - * decoded the first two hexadecimal - * places as a decimal value. - * Switch decoding mode. */ - ASN_DEBUG("INTEGER re-evaluate as hex form"); - if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) - return XPBD_SYSTEM_FAILURE; - state = ST_SKIPSPHEX; - lp = lstart - 1; - continue; - } else { - ASN_DEBUG("state %d at %d", state, lp - lstart); - break; - } - /* [A-Fa-f] */ - case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: - case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: - switch(state) { - case ST_SKIPSPHEX: - case ST_SKIPSPACE: /* Fall through */ - case ST_HEXDIGIT1: - value = lv - ((lv < 0x61) ? 0x41 : 0x61); - value += 10; - value <<= 4; - state = ST_HEXDIGIT2; - continue; - case ST_HEXDIGIT2: - value += lv - ((lv < 0x61) ? 0x41 : 0x61); - value += 10; - st->buf[st->size++] = (uint8_t)value; - state = ST_HEXCOLON; - continue; - case ST_DIGITS: - ASN_DEBUG("INTEGER re-evaluate as hex form"); - if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) - return XPBD_SYSTEM_FAILURE; - state = ST_SKIPSPHEX; - lp = lstart - 1; - continue; - default: - break; - } - break; } - /* Found extra non-numeric stuff */ - ASN_DEBUG("Found non-numeric 0x%2x at %d", - lv, lp - lstart); - state = ST_EXTRASTUFF; - break; - } + value *= sign; /* Change sign, if needed */ - switch(state) { - case ST_DIGITS: - /* Everything is cool */ - break; - case ST_HEXCOLON: - st->buf[st->size] = 0; /* Just in case termination */ - return XPBD_BODY_CONSUMED; - case ST_HEXDIGIT1: - case ST_HEXDIGIT2: - case ST_SKIPSPHEX: - return XPBD_BROKEN_ENCODING; - default: - if(xer_is_whitespace(lp, lstop - lp)) { - if(state != ST_EXTRASTUFF) - return XPBD_NOT_BODY_IGNORE; - break; - } else { - ASN_DEBUG("INTEGER: No useful digits (state %d)", - state); - return XPBD_BROKEN_ENCODING; /* No digits */ - } - break; - } - - value *= sign; /* Change sign, if needed */ - - if(asn_long2INTEGER(st, value)) - return XPBD_SYSTEM_FAILURE; + if (asn_long2INTEGER(st, value)) return XPBD_SYSTEM_FAILURE; return XPBD_BODY_CONSUMED; } -asn_dec_rval_t -INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(INTEGER_t), opt_mname, - buf_ptr, size, INTEGER__xer_body_decode); +asn_dec_rval_t INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ + return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(INTEGER_t), + opt_mname, buf_ptr, size, + INTEGER__xer_body_decode); } -asn_enc_rval_t -INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ const INTEGER_t *st = (const INTEGER_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; - if(!st || !st->buf) - _ASN_ENCODE_FAILED; + if (!st || !st->buf) _ASN_ENCODE_FAILED; er.encoded = INTEGER__dump(td, st, cb, app_key, 1); - if(er.encoded < 0) _ASN_ENCODE_FAILED; + if (er.encoded < 0) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } -asn_dec_rval_t -INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - asn_dec_rval_t rval = { RC_OK, 0 }; +asn_dec_rval_t INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = {RC_OK, 0}; INTEGER_t *st = (INTEGER_t *)*sptr; asn_per_constraint_t *ct; int repeat; (void)opt_codec_ctx; - if(!st) { - st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } - if(!constraints) constraints = td->per_constraints; + if (!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) _ASN_DECODE_STARVED; - if(inext) ct = 0; - } + if (ct && ct->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) _ASN_DECODE_STARVED; + if (inext) ct = 0; + } FREEMEM(st->buf); st->buf = 0; st->size = 0; - if(ct) { - if(ct->flags & APC_SEMI_CONSTRAINED) { - st->buf = (uint8_t *)CALLOC(1, 2); - if(!st->buf) _ASN_DECODE_FAILED; - st->size = 1; - } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { - size_t size = (ct->range_bits + 7) >> 3; - st->buf = (uint8_t *)MALLOC(1 + size + 1); - if(!st->buf) _ASN_DECODE_FAILED; - st->size = size; + if (ct) + { + if (ct->flags & APC_SEMI_CONSTRAINED) + { + st->buf = (uint8_t *)CALLOC(1, 2); + if (!st->buf) _ASN_DECODE_FAILED; + st->size = 1; + } + else if (ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) + { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if (!st->buf) _ASN_DECODE_FAILED; + st->size = size; + } } - } /* X.691, #12.2.2 */ - if(ct && ct->flags != APC_UNCONSTRAINED) { - /* #10.5.6 */ - ASN_DEBUG("Integer with range %d bits", ct->range_bits); - if(ct->range_bits >= 0) { - int64_t value; - if(ct->range_bits == 32) { - int64_t lhalf; - value = per_get_few_bits(pd, 16); - if(value < 0) _ASN_DECODE_STARVED; - lhalf = per_get_few_bits(pd, 16); - if(lhalf < 0) _ASN_DECODE_STARVED; - value = (value << 16) | lhalf; - } else { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - } - ASN_DEBUG("Got value %ld + low %ld", - value, ct->lower_bound); - value += ct->lower_bound; - if((specs && specs->field_unsigned) - ? asn_ulong2INTEGER(st, value) - : asn_long2INTEGER(st, value)) - _ASN_DECODE_FAILED; - return rval; + if (ct && ct->flags != APC_UNCONSTRAINED) + { + /* #10.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if (ct->range_bits >= 0) + { + int64_t value; + if (ct->range_bits == 32) + { + int64_t lhalf; + value = per_get_few_bits(pd, 16); + if (value < 0) _ASN_DECODE_STARVED; + lhalf = per_get_few_bits(pd, 16); + if (lhalf < 0) _ASN_DECODE_STARVED; + value = (value << 16) | lhalf; + } + else + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + } + ASN_DEBUG("Got value %ld + low %ld", value, + ct->lower_bound); + value += ct->lower_bound; + if ((specs && specs->field_unsigned) + ? asn_ulong2INTEGER(st, value) + : asn_long2INTEGER(st, value)) + _ASN_DECODE_FAILED; + return rval; + } + } + else + { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); } - } else { - ASN_DEBUG("Decoding unconstrained integer %s", td->name); - } /* X.691, #12.2.3, #12.2.4 */ - do { - ssize_t len; - void *p; - int ret; + do + { + ssize_t len; + void *p; + int ret; - /* Get the PER length */ - len = uper_get_length(pd, -1, &repeat); - if(len < 0) _ASN_DECODE_STARVED; + /* Get the PER length */ + len = uper_get_length(pd, -1, &repeat); + if (len < 0) _ASN_DECODE_STARVED; - p = REALLOC(st->buf, st->size + len + 1); - if(!p) _ASN_DECODE_FAILED; - st->buf = (uint8_t *)p; + p = REALLOC(st->buf, st->size + len + 1); + if (!p) _ASN_DECODE_FAILED; + st->buf = (uint8_t *)p; - ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); - if(ret < 0) _ASN_DECODE_STARVED; - st->size += len; - } while(repeat); - st->buf[st->size] = 0; /* JIC */ + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if (ret < 0) _ASN_DECODE_STARVED; + st->size += len; + } + while (repeat); + st->buf[st->size] = 0; /* JIC */ /* #12.2.3 */ - if(ct && ct->lower_bound) { - /* - * TODO: replace by in-place arithmetics. - */ - int64_t value; - if(asn_INTEGER2long(st, &value)) - _ASN_DECODE_FAILED; - if(asn_long2INTEGER(st, value + ct->lower_bound)) - _ASN_DECODE_FAILED; - } + if (ct && ct->lower_bound) + { + /* + * TODO: replace by in-place arithmetics. + */ + int64_t value; + if (asn_INTEGER2long(st, &value)) _ASN_DECODE_FAILED; + if (asn_long2INTEGER(st, value + ct->lower_bound)) + _ASN_DECODE_FAILED; + } return rval; } -asn_enc_rval_t -INTEGER_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_enc_rval_t INTEGER_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; INTEGER_t *st = (INTEGER_t *)sptr; const uint8_t *buf; @@ -673,243 +781,268 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraint_t *ct; int64_t value = 0; - if(!st || st->size == 0) _ASN_ENCODE_FAILED; + if (!st || st->size == 0) _ASN_ENCODE_FAILED; - if(!constraints) constraints = td->per_constraints; + if (!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; er.encoded = 0; - if(ct) { - int inext = 0; - if(specs && specs->field_unsigned) { - uint64_t uval; - if(asn_INTEGER2ulong(st, &uval)) - _ASN_ENCODE_FAILED; - /* Check proper range */ - if(ct->flags & APC_SEMI_CONSTRAINED) { - if(uval < (uint64_t)ct->lower_bound) - inext = 1; - } else if(ct->range_bits >= 0) { - if(uval < (uint64_t)ct->lower_bound - || uval > (uint64_t)ct->upper_bound) - inext = 1; - } - ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", - uval, st->buf[0], st->size, - ct->lower_bound, ct->upper_bound, - inext ? "ext" : "fix"); - value = uval; - } else { - if(asn_INTEGER2long(st, &value)) - _ASN_ENCODE_FAILED; - /* Check proper range */ - if(ct->flags & APC_SEMI_CONSTRAINED) { - if(value < ct->lower_bound) - inext = 1; - } else if(ct->range_bits >= 0) { - if(value < ct->lower_bound - || value > ct->upper_bound) - inext = 1; - } - ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", - value, st->buf[0], st->size, - ct->lower_bound, ct->upper_bound, - inext ? "ext" : "fix"); + if (ct) + { + int inext = 0; + if (specs && specs->field_unsigned) + { + uint64_t uval; + if (asn_INTEGER2ulong(st, &uval)) _ASN_ENCODE_FAILED; + /* Check proper range */ + if (ct->flags & APC_SEMI_CONSTRAINED) + { + if (uval < (uint64_t)ct->lower_bound) inext = 1; + } + else if (ct->range_bits >= 0) + { + if (uval < (uint64_t)ct->lower_bound || + uval > (uint64_t)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", uval, + st->buf[0], st->size, ct->lower_bound, + ct->upper_bound, inext ? "ext" : "fix"); + value = uval; + } + else + { + if (asn_INTEGER2long(st, &value)) _ASN_ENCODE_FAILED; + /* Check proper range */ + if (ct->flags & APC_SEMI_CONSTRAINED) + { + if (value < ct->lower_bound) inext = 1; + } + else if (ct->range_bits >= 0) + { + if (value < ct->lower_bound || + value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", value, + st->buf[0], st->size, ct->lower_bound, + ct->upper_bound, inext ? "ext" : "fix"); + } + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + if (inext) ct = 0; + } + else if (inext) + { + _ASN_ENCODE_FAILED; + } } - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, inext, 1)) - _ASN_ENCODE_FAILED; - if(inext) ct = 0; - } else if(inext) { - _ASN_ENCODE_FAILED; - } - } - /* X.691, #12.2.2 */ - if(ct && ct->range_bits >= 0) { - /* #10.5.6 */ - ASN_DEBUG("Encoding integer with range %d bits", - ct->range_bits); - if(ct->range_bits == 32) { - /* TODO: extend to >32 bits */ - int64_t v = value - ct->lower_bound; - if(per_put_few_bits(po, v >> 1, 31) - || per_put_few_bits(po, v, 1)) - _ASN_ENCODE_FAILED; - } else { - if(per_put_few_bits(po, value - ct->lower_bound, - ct->range_bits)) - _ASN_ENCODE_FAILED; + if (ct && ct->range_bits >= 0) + { + /* #10.5.6 */ + ASN_DEBUG("Encoding integer with range %d bits", ct->range_bits); + if (ct->range_bits == 32) + { + /* TODO: extend to >32 bits */ + int64_t v = value - ct->lower_bound; + if (per_put_few_bits(po, v >> 1, 31) || + per_put_few_bits(po, v, 1)) + _ASN_ENCODE_FAILED; + } + else + { + if (per_put_few_bits(po, value - ct->lower_bound, + ct->range_bits)) + _ASN_ENCODE_FAILED; + } + _ASN_ENCODED_OK(er); } - _ASN_ENCODED_OK(er); - } - if(ct && ct->lower_bound) { - ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); - /* TODO: adjust lower bound */ - _ASN_ENCODE_FAILED; - } + if (ct && ct->lower_bound) + { + ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + /* TODO: adjust lower bound */ + _ASN_ENCODE_FAILED; + } - for(buf = st->buf, end = st->buf + st->size; buf < end;) { - ssize_t mayEncode = uper_put_length(po, end - buf); - if(mayEncode < 0) - _ASN_ENCODE_FAILED; - if(per_put_many_bits(po, buf, 8 * mayEncode)) - _ASN_ENCODE_FAILED; - buf += mayEncode; - } + for (buf = st->buf, end = st->buf + st->size; buf < end;) + { + ssize_t mayEncode = uper_put_length(po, end - buf); + if (mayEncode < 0) _ASN_ENCODE_FAILED; + if (per_put_many_bits(po, buf, 8 * mayEncode)) _ASN_ENCODE_FAILED; + buf += mayEncode; + } _ASN_ENCODED_OK(er); } -int -asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) { +int asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) +{ uint8_t *b; uint8_t *end; size_t size; int64_t l; /* Sanity checking */ - if(!iptr || !iptr->buf || !lptr) { - errno = EINVAL; - return -1; - } - - /* Cache the begin/end of the buffer */ - b = iptr->buf; /* Start of the INTEGER buffer */ - size = iptr->size; - end = b + size; /* Where to stop */ - - if(size > sizeof(int64_t)) { - uint8_t *end1 = end - 1; - /* - * Slightly more advanced processing, - * able to >sizeof(long) bytes, - * when the actual value is small - * (0x0000000000abcdef would yield a fine 0x00abcdef) - */ - /* Skip out the insignificant leading bytes */ - for(; b < end1; b++) { - switch(*b) { - case 0x00: if((b[1] & 0x80) == 0) continue; break; - case 0xff: if((b[1] & 0x80) != 0) continue; break; - } - break; - } - - size = end - b; - if(size > sizeof(int64_t)) { - /* Still cannot fit the long */ - errno = ERANGE; + if (!iptr || !iptr->buf || !lptr) + { + errno = EINVAL; return -1; } - } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if (size > sizeof(int64_t)) + { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(long) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for (; b < end1; b++) + { + switch (*b) + { + case 0x00: + if ((b[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((b[1] & 0x80) != 0) continue; + break; + } + break; + } + + size = end - b; + if (size > sizeof(int64_t)) + { + /* Still cannot fit the long */ + errno = ERANGE; + return -1; + } + } /* Shortcut processing of a corner case */ - if(end == b) { - *lptr = 0; - return 0; - } + if (end == b) + { + *lptr = 0; + return 0; + } /* Perform the sign initialization */ /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ - if((*b >> 7)) l = -1; else l = 0; + if ((*b >> 7)) + l = -1; + else + l = 0; /* Conversion engine */ - for(; b < end; b++) - l = (l * 256) | *b; + for (; b < end; b++) l = (l * 256) | *b; *lptr = l; return 0; } -int -asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) { +int asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) +{ uint8_t *b; uint8_t *end; uint64_t l; size_t size; - if(!iptr || !iptr->buf || !lptr) { - errno = EINVAL; - return -1; - } + if (!iptr || !iptr->buf || !lptr) + { + errno = EINVAL; + return -1; + } b = iptr->buf; size = iptr->size; end = b + size; /* If all extra leading bytes are zeroes, ignore them */ - for(; size > sizeof(uint64_t); b++, size--) { - if(*b) { - /* Value won't fit uint64_t */ - errno = ERANGE; - return -1; + for (; size > sizeof(uint64_t); b++, size--) + { + if (*b) + { + /* Value won't fit uint64_t */ + errno = ERANGE; + return -1; + } } - } /* Conversion engine */ - for(l = 0; b < end; b++) - l = (l << 8) | *b; + for (l = 0; b < end; b++) l = (l << 8) | *b; *lptr = l; return 0; } -int -asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) { +int asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) +{ uint8_t *buf; uint8_t *end; uint8_t *b; int shr; - if(value <= LONG_MAX) - return asn_long2INTEGER(st, value); + if (value <= LONG_MAX) return asn_long2INTEGER(st, value); buf = (uint8_t *)MALLOC(1 + sizeof(value)); - if(!buf) return -1; + if (!buf) return -1; end = buf + (sizeof(value) + 1); buf[0] = 0; - for(b = buf + 1, shr = (sizeof(int64_t)-1)*8; b < end; shr -= 8, b++) + for (b = buf + 1, shr = (sizeof(int64_t) - 1) * 8; b < end; shr -= 8, b++) *b = (uint8_t)(value >> shr); - if(st->buf) FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); st->buf = buf; st->size = 1 + sizeof(value); return 0; } -int -asn_long2INTEGER(INTEGER_t *st, int64_t value) { +int asn_long2INTEGER(INTEGER_t *st, int64_t value) +{ uint8_t *buf; uint8_t *bp; uint8_t *p; uint8_t *pstart; uint8_t *pend1; - int littleEndian = 1; /* Run-time detection */ + int littleEndian = 1; /* Run-time detection */ int add; - if(!st) { - errno = EINVAL; - return -1; - } + if (!st) + { + errno = EINVAL; + return -1; + } buf = (uint8_t *)MALLOC(8); - if(!buf) return -1; + if (!buf) return -1; - if(*(char *)&littleEndian) { - pstart = (uint8_t *)&value + sizeof(value) - 1; - pend1 = (uint8_t *)&value; - add = -1; - } else { - pstart = (uint8_t *)&value; - pend1 = pstart + sizeof(value) - 1; - add = 1; - } + if (*(char *)&littleEndian) + { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } + else + { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } /* * If the contents octet consists of more than one octet, @@ -917,22 +1050,23 @@ asn_long2INTEGER(INTEGER_t *st, int64_t value) { * a) shall not all be ones; and * b) shall not all be zero. */ - for(p = pstart; p != pend1; p += add) { - switch(*p) { - case 0x00: if((*(p+add) & 0x80) == 0) - continue; - break; - case 0xff: if((*(p+add) & 0x80)) - continue; + for (p = pstart; p != pend1; p += add) + { + switch (*p) + { + case 0x00: + if ((*(p + add) & 0x80) == 0) continue; + break; + case 0xff: + if ((*(p + add) & 0x80)) continue; + break; + } break; } - break; - } /* Copy the integer body */ - for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) - *bp++ = *p; + for (pstart = p, bp = buf, pend1 += add; p != pend1; p += add) *bp++ = *p; - if(st->buf) FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); st->buf = buf; st->size = bp - buf; diff --git a/src/core/libs/supl/asn-rrlp/INTEGER.h b/src/core/libs/supl/asn-rrlp/INTEGER.h index 255e67eb7..e1802bd64 100644 --- a/src/core/libs/supl/asn-rrlp/INTEGER.h +++ b/src/core/libs/supl/asn-rrlp/INTEGER.h @@ -21,7 +21,7 @@ extern "C" /* Map with to integer value association */ typedef struct asn_INTEGER_enum_map_s { - int64_t nat_value; /* associated native integer value */ + int64_t nat_value; /* associated native integer value */ size_t enum_len; /* strlen("tag") */ const char *enum_name; /* "tag" */ } asn_INTEGER_enum_map_t; @@ -47,24 +47,25 @@ extern "C" per_type_encoder_f INTEGER_encode_uper; /*********************************** - * Some handy conversion routines. * - ***********************************/ + * Some handy conversion routines. * + ***********************************/ /* - * Returns 0 if it was possible to convert, -1 otherwise. - * -1/EINVAL: Mandatory argument missing - * -1/ERANGE: Value encoded is out of range for long representation - * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). - */ + * Returns 0 if it was possible to convert, -1 otherwise. + * -1/EINVAL: Mandatory argument missing + * -1/ERANGE: Value encoded is out of range for long representation + * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). + */ int asn_INTEGER2long(const INTEGER_t *i, int64_t *l); int asn_INTEGER2ulong(const INTEGER_t *i, uint64_t *l); int asn_long2INTEGER(INTEGER_t *i, int64_t l); int asn_ulong2INTEGER(INTEGER_t *i, uint64_t l); /* - * Convert the integer value into the corresponding enumeration map entry. - */ - const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value); + * Convert the integer value into the corresponding enumeration map entry. + */ + const asn_INTEGER_enum_map_t *INTEGER_map_value2enum( + asn_INTEGER_specifics_t *specs, int64_t value); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-rrlp/IonosphericModel.c b/src/core/libs/supl/asn-rrlp/IonosphericModel.c index 410ddc953..3ed4b9d73 100644 --- a/src/core/libs/supl/asn-rrlp/IonosphericModel.c +++ b/src/core/libs/supl/asn-rrlp/IonosphericModel.c @@ -6,341 +6,334 @@ #include "IonosphericModel.h" -static int -memb_alfa0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alfa0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_alfa1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alfa1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_alfa2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alfa2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_alfa3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_alfa3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_beta0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_beta0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_beta1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_beta1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_beta2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_beta2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_beta3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_beta3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_ALFA0_CONSTR_2 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALFA1_CONSTR_3 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALFA2_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALFA3_CONSTR_5 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BETA0_CONSTR_6 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BETA1_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BETA2_CONSTR_8 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BETA3_CONSTR_9 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_IonosphericModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa0), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alfa0_constraint_1, - &ASN_PER_MEMB_ALFA0_CONSTR_2, - 0, - "alfa0" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa1), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alfa1_constraint_1, - &ASN_PER_MEMB_ALFA1_CONSTR_3, - 0, - "alfa1" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa2), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alfa2_constraint_1, - &ASN_PER_MEMB_ALFA2_CONSTR_4, - 0, - "alfa2" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa3), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_alfa3_constraint_1, - &ASN_PER_MEMB_ALFA3_CONSTR_5, - 0, - "alfa3" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta0), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_beta0_constraint_1, - &ASN_PER_MEMB_BETA0_CONSTR_6, - 0, - "beta0" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta1), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_beta1_constraint_1, - &ASN_PER_MEMB_BETA1_CONSTR_7, - 0, - "beta1" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta2), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_beta2_constraint_1, - &ASN_PER_MEMB_BETA2_CONSTR_8, - 0, - "beta2" - }, - { ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta3), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_beta3_constraint_1, - &ASN_PER_MEMB_BETA3_CONSTR_9, - 0, - "beta3" - }, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa0), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alfa0_constraint_1, + &ASN_PER_MEMB_ALFA0_CONSTR_2, 0, "alfa0"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa1), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alfa1_constraint_1, + &ASN_PER_MEMB_ALFA1_CONSTR_3, 0, "alfa1"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa2), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alfa2_constraint_1, + &ASN_PER_MEMB_ALFA2_CONSTR_4, 0, "alfa2"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, alfa3), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_alfa3_constraint_1, + &ASN_PER_MEMB_ALFA3_CONSTR_5, 0, "alfa3"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta0), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_beta0_constraint_1, + &ASN_PER_MEMB_BETA0_CONSTR_6, 0, "beta0"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta1), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_beta1_constraint_1, + &ASN_PER_MEMB_BETA1_CONSTR_7, 0, "beta1"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_beta2_constraint_1, + &ASN_PER_MEMB_BETA2_CONSTR_8, 0, "beta2"}, + {ATF_NOFLAGS, 0, offsetof(struct IonosphericModel, beta3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_beta3_constraint_1, + &ASN_PER_MEMB_BETA3_CONSTR_9, 0, "beta3"}, }; static ber_tlv_tag_t asn_DEF_IonosphericModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_IonosphericModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* alfa0 at 763 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* alfa1 at 764 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* alfa2 at 765 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* alfa3 at 766 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* beta0 at 767 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* beta1 at 768 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* beta2 at 769 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* beta3 at 770 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* alfa0 at 763 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* alfa1 at 764 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* alfa2 at 765 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* alfa3 at 766 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* beta0 at 767 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* beta1 at 768 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* beta2 at 769 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0} /* beta3 at 770 */ }; static asn_SEQUENCE_specifics_t asn_SPC_IonosphericModel_specs_1 = { sizeof(struct IonosphericModel), offsetof(struct IonosphericModel, _asn_ctx), asn_MAP_IonosphericModel_tag2el_1, - 8, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 8, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_IonosphericModel = { "IonosphericModel", @@ -354,16 +347,15 @@ asn_TYPE_descriptor_t asn_DEF_IonosphericModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_IonosphericModel_tags_1, - sizeof(asn_DEF_IonosphericModel_tags_1) - /sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ - asn_DEF_IonosphericModel_tags_1, /* Same as above */ - sizeof(asn_DEF_IonosphericModel_tags_1) - /sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_IonosphericModel_tags_1) / + sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ + asn_DEF_IonosphericModel_tags_1, /* Same as above */ + sizeof(asn_DEF_IonosphericModel_tags_1) / + sizeof(asn_DEF_IonosphericModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_IonosphericModel_1, - 8, /* Elements count */ - &asn_SPC_IonosphericModel_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_IonosphericModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/IonosphericModel.h b/src/core/libs/supl/asn-rrlp/IonosphericModel.h index 71ea12d0c..b07794ac4 100644 --- a/src/core/libs/supl/asn-rrlp/IonosphericModel.h +++ b/src/core/libs/supl/asn-rrlp/IonosphericModel.h @@ -7,7 +7,6 @@ #ifndef _IonosphericModel_H_ #define _IonosphericModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/LAC.c b/src/core/libs/supl/asn-rrlp/LAC.c index 2cd6945f7..8529f4f78 100644 --- a/src/core/libs/supl/asn-rrlp/LAC.c +++ b/src/core/libs/supl/asn-rrlp/LAC.c @@ -6,119 +6,128 @@ #include "LAC.h" -int -LAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int LAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -LAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void LAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -LAC_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void LAC_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ LAC_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -LAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int LAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ LAC_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -LAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t LAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ LAC_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -LAC_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t LAC_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ LAC_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -LAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t LAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ LAC_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -LAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t LAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ LAC_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -LAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t LAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ LAC_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -LAC_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t LAC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ LAC_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_LAC_CONSTR_1 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_LAC_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_LAC = { "LAC", "LAC", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_LAC = { LAC_encode_xer, LAC_decode_uper, LAC_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_LAC_tags_1, - sizeof(asn_DEF_LAC_tags_1) - /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ - asn_DEF_LAC_tags_1, /* Same as above */ - sizeof(asn_DEF_LAC_tags_1) - /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ + sizeof(asn_DEF_LAC_tags_1) / sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ + asn_DEF_LAC_tags_1, /* Same as above */ + sizeof(asn_DEF_LAC_tags_1) / sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ &ASN_PER_TYPE_LAC_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/LAC.h b/src/core/libs/supl/asn-rrlp/LAC.h index 3bf06227f..74fe745c7 100644 --- a/src/core/libs/supl/asn-rrlp/LAC.h +++ b/src/core/libs/supl/asn-rrlp/LAC.h @@ -7,7 +7,6 @@ #ifndef _LAC_H_ #define _LAC_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/LocErrorReason.c b/src/core/libs/supl/asn-rrlp/LocErrorReason.c index 483958657..9d09337ad 100644 --- a/src/core/libs/supl/asn-rrlp/LocErrorReason.c +++ b/src/core/libs/supl/asn-rrlp/LocErrorReason.c @@ -6,9 +6,10 @@ #include "LocErrorReason.h" -int -LocErrorReason_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int LocErrorReason_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,133 +19,150 @@ LocErrorReason_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -LocErrorReason_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void LocErrorReason_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -LocErrorReason_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void LocErrorReason_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -LocErrorReason_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int LocErrorReason_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -LocErrorReason_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t LocErrorReason_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -LocErrorReason_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t LocErrorReason_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -LocErrorReason_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t LocErrorReason_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -LocErrorReason_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t LocErrorReason_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -LocErrorReason_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t LocErrorReason_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -LocErrorReason_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t LocErrorReason_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ LocErrorReason_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_LOC_ERROR_REASON_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 10 } /* (0..10,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 10} /* (0..10,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_LocErrorReason_value2enum_1[] = { - { 0, 9, "unDefined" }, - { 1, 13, "notEnoughBTSs" }, - { 2, 13, "notEnoughSats" }, - { 3, 24, "eotdLocCalAssDataMissing" }, - { 4, 18, "eotdAssDataMissing" }, - { 5, 23, "gpsLocCalAssDataMissing" }, - { 6, 17, "gpsAssDataMissing" }, - { 7, 18, "methodNotSupported" }, - { 8, 12, "notProcessed" }, - { 9, 25, "refBTSForGPSNotServingBTS" }, - { 10, 26, "refBTSForEOTDNotServingBTS" }, - { 11, 18, "notEnoughGANSSSats" }, - { 12, 19, "ganssAssDataMissing" }, - { 13, 27, "refBTSForGANSSNotServingBTS" } + {0, 9, "unDefined"}, + {1, 13, "notEnoughBTSs"}, + {2, 13, "notEnoughSats"}, + {3, 24, "eotdLocCalAssDataMissing"}, + {4, 18, "eotdAssDataMissing"}, + {5, 23, "gpsLocCalAssDataMissing"}, + {6, 17, "gpsAssDataMissing"}, + {7, 18, "methodNotSupported"}, + {8, 12, "notProcessed"}, + {9, 25, "refBTSForGPSNotServingBTS"}, + {10, 26, "refBTSForEOTDNotServingBTS"}, + {11, 18, "notEnoughGANSSSats"}, + {12, 19, "ganssAssDataMissing"}, + {13, 27, "refBTSForGANSSNotServingBTS"} /* This list is extensible */ }; static unsigned int asn_MAP_LocErrorReason_enum2value_1[] = { - 4, /* eotdAssDataMissing(4) */ - 3, /* eotdLocCalAssDataMissing(3) */ - 12, /* ganssAssDataMissing(12) */ - 6, /* gpsAssDataMissing(6) */ - 5, /* gpsLocCalAssDataMissing(5) */ - 7, /* methodNotSupported(7) */ - 1, /* notEnoughBTSs(1) */ - 11, /* notEnoughGANSSSats(11) */ - 2, /* notEnoughSats(2) */ - 8, /* notProcessed(8) */ - 10, /* refBTSForEOTDNotServingBTS(10) */ - 13, /* refBTSForGANSSNotServingBTS(13) */ - 9, /* refBTSForGPSNotServingBTS(9) */ - 0 /* unDefined(0) */ - /* This list is extensible */ + 4, /* eotdAssDataMissing(4) */ + 3, /* eotdLocCalAssDataMissing(3) */ + 12, /* ganssAssDataMissing(12) */ + 6, /* gpsAssDataMissing(6) */ + 5, /* gpsLocCalAssDataMissing(5) */ + 7, /* methodNotSupported(7) */ + 1, /* notEnoughBTSs(1) */ + 11, /* notEnoughGANSSSats(11) */ + 2, /* notEnoughSats(2) */ + 8, /* notProcessed(8) */ + 10, /* refBTSForEOTDNotServingBTS(10) */ + 13, /* refBTSForGANSSNotServingBTS(13) */ + 9, /* refBTSForGPSNotServingBTS(9) */ + 0 /* unDefined(0) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_LocErrorReason_specs_1 = { - asn_MAP_LocErrorReason_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_LocErrorReason_enum2value_1, /* N => "tag"; sorted by N */ - 14, /* Number of elements in the maps */ - 12, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_LocErrorReason_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_LocErrorReason_enum2value_1, /* N => "tag"; sorted by N */ + 14, /* Number of elements in the maps */ + 12, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_LocErrorReason_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_LocErrorReason = { "LocErrorReason", "LocErrorReason", @@ -157,15 +175,15 @@ asn_TYPE_descriptor_t asn_DEF_LocErrorReason = { LocErrorReason_encode_xer, LocErrorReason_decode_uper, LocErrorReason_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_LocErrorReason_tags_1, - sizeof(asn_DEF_LocErrorReason_tags_1) - /sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ - asn_DEF_LocErrorReason_tags_1, /* Same as above */ - sizeof(asn_DEF_LocErrorReason_tags_1) - /sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ + sizeof(asn_DEF_LocErrorReason_tags_1) / + sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ + asn_DEF_LocErrorReason_tags_1, /* Same as above */ + sizeof(asn_DEF_LocErrorReason_tags_1) / + sizeof(asn_DEF_LocErrorReason_tags_1[0]), /* 1 */ &ASN_PER_TYPE_LOC_ERROR_REASON_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_LocErrorReason_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_LocErrorReason_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/LocErrorReason.h b/src/core/libs/supl/asn-rrlp/LocErrorReason.h index 4b12bb292..9b4ab7b0f 100644 --- a/src/core/libs/supl/asn-rrlp/LocErrorReason.h +++ b/src/core/libs/supl/asn-rrlp/LocErrorReason.h @@ -7,7 +7,6 @@ #ifndef _LocErrorReason_H_ #define _LocErrorReason_H_ - #include /* Including external dependencies */ @@ -33,8 +32,8 @@ extern "C" LocErrorReason_refBTSForGPSNotServingBTS = 9, LocErrorReason_refBTSForEOTDNotServingBTS = 10, /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ LocErrorReason_notEnoughGANSSSats = 11, LocErrorReason_ganssAssDataMissing = 12, LocErrorReason_refBTSForGANSSNotServingBTS = 13 diff --git a/src/core/libs/supl/asn-rrlp/LocationError.c b/src/core/libs/supl/asn-rrlp/LocationError.c index effd99728..5b5df88cb 100644 --- a/src/core/libs/supl/asn-rrlp/LocationError.c +++ b/src/core/libs/supl/asn-rrlp/LocationError.c @@ -7,42 +7,37 @@ #include "LocationError.h" static asn_TYPE_member_t asn_MBR_LocationError_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct LocationError, locErrorReason), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LocErrorReason, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "locErrorReason" - }, - { ATF_POINTER, 1, offsetof(struct LocationError, additionalAssistanceData), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AdditionalAssistanceData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "additionalAssistanceData" - }, + {ATF_NOFLAGS, 0, offsetof(struct LocationError, locErrorReason), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocErrorReason, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "locErrorReason"}, + {ATF_POINTER, 1, offsetof(struct LocationError, additionalAssistanceData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AdditionalAssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "additionalAssistanceData"}, }; -static int asn_MAP_LocationError_oms_1[] = { 1 }; +static int asn_MAP_LocationError_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_LocationError_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_LocationError_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* locErrorReason at 488 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* additionalAssistanceData at 489 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* locErrorReason at 488 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* additionalAssistanceData at 489 */ }; static asn_SEQUENCE_specifics_t asn_SPC_LocationError_specs_1 = { sizeof(struct LocationError), offsetof(struct LocationError, _asn_ctx), asn_MAP_LocationError_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_LocationError_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_LocationError_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_LocationError = { "LocationError", @@ -56,16 +51,15 @@ asn_TYPE_descriptor_t asn_DEF_LocationError = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_LocationError_tags_1, - sizeof(asn_DEF_LocationError_tags_1) - /sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ - asn_DEF_LocationError_tags_1, /* Same as above */ - sizeof(asn_DEF_LocationError_tags_1) - /sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_LocationError_tags_1) / + sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ + asn_DEF_LocationError_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationError_tags_1) / + sizeof(asn_DEF_LocationError_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_LocationError_1, - 2, /* Elements count */ - &asn_SPC_LocationError_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_LocationError_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/LocationError.h b/src/core/libs/supl/asn-rrlp/LocationError.h index 33474d0bf..fd1caf3de 100644 --- a/src/core/libs/supl/asn-rrlp/LocationError.h +++ b/src/core/libs/supl/asn-rrlp/LocationError.h @@ -7,7 +7,6 @@ #ifndef _LocationError_H_ #define _LocationError_H_ - #include /* Including external dependencies */ @@ -26,11 +25,12 @@ extern "C" typedef struct LocationError { LocErrorReason_t locErrorReason; - struct AdditionalAssistanceData *additionalAssistanceData /* OPTIONAL */; + struct AdditionalAssistanceData + *additionalAssistanceData /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/LocationInfo.c b/src/core/libs/supl/asn-rrlp/LocationInfo.c index d2b7a0362..c2c75df51 100644 --- a/src/core/libs/supl/asn-rrlp/LocationInfo.c +++ b/src/core/libs/supl/asn-rrlp/LocationInfo.c @@ -6,123 +6,115 @@ #include "LocationInfo.h" -static int -memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refFrame_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsTOW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 14399999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 14399999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_FRAME_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GPS_TOW_CONSTR_3 = { - { APC_CONSTRAINED, 24, -1, 0, 14399999 } /* (0..14399999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, 0, 14399999} /* (0..14399999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_LocationInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, refFrame), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refFrame_constraint_1, - &ASN_PER_MEMB_REF_FRAME_CONSTR_2, - 0, - "refFrame" - }, - { ATF_POINTER, 1, offsetof(struct LocationInfo, gpsTOW), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsTOW_constraint_1, - &ASN_PER_MEMB_GPS_TOW_CONSTR_3, - 0, - "gpsTOW" - }, - { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, fixType), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FixType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fixType" - }, - { ATF_NOFLAGS, 0, offsetof(struct LocationInfo, posEstimate), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ext_GeographicalInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posEstimate" - }, + {ATF_NOFLAGS, 0, offsetof(struct LocationInfo, refFrame), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refFrame_constraint_1, + &ASN_PER_MEMB_REF_FRAME_CONSTR_2, 0, "refFrame"}, + {ATF_POINTER, 1, offsetof(struct LocationInfo, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsTOW_constraint_1, + &ASN_PER_MEMB_GPS_TOW_CONSTR_3, 0, "gpsTOW"}, + {ATF_NOFLAGS, 0, offsetof(struct LocationInfo, fixType), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FixType, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fixType"}, + {ATF_NOFLAGS, 0, offsetof(struct LocationInfo, posEstimate), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posEstimate"}, }; -static int asn_MAP_LocationInfo_oms_1[] = { 1 }; +static int asn_MAP_LocationInfo_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_LocationInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_LocationInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrame at 420 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTOW at 423 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* fixType at 424 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* posEstimate at 432 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refFrame at 420 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* gpsTOW at 423 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* fixType at 424 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* posEstimate at 432 */ }; static asn_SEQUENCE_specifics_t asn_SPC_LocationInfo_specs_1 = { sizeof(struct LocationInfo), offsetof(struct LocationInfo, _asn_ctx), asn_MAP_LocationInfo_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_LocationInfo_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_LocationInfo_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_LocationInfo = { "LocationInfo", @@ -136,16 +128,15 @@ asn_TYPE_descriptor_t asn_DEF_LocationInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_LocationInfo_tags_1, - sizeof(asn_DEF_LocationInfo_tags_1) - /sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ - asn_DEF_LocationInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_LocationInfo_tags_1) - /sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_LocationInfo_tags_1) / + sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ + asn_DEF_LocationInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationInfo_tags_1) / + sizeof(asn_DEF_LocationInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_LocationInfo_1, - 4, /* Elements count */ - &asn_SPC_LocationInfo_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_LocationInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/LocationInfo.h b/src/core/libs/supl/asn-rrlp/LocationInfo.h index 3ce96adb2..1d6ffa117 100644 --- a/src/core/libs/supl/asn-rrlp/LocationInfo.h +++ b/src/core/libs/supl/asn-rrlp/LocationInfo.h @@ -7,7 +7,6 @@ #ifndef _LocationInfo_H_ #define _LocationInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c index eaed4c820..33393464b 100644 --- a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c +++ b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.c @@ -6,119 +6,139 @@ #include "MeasureResponseTime.h" -int -MeasureResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int MeasureResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -MeasureResponseTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void MeasureResponseTime_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -MeasureResponseTime_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void MeasureResponseTime_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -MeasureResponseTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int MeasureResponseTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -MeasureResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t MeasureResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -MeasureResponseTime_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MeasureResponseTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -MeasureResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t MeasureResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -MeasureResponseTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MeasureResponseTime_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -MeasureResponseTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t MeasureResponseTime_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -MeasureResponseTime_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t MeasureResponseTime_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ MeasureResponseTime_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_MEASURE_RESPONSE_TIME_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_MeasureResponseTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_MeasureResponseTime = { "MeasureResponseTime", "MeasureResponseTime", @@ -131,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_MeasureResponseTime = { MeasureResponseTime_encode_xer, MeasureResponseTime_decode_uper, MeasureResponseTime_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MeasureResponseTime_tags_1, - sizeof(asn_DEF_MeasureResponseTime_tags_1) - /sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ - asn_DEF_MeasureResponseTime_tags_1, /* Same as above */ - sizeof(asn_DEF_MeasureResponseTime_tags_1) - /sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ + sizeof(asn_DEF_MeasureResponseTime_tags_1) / + sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ + asn_DEF_MeasureResponseTime_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasureResponseTime_tags_1) / + sizeof(asn_DEF_MeasureResponseTime_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MEASURE_RESPONSE_TIME_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h index 99936b2dd..5b5b770ba 100644 --- a/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h +++ b/src/core/libs/supl/asn-rrlp/MeasureResponseTime.h @@ -7,7 +7,6 @@ #ifndef _MeasureResponseTime_H_ #define _MeasureResponseTime_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MethodType.c b/src/core/libs/supl/asn-rrlp/MethodType.c index 4731a5823..02c8a8191 100644 --- a/src/core/libs/supl/asn-rrlp/MethodType.c +++ b/src/core/libs/supl/asn-rrlp/MethodType.c @@ -7,53 +7,39 @@ #include "MethodType.h" static asn_per_constraints_t ASN_PER_TYPE_METHOD_TYPE_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_MethodType_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssisted), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AccuracyOpt, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msAssisted" - }, - { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBased), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Accuracy, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msBased" - }, - { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBasedPref), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Accuracy, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msBasedPref" - }, - { ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssistedPref), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Accuracy, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msAssistedPref" - }, + {ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssisted), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AccuracyOpt, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msAssisted"}, + {ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBased), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msBased"}, + {ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msBasedPref), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msBasedPref"}, + {ATF_NOFLAGS, 0, offsetof(struct MethodType, choice.msAssistedPref), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Accuracy, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msAssistedPref"}, }; static asn_TYPE_tag2member_t asn_MAP_MethodType_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msAssisted at 117 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msBased at 118 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msBasedPref at 119 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* msAssistedPref at 121 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msAssisted at 117 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* msBased at 118 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* msBasedPref at 119 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* msAssistedPref at 121 */ }; static asn_CHOICE_specifics_t asn_SPC_MethodType_specs_1 = { sizeof(struct MethodType), @@ -61,9 +47,9 @@ static asn_CHOICE_specifics_t asn_SPC_MethodType_specs_1 = { offsetof(struct MethodType, present), sizeof(((struct MethodType *)0)->present), asn_MAP_MethodType_tag2el_1, - 4, /* Count of tags in the map */ + 4, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_MethodType = { "MethodType", @@ -78,13 +64,12 @@ asn_TYPE_descriptor_t asn_DEF_MethodType = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_METHOD_TYPE_CONSTR_1, asn_MBR_MethodType_1, - 4, /* Elements count */ - &asn_SPC_MethodType_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_MethodType_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MethodType.h b/src/core/libs/supl/asn-rrlp/MethodType.h index c0ec825c7..b99be62ca 100644 --- a/src/core/libs/supl/asn-rrlp/MethodType.h +++ b/src/core/libs/supl/asn-rrlp/MethodType.h @@ -7,7 +7,6 @@ #ifndef _MethodType_H_ #define _MethodType_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c index 6cd2d0139..a2f5092cf 100644 --- a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c +++ b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.c @@ -6,119 +6,138 @@ #include "ModuloTimeSlot.h" -int -ModuloTimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ModuloTimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -ModuloTimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void ModuloTimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -ModuloTimeSlot_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ModuloTimeSlot_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ModuloTimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ModuloTimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ModuloTimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ModuloTimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ModuloTimeSlot_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ModuloTimeSlot_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ModuloTimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ModuloTimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ModuloTimeSlot_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ModuloTimeSlot_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ModuloTimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ModuloTimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ModuloTimeSlot_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ModuloTimeSlot_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ ModuloTimeSlot_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_MODULO_TIME_SLOT_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_ModuloTimeSlot_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_ModuloTimeSlot = { "ModuloTimeSlot", "ModuloTimeSlot", @@ -131,15 +150,15 @@ asn_TYPE_descriptor_t asn_DEF_ModuloTimeSlot = { ModuloTimeSlot_encode_xer, ModuloTimeSlot_decode_uper, ModuloTimeSlot_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ModuloTimeSlot_tags_1, - sizeof(asn_DEF_ModuloTimeSlot_tags_1) - /sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ - asn_DEF_ModuloTimeSlot_tags_1, /* Same as above */ - sizeof(asn_DEF_ModuloTimeSlot_tags_1) - /sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ + sizeof(asn_DEF_ModuloTimeSlot_tags_1) / + sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ + asn_DEF_ModuloTimeSlot_tags_1, /* Same as above */ + sizeof(asn_DEF_ModuloTimeSlot_tags_1) / + sizeof(asn_DEF_ModuloTimeSlot_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MODULO_TIME_SLOT_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h index 85127fe10..e079c68ff 100644 --- a/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h +++ b/src/core/libs/supl/asn-rrlp/ModuloTimeSlot.h @@ -7,7 +7,6 @@ #ifndef _ModuloTimeSlot_H_ #define _ModuloTimeSlot_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c index 9fcb7b507..83ac43ebb 100644 --- a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c +++ b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.c @@ -6,9 +6,10 @@ #include "MoreAssDataToBeSent.h" -int -MoreAssDataToBeSent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int MoreAssDataToBeSent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,107 +19,123 @@ MoreAssDataToBeSent_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -MoreAssDataToBeSent_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void MoreAssDataToBeSent_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -MoreAssDataToBeSent_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void MoreAssDataToBeSent_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -MoreAssDataToBeSent_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int MoreAssDataToBeSent_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -MoreAssDataToBeSent_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t MoreAssDataToBeSent_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -MoreAssDataToBeSent_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MoreAssDataToBeSent_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -MoreAssDataToBeSent_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t MoreAssDataToBeSent_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -MoreAssDataToBeSent_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MoreAssDataToBeSent_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -MoreAssDataToBeSent_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t MoreAssDataToBeSent_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -MoreAssDataToBeSent_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t MoreAssDataToBeSent_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ MoreAssDataToBeSent_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_MORE_ASS_DATA_TO_BE_SENT_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_MoreAssDataToBeSent_value2enum_1[] = { - { 0, 14, "noMoreMessages" }, - { 1, 20, "moreMessagesOnTheWay" } -}; + {0, 14, "noMoreMessages"}, {1, 20, "moreMessagesOnTheWay"}}; static unsigned int asn_MAP_MoreAssDataToBeSent_enum2value_1[] = { - 1, /* moreMessagesOnTheWay(1) */ - 0 /* noMoreMessages(0) */ + 1, /* moreMessagesOnTheWay(1) */ + 0 /* noMoreMessages(0) */ }; static asn_INTEGER_specifics_t asn_SPC_MoreAssDataToBeSent_specs_1 = { - asn_MAP_MoreAssDataToBeSent_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_MoreAssDataToBeSent_enum2value_1, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_MoreAssDataToBeSent_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_MoreAssDataToBeSent_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_MoreAssDataToBeSent_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_MoreAssDataToBeSent = { "MoreAssDataToBeSent", "MoreAssDataToBeSent", @@ -131,15 +148,15 @@ asn_TYPE_descriptor_t asn_DEF_MoreAssDataToBeSent = { MoreAssDataToBeSent_encode_xer, MoreAssDataToBeSent_decode_uper, MoreAssDataToBeSent_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MoreAssDataToBeSent_tags_1, - sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) - /sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ - asn_DEF_MoreAssDataToBeSent_tags_1, /* Same as above */ - sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) - /sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) / + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ + asn_DEF_MoreAssDataToBeSent_tags_1, /* Same as above */ + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1) / + sizeof(asn_DEF_MoreAssDataToBeSent_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MORE_ASS_DATA_TO_BE_SENT_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_MoreAssDataToBeSent_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_MoreAssDataToBeSent_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h index ceb8a02a2..faa83acf1 100644 --- a/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h +++ b/src/core/libs/supl/asn-rrlp/MoreAssDataToBeSent.h @@ -7,7 +7,6 @@ #ifndef _MoreAssDataToBeSent_H_ #define _MoreAssDataToBeSent_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MpathIndic.c b/src/core/libs/supl/asn-rrlp/MpathIndic.c index a8b80b956..9cf71b2a0 100644 --- a/src/core/libs/supl/asn-rrlp/MpathIndic.c +++ b/src/core/libs/supl/asn-rrlp/MpathIndic.c @@ -6,9 +6,9 @@ #include "MpathIndic.h" -int -MpathIndic_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int MpathIndic_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,111 +18,118 @@ MpathIndic_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -MpathIndic_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void MpathIndic_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -MpathIndic_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void MpathIndic_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ MpathIndic_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -MpathIndic_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int MpathIndic_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ MpathIndic_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -MpathIndic_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t MpathIndic_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ MpathIndic_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -MpathIndic_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MpathIndic_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ MpathIndic_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -MpathIndic_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t MpathIndic_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ MpathIndic_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -MpathIndic_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MpathIndic_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ MpathIndic_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -MpathIndic_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t MpathIndic_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ MpathIndic_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -MpathIndic_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t MpathIndic_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ MpathIndic_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_MPATH_INDIC_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_MpathIndic_value2enum_1[] = { - { 0, 11, "notMeasured" }, - { 1, 3, "low" }, - { 2, 6, "medium" }, - { 3, 4, "high" } -}; + {0, 11, "notMeasured"}, {1, 3, "low"}, {2, 6, "medium"}, {3, 4, "high"}}; static unsigned int asn_MAP_MpathIndic_enum2value_1[] = { - 3, /* high(3) */ - 1, /* low(1) */ - 2, /* medium(2) */ - 0 /* notMeasured(0) */ + 3, /* high(3) */ + 1, /* low(1) */ + 2, /* medium(2) */ + 0 /* notMeasured(0) */ }; static asn_INTEGER_specifics_t asn_SPC_MpathIndic_specs_1 = { - asn_MAP_MpathIndic_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_MpathIndic_enum2value_1, /* N => "tag"; sorted by N */ - 4, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_MpathIndic_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_MpathIndic_enum2value_1, /* N => "tag"; sorted by N */ + 4, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_MpathIndic_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_MpathIndic = { "MpathIndic", "MpathIndic", @@ -135,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_MpathIndic = { MpathIndic_encode_xer, MpathIndic_decode_uper, MpathIndic_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MpathIndic_tags_1, - sizeof(asn_DEF_MpathIndic_tags_1) - /sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ - asn_DEF_MpathIndic_tags_1, /* Same as above */ - sizeof(asn_DEF_MpathIndic_tags_1) - /sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ + sizeof(asn_DEF_MpathIndic_tags_1) / + sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ + asn_DEF_MpathIndic_tags_1, /* Same as above */ + sizeof(asn_DEF_MpathIndic_tags_1) / + sizeof(asn_DEF_MpathIndic_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MPATH_INDIC_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_MpathIndic_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_MpathIndic_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MpathIndic.h b/src/core/libs/supl/asn-rrlp/MpathIndic.h index c46190125..cbf30f2c3 100644 --- a/src/core/libs/supl/asn-rrlp/MpathIndic.h +++ b/src/core/libs/supl/asn-rrlp/MpathIndic.h @@ -7,7 +7,6 @@ #ifndef _MpathIndic_H_ #define _MpathIndic_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c index 871a6a884..6aa864b8c 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.c @@ -7,40 +7,36 @@ #include "MsrAssistBTS-R98-ExpOTD.h" static asn_TYPE_member_t asn_MBR_MsrAssistBTS_R98_ExpOTD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS_R98_ExpOTD, expectedOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExpectedOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "expectedOTD" - }, - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS_R98_ExpOTD, expOTDUncertainty), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExpOTDUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "expOTDUncertainty" - }, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS_R98_ExpOTD, expectedOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpectedOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "expectedOTD"}, + {ATF_NOFLAGS, 0, + offsetof(struct MsrAssistBTS_R98_ExpOTD, expOTDUncertainty), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExpOTDUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "expOTDUncertainty"}, }; static ber_tlv_tag_t asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrAssistBTS_R98_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* expectedOTD at 910 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* expOTDUncertainty at 912 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* expectedOTD at 910 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* expOTDUncertainty at 912 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistBTS_R98_ExpOTD_specs_1 = { sizeof(struct MsrAssistBTS_R98_ExpOTD), offsetof(struct MsrAssistBTS_R98_ExpOTD, _asn_ctx), asn_MAP_MsrAssistBTS_R98_ExpOTD_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS_R98_ExpOTD = { "MsrAssistBTS-R98-ExpOTD", @@ -54,16 +50,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS_R98_ExpOTD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1, - sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_MsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrAssistBTS_R98_ExpOTD_1, - 2, /* Elements count */ - &asn_SPC_MsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_MsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h index 2f0e1642d..63a4ae3c6 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _MsrAssistBTS_R98_ExpOTD_H_ #define _MsrAssistBTS_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c index 75a33521d..81bc52b82 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.c @@ -7,82 +7,62 @@ #include "MsrAssistBTS.h" static asn_TYPE_member_t asn_MBR_MsrAssistBTS_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bcchCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bcchCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bsic), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, multiFrameOffset), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MultiFrameOffset, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "multiFrameOffset" - }, - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, timeSlotScheme), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeSlotScheme, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeSlotScheme" - }, - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, roughRTD), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RoughRTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "roughRTD" - }, - { ATF_POINTER, 1, offsetof(struct MsrAssistBTS, calcAssistanceBTS), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CalcAssistanceBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "calcAssistanceBTS" - }, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bcchCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "multiFrameOffset"}, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeSlotScheme"}, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistBTS, roughRTD), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RoughRTD, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "roughRTD"}, + {ATF_POINTER, 1, offsetof(struct MsrAssistBTS, calcAssistanceBTS), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CalcAssistanceBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "calcAssistanceBTS"}, }; -static int asn_MAP_MsrAssistBTS_oms_1[] = { 5 }; +static int asn_MAP_MsrAssistBTS_oms_1[] = {5}; static ber_tlv_tag_t asn_DEF_MsrAssistBTS_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrAssistBTS_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 193 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 194 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* multiFrameOffset at 195 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* timeSlotScheme at 196 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* roughRTD at 197 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* calcAssistanceBTS at 200 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bcchCarrier at 193 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bsic at 194 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* multiFrameOffset at 195 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* timeSlotScheme at 196 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* roughRTD at 197 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* calcAssistanceBTS at 200 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistBTS_specs_1 = { sizeof(struct MsrAssistBTS), offsetof(struct MsrAssistBTS, _asn_ctx), asn_MAP_MsrAssistBTS_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_MsrAssistBTS_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_MsrAssistBTS_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS = { "MsrAssistBTS", @@ -96,16 +76,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrAssistBTS = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrAssistBTS_tags_1, - sizeof(asn_DEF_MsrAssistBTS_tags_1) - /sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ - asn_DEF_MsrAssistBTS_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrAssistBTS_tags_1) - /sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrAssistBTS_tags_1) / + sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistBTS_tags_1) / + sizeof(asn_DEF_MsrAssistBTS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrAssistBTS_1, - 6, /* Elements count */ - &asn_SPC_MsrAssistBTS_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_MsrAssistBTS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h index 912be259e..f39c569b7 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h +++ b/src/core/libs/supl/asn-rrlp/MsrAssistBTS.h @@ -7,7 +7,6 @@ #ifndef _MsrAssistBTS_H_ #define _MsrAssistBTS_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c index cf1c43909..b353b894c 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.c @@ -7,30 +7,30 @@ #include "MsrAssistData-R98-ExpOTD.h" static asn_TYPE_member_t asn_MBR_MsrAssistData_R98_ExpOTD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistData_R98_ExpOTD, msrAssistList_R98_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrAssistList-R98-ExpOTD" - }, + {ATF_NOFLAGS, 0, + offsetof(struct MsrAssistData_R98_ExpOTD, msrAssistList_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrAssistList-R98-ExpOTD"}, }; static ber_tlv_tag_t asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrAssistData_R98_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* msrAssistList-R98-ExpOTD at 900 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* msrAssistList-R98-ExpOTD at 900 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistData_R98_ExpOTD_specs_1 = { sizeof(struct MsrAssistData_R98_ExpOTD), offsetof(struct MsrAssistData_R98_ExpOTD, _asn_ctx), asn_MAP_MsrAssistData_R98_ExpOTD_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrAssistData_R98_ExpOTD = { "MsrAssistData-R98-ExpOTD", @@ -44,16 +44,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrAssistData_R98_ExpOTD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrAssistData_R98_ExpOTD_tags_1, - sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_MsrAssistData_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_MsrAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrAssistData_R98_ExpOTD_1, - 1, /* Elements count */ - &asn_SPC_MsrAssistData_R98_ExpOTD_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_MsrAssistData_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h index 30ca3c8a3..32c43cb59 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _MsrAssistData_R98_ExpOTD_H_ #define _MsrAssistData_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData.c b/src/core/libs/supl/asn-rrlp/MsrAssistData.c index 5fb6bd4c1..83c463998 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistData.c +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData.c @@ -7,30 +7,28 @@ #include "MsrAssistData.h" static asn_TYPE_member_t asn_MBR_MsrAssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MsrAssistData, msrAssistList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfMsrAssistBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrAssistList" - }, + {ATF_NOFLAGS, 0, offsetof(struct MsrAssistData, msrAssistList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfMsrAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrAssistList"}, }; static ber_tlv_tag_t asn_DEF_MsrAssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrAssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* msrAssistList at 189 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* msrAssistList at 189 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrAssistData_specs_1 = { sizeof(struct MsrAssistData), offsetof(struct MsrAssistData, _asn_ctx), asn_MAP_MsrAssistData_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrAssistData = { "MsrAssistData", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrAssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrAssistData_tags_1, - sizeof(asn_DEF_MsrAssistData_tags_1) - /sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ - asn_DEF_MsrAssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrAssistData_tags_1) - /sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrAssistData_tags_1) / + sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ + asn_DEF_MsrAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrAssistData_tags_1) / + sizeof(asn_DEF_MsrAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrAssistData_1, - 1, /* Elements count */ - &asn_SPC_MsrAssistData_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_MsrAssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrAssistData.h b/src/core/libs/supl/asn-rrlp/MsrAssistData.h index 64b526ba8..6c12a483c 100644 --- a/src/core/libs/supl/asn-rrlp/MsrAssistData.h +++ b/src/core/libs/supl/asn-rrlp/MsrAssistData.h @@ -7,7 +7,6 @@ #ifndef _MsrAssistData_H_ #define _MsrAssistData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c index c37ebf5d2..2a3a0941a 100644 --- a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.c @@ -7,102 +7,85 @@ #include "MsrPosition-Req.h" static asn_TYPE_member_t asn_MBR_MsrPosition_Req_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MsrPosition_Req, positionInstruct), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PositionInstruct, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "positionInstruct" - }, - { ATF_POINTER, 7, offsetof(struct MsrPosition_Req, referenceAssistData), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceAssistData" - }, - { ATF_POINTER, 6, offsetof(struct MsrPosition_Req, msrAssistData), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MsrAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrAssistData" - }, - { ATF_POINTER, 5, offsetof(struct MsrPosition_Req, systemInfoAssistData), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SystemInfoAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoAssistData" - }, - { ATF_POINTER, 4, offsetof(struct MsrPosition_Req, gps_AssistData), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPS_AssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gps-AssistData" - }, - { ATF_POINTER, 3, offsetof(struct MsrPosition_Req, extensionContainer), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExtensionContainer, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extensionContainer" - }, - { ATF_POINTER, 2, offsetof(struct MsrPosition_Req, rel98_MsrPosition_Req_extension), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel98_MsrPosition_Req_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel98-MsrPosition-Req-extension" - }, - { ATF_POINTER, 1, offsetof(struct MsrPosition_Req, rel5_MsrPosition_Req_extension), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel5_MsrPosition_Req_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel5-MsrPosition-Req-extension" - }, + {ATF_NOFLAGS, 0, offsetof(struct MsrPosition_Req, positionInstruct), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionInstruct, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "positionInstruct"}, + {ATF_POINTER, 7, offsetof(struct MsrPosition_Req, referenceAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceAssistData"}, + {ATF_POINTER, 6, offsetof(struct MsrPosition_Req, msrAssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrAssistData"}, + {ATF_POINTER, 5, offsetof(struct MsrPosition_Req, systemInfoAssistData), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoAssistData"}, + {ATF_POINTER, 4, offsetof(struct MsrPosition_Req, gps_AssistData), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gps-AssistData"}, + {ATF_POINTER, 3, offsetof(struct MsrPosition_Req, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extensionContainer"}, + {ATF_POINTER, 2, + offsetof(struct MsrPosition_Req, rel98_MsrPosition_Req_extension), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_MsrPosition_Req_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel98-MsrPosition-Req-extension"}, + {ATF_POINTER, 1, + offsetof(struct MsrPosition_Req, rel5_MsrPosition_Req_extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel5_MsrPosition_Req_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel5-MsrPosition-Req-extension"}, }; -static int asn_MAP_MsrPosition_Req_oms_1[] = { 1, 2, 3, 4, 5, 6, 7 }; +static int asn_MAP_MsrPosition_Req_oms_1[] = {1, 2, 3, 4, 5, 6, 7}; static ber_tlv_tag_t asn_DEF_MsrPosition_Req_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrPosition_Req_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* positionInstruct at 31 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceAssistData at 32 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msrAssistData at 33 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* systemInfoAssistData at 34 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gps-AssistData at 35 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensionContainer at 36 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* rel98-MsrPosition-Req-extension at 39 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* rel5-MsrPosition-Req-extension at 41 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* positionInstruct at 31 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* referenceAssistData at 32 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* msrAssistData at 33 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* systemInfoAssistData at 34 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* gps-AssistData at 35 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* extensionContainer at 36 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* rel98-MsrPosition-Req-extension at 39 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0} /* rel5-MsrPosition-Req-extension at 41 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrPosition_Req_specs_1 = { sizeof(struct MsrPosition_Req), offsetof(struct MsrPosition_Req, _asn_ctx), asn_MAP_MsrPosition_Req_tag2el_1, - 8, /* Count of tags in the map */ - asn_MAP_MsrPosition_Req_oms_1, /* Optional members */ - 5, 2, /* Root/Additions */ - 5, /* Start extensions */ - 9 /* Stop extensions */ + 8, /* Count of tags in the map */ + asn_MAP_MsrPosition_Req_oms_1, /* Optional members */ + 5, + 2, /* Root/Additions */ + 5, /* Start extensions */ + 9 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrPosition_Req = { "MsrPosition-Req", @@ -116,16 +99,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrPosition_Req = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrPosition_Req_tags_1, - sizeof(asn_DEF_MsrPosition_Req_tags_1) - /sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ - asn_DEF_MsrPosition_Req_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrPosition_Req_tags_1) - /sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrPosition_Req_tags_1) / + sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ + asn_DEF_MsrPosition_Req_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrPosition_Req_tags_1) / + sizeof(asn_DEF_MsrPosition_Req_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrPosition_Req_1, - 8, /* Elements count */ - &asn_SPC_MsrPosition_Req_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_MsrPosition_Req_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h index ba5127d2c..80548b197 100644 --- a/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Req.h @@ -7,7 +7,6 @@ #ifndef _MsrPosition_Req_H_ #define _MsrPosition_Req_H_ - #include /* Including external dependencies */ @@ -38,11 +37,13 @@ extern "C" struct GPS_AssistData *gps_AssistData /* OPTIONAL */; ExtensionContainer_t *extensionContainer /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ - struct Rel98_MsrPosition_Req_Extension *rel98_MsrPosition_Req_extension /* OPTIONAL */; - struct Rel5_MsrPosition_Req_Extension *rel5_MsrPosition_Req_extension /* OPTIONAL */; + * This type is extensible, + * possible extensions are below. + */ + struct Rel98_MsrPosition_Req_Extension + *rel98_MsrPosition_Req_extension /* OPTIONAL */; + struct Rel5_MsrPosition_Req_Extension + *rel5_MsrPosition_Req_extension /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c index 2f825d8c8..9a095c7da 100644 --- a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.c @@ -7,112 +7,90 @@ #include "MsrPosition-Rsp.h" static asn_TYPE_member_t asn_MBR_MsrPosition_Rsp_1[] = { - { ATF_POINTER, 9, offsetof(struct MsrPosition_Rsp, multipleSets), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MultipleSets, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "multipleSets" - }, - { ATF_POINTER, 8, offsetof(struct MsrPosition_Rsp, referenceIdentity), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceIdentity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceIdentity" - }, - { ATF_POINTER, 7, offsetof(struct MsrPosition_Rsp, otd_MeasureInfo), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MeasureInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-MeasureInfo" - }, - { ATF_POINTER, 6, offsetof(struct MsrPosition_Rsp, locationInfo), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LocationInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "locationInfo" - }, - { ATF_POINTER, 5, offsetof(struct MsrPosition_Rsp, gps_MeasureInfo), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPS_MeasureInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gps-MeasureInfo" - }, - { ATF_POINTER, 4, offsetof(struct MsrPosition_Rsp, locationError), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LocationError, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "locationError" - }, - { ATF_POINTER, 3, offsetof(struct MsrPosition_Rsp, extensionContainer), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExtensionContainer, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extensionContainer" - }, - { ATF_POINTER, 2, offsetof(struct MsrPosition_Rsp, rel_98_MsrPosition_Rsp_Extension), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel_98_MsrPosition_Rsp_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel-98-MsrPosition-Rsp-Extension" - }, - { ATF_POINTER, 1, offsetof(struct MsrPosition_Rsp, rel_5_MsrPosition_Rsp_Extension), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel_5_MsrPosition_Rsp_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel-5-MsrPosition-Rsp-Extension" - }, + {ATF_POINTER, 9, offsetof(struct MsrPosition_Rsp, multipleSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultipleSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "multipleSets"}, + {ATF_POINTER, 8, offsetof(struct MsrPosition_Rsp, referenceIdentity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceIdentity"}, + {ATF_POINTER, 7, offsetof(struct MsrPosition_Rsp, otd_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-MeasureInfo"}, + {ATF_POINTER, 6, offsetof(struct MsrPosition_Rsp, locationInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "locationInfo"}, + {ATF_POINTER, 5, offsetof(struct MsrPosition_Rsp, gps_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPS_MeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gps-MeasureInfo"}, + {ATF_POINTER, 4, offsetof(struct MsrPosition_Rsp, locationError), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationError, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "locationError"}, + {ATF_POINTER, 3, offsetof(struct MsrPosition_Rsp, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extensionContainer"}, + {ATF_POINTER, 2, + offsetof(struct MsrPosition_Rsp, rel_98_MsrPosition_Rsp_Extension), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_98_MsrPosition_Rsp_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel-98-MsrPosition-Rsp-Extension"}, + {ATF_POINTER, 1, + offsetof(struct MsrPosition_Rsp, rel_5_MsrPosition_Rsp_Extension), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_5_MsrPosition_Rsp_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel-5-MsrPosition-Rsp-Extension"}, }; -static int asn_MAP_MsrPosition_Rsp_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; +static int asn_MAP_MsrPosition_Rsp_oms_1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; static ber_tlv_tag_t asn_DEF_MsrPosition_Rsp_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MsrPosition_Rsp_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* multipleSets at 51 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceIdentity at 52 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* otd-MeasureInfo at 53 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* locationInfo at 54 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* gps-MeasureInfo at 55 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* locationError at 56 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* extensionContainer at 57 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* rel-98-MsrPosition-Rsp-Extension at 61 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* rel-5-MsrPosition-Rsp-Extension at 63 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* multipleSets at 51 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* referenceIdentity at 52 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* otd-MeasureInfo at 53 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* locationInfo at 54 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* gps-MeasureInfo at 55 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* locationError at 56 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* extensionContainer at 57 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* rel-98-MsrPosition-Rsp-Extension at 61 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, + 0} /* rel-5-MsrPosition-Rsp-Extension at 63 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MsrPosition_Rsp_specs_1 = { sizeof(struct MsrPosition_Rsp), offsetof(struct MsrPosition_Rsp, _asn_ctx), asn_MAP_MsrPosition_Rsp_tag2el_1, - 9, /* Count of tags in the map */ - asn_MAP_MsrPosition_Rsp_oms_1, /* Optional members */ - 7, 2, /* Root/Additions */ - 6, /* Start extensions */ - 10 /* Stop extensions */ + 9, /* Count of tags in the map */ + asn_MAP_MsrPosition_Rsp_oms_1, /* Optional members */ + 7, + 2, /* Root/Additions */ + 6, /* Start extensions */ + 10 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MsrPosition_Rsp = { "MsrPosition-Rsp", @@ -126,16 +104,15 @@ asn_TYPE_descriptor_t asn_DEF_MsrPosition_Rsp = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MsrPosition_Rsp_tags_1, - sizeof(asn_DEF_MsrPosition_Rsp_tags_1) - /sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ - asn_DEF_MsrPosition_Rsp_tags_1, /* Same as above */ - sizeof(asn_DEF_MsrPosition_Rsp_tags_1) - /sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MsrPosition_Rsp_tags_1) / + sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ + asn_DEF_MsrPosition_Rsp_tags_1, /* Same as above */ + sizeof(asn_DEF_MsrPosition_Rsp_tags_1) / + sizeof(asn_DEF_MsrPosition_Rsp_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MsrPosition_Rsp_1, - 9, /* Elements count */ - &asn_SPC_MsrPosition_Rsp_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_MsrPosition_Rsp_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h index b8e1dc4f4..d3aee5c32 100644 --- a/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h +++ b/src/core/libs/supl/asn-rrlp/MsrPosition-Rsp.h @@ -7,7 +7,6 @@ #ifndef _MsrPosition_Rsp_H_ #define _MsrPosition_Rsp_H_ - #include /* Including external dependencies */ @@ -40,11 +39,13 @@ extern "C" struct LocationError *locationError /* OPTIONAL */; ExtensionContainer_t *extensionContainer /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ - struct Rel_98_MsrPosition_Rsp_Extension *rel_98_MsrPosition_Rsp_Extension /* OPTIONAL */; - struct Rel_5_MsrPosition_Rsp_Extension *rel_5_MsrPosition_Rsp_Extension /* OPTIONAL */; + * This type is extensible, + * possible extensions are below. + */ + struct Rel_98_MsrPosition_Rsp_Extension + *rel_98_MsrPosition_Rsp_Extension /* OPTIONAL */; + struct Rel_5_MsrPosition_Rsp_Extension + *rel_5_MsrPosition_Rsp_Extension /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c index 46e1a6481..c76dfa37c 100644 --- a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c +++ b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.c @@ -7,40 +7,35 @@ #include "MultiFrameCarrier.h" static asn_TYPE_member_t asn_MBR_MultiFrameCarrier_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, bcchCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bcchCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, multiFrameOffset), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MultiFrameOffset, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "multiFrameOffset" - }, + {ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bcchCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct MultiFrameCarrier, multiFrameOffset), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameOffset, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "multiFrameOffset"}, }; static ber_tlv_tag_t asn_DEF_MultiFrameCarrier_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MultiFrameCarrier_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 411 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* multiFrameOffset at 413 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bcchCarrier at 411 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* multiFrameOffset at 413 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MultiFrameCarrier_specs_1 = { sizeof(struct MultiFrameCarrier), offsetof(struct MultiFrameCarrier, _asn_ctx), asn_MAP_MultiFrameCarrier_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MultiFrameCarrier = { "MultiFrameCarrier", @@ -54,16 +49,15 @@ asn_TYPE_descriptor_t asn_DEF_MultiFrameCarrier = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MultiFrameCarrier_tags_1, - sizeof(asn_DEF_MultiFrameCarrier_tags_1) - /sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ - asn_DEF_MultiFrameCarrier_tags_1, /* Same as above */ - sizeof(asn_DEF_MultiFrameCarrier_tags_1) - /sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MultiFrameCarrier_tags_1) / + sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ + asn_DEF_MultiFrameCarrier_tags_1, /* Same as above */ + sizeof(asn_DEF_MultiFrameCarrier_tags_1) / + sizeof(asn_DEF_MultiFrameCarrier_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MultiFrameCarrier_1, - 2, /* Elements count */ - &asn_SPC_MultiFrameCarrier_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_MultiFrameCarrier_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h index 9bba017f3..36fff2764 100644 --- a/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h +++ b/src/core/libs/supl/asn-rrlp/MultiFrameCarrier.h @@ -7,7 +7,6 @@ #ifndef _MultiFrameCarrier_H_ #define _MultiFrameCarrier_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c index 33b37f22f..292097309 100644 --- a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c +++ b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.c @@ -6,119 +6,140 @@ #include "MultiFrameOffset.h" -int -MultiFrameOffset_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int MultiFrameOffset_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 51)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 51)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -MultiFrameOffset_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void MultiFrameOffset_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -MultiFrameOffset_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void MultiFrameOffset_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -MultiFrameOffset_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int MultiFrameOffset_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -MultiFrameOffset_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t MultiFrameOffset_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -MultiFrameOffset_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MultiFrameOffset_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -MultiFrameOffset_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t MultiFrameOffset_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -MultiFrameOffset_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t MultiFrameOffset_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -MultiFrameOffset_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t MultiFrameOffset_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -MultiFrameOffset_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t MultiFrameOffset_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ MultiFrameOffset_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_MULTI_FRAME_OFFSET_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 0, 51 } /* (0..51) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 51} /* (0..51) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_MultiFrameOffset_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_MultiFrameOffset = { "MultiFrameOffset", "MultiFrameOffset", @@ -131,15 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_MultiFrameOffset = { MultiFrameOffset_encode_xer, MultiFrameOffset_decode_uper, MultiFrameOffset_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MultiFrameOffset_tags_1, - sizeof(asn_DEF_MultiFrameOffset_tags_1) - /sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ - asn_DEF_MultiFrameOffset_tags_1, /* Same as above */ - sizeof(asn_DEF_MultiFrameOffset_tags_1) - /sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ + sizeof(asn_DEF_MultiFrameOffset_tags_1) / + sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ + asn_DEF_MultiFrameOffset_tags_1, /* Same as above */ + sizeof(asn_DEF_MultiFrameOffset_tags_1) / + sizeof(asn_DEF_MultiFrameOffset_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MULTI_FRAME_OFFSET_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h index 49eef5165..654bb19dc 100644 --- a/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h +++ b/src/core/libs/supl/asn-rrlp/MultiFrameOffset.h @@ -7,7 +7,6 @@ #ifndef _MultiFrameOffset_H_ #define _MultiFrameOffset_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/MultipleSets.c b/src/core/libs/supl/asn-rrlp/MultipleSets.c index 4f363e44c..26bf60c18 100644 --- a/src/core/libs/supl/asn-rrlp/MultipleSets.c +++ b/src/core/libs/supl/asn-rrlp/MultipleSets.c @@ -6,113 +6,110 @@ #include "MultipleSets.h" -static int -memb_nbrOfSets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_nbrOfSets_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 2 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 2 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_nbrOfReferenceBTSs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_nbrOfReferenceBTSs_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 1 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 1 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_NBR_OF_SETS_CONSTR_2 = { - { APC_CONSTRAINED, 1, 1, 2, 3 } /* (2..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 2, 3} /* (2..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_NBR_OF_REFERENCE_BT_SS_CONSTR_3 = { - { APC_CONSTRAINED, 2, 2, 1, 3 } /* (1..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 1, 3} /* (1..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_MultipleSets_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfSets), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_nbrOfSets_constraint_1, - &ASN_PER_MEMB_NBR_OF_SETS_CONSTR_2, - 0, - "nbrOfSets" - }, - { ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfReferenceBTSs), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_nbrOfReferenceBTSs_constraint_1, - &ASN_PER_MEMB_NBR_OF_REFERENCE_BT_SS_CONSTR_3, - 0, - "nbrOfReferenceBTSs" - }, - { ATF_POINTER, 1, offsetof(struct MultipleSets, referenceRelation), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ReferenceRelation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceRelation" - }, + {ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_nbrOfSets_constraint_1, + &ASN_PER_MEMB_NBR_OF_SETS_CONSTR_2, 0, "nbrOfSets"}, + {ATF_NOFLAGS, 0, offsetof(struct MultipleSets, nbrOfReferenceBTSs), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_nbrOfReferenceBTSs_constraint_1, + &ASN_PER_MEMB_NBR_OF_REFERENCE_BT_SS_CONSTR_3, 0, "nbrOfReferenceBTSs"}, + {ATF_POINTER, 1, offsetof(struct MultipleSets, referenceRelation), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ReferenceRelation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceRelation"}, }; -static int asn_MAP_MultipleSets_oms_1[] = { 2 }; +static int asn_MAP_MultipleSets_oms_1[] = {2}; static ber_tlv_tag_t asn_DEF_MultipleSets_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MultipleSets_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nbrOfSets at 267 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nbrOfReferenceBTSs at 270 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* referenceRelation at 274 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* nbrOfSets at 267 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* nbrOfReferenceBTSs at 270 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* referenceRelation at 274 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MultipleSets_specs_1 = { sizeof(struct MultipleSets), offsetof(struct MultipleSets, _asn_ctx), asn_MAP_MultipleSets_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_MultipleSets_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_MultipleSets_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MultipleSets = { "MultipleSets", @@ -126,16 +123,15 @@ asn_TYPE_descriptor_t asn_DEF_MultipleSets = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MultipleSets_tags_1, - sizeof(asn_DEF_MultipleSets_tags_1) - /sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ - asn_DEF_MultipleSets_tags_1, /* Same as above */ - sizeof(asn_DEF_MultipleSets_tags_1) - /sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MultipleSets_tags_1) / + sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ + asn_DEF_MultipleSets_tags_1, /* Same as above */ + sizeof(asn_DEF_MultipleSets_tags_1) / + sizeof(asn_DEF_MultipleSets_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MultipleSets_1, - 3, /* Elements count */ - &asn_SPC_MultipleSets_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_MultipleSets_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/MultipleSets.h b/src/core/libs/supl/asn-rrlp/MultipleSets.h index 9a046db33..daa565302 100644 --- a/src/core/libs/supl/asn-rrlp/MultipleSets.h +++ b/src/core/libs/supl/asn-rrlp/MultipleSets.h @@ -7,7 +7,6 @@ #ifndef _MultipleSets_H_ #define _MultipleSets_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/NULL.c b/src/core/libs/supl/asn-rrlp/NULL.c index 43350d12b..c6950577d 100644 --- a/src/core/libs/supl/asn-rrlp/NULL.c +++ b/src/core/libs/supl/asn-rrlp/NULL.c @@ -5,55 +5,56 @@ #include #include #include -#include /* Implemented in terms of BOOLEAN type */ +#include /* Implemented in terms of BOOLEAN type */ /* * NULL basic type description. */ static ber_tlv_tag_t asn_DEF_NULL_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (5 << 2))}; asn_TYPE_descriptor_t asn_DEF_NULL = { "NULL", "NULL", BOOLEAN_free, NULL_print, asn_generic_no_constraint, - BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ + BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ NULL_encode_der, /* Special handling of DER encoding */ NULL_decode_xer, NULL_encode_xer, - NULL_decode_uper, /* Unaligned PER decoder */ - NULL_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + NULL_decode_uper, /* Unaligned PER decoder */ + NULL_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NULL_tags, sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), - asn_DEF_NULL_tags, /* Same as above */ + asn_DEF_NULL_tags, /* Same as above */ sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -asn_enc_rval_t -NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t erval; erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = ptr; - } + if (erval.encoded == -1) + { + erval.failed_type = td; + erval.structure_ptr = ptr; + } _ASN_ENCODED_OK(erval); } -asn_enc_rval_t -NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; (void)td; @@ -68,45 +69,51 @@ NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, _ASN_ENCODED_OK(er); } - -static enum xer_pbd_rval -NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { +static enum xer_pbd_rval NULL__xer_body_decode(asn_TYPE_descriptor_t *td, + void *sptr, + const void *chunk_buf, + size_t chunk_size) +{ (void)td; (void)sptr; - if(xer_is_whitespace(chunk_buf, chunk_size)) + if (xer_is_whitespace(chunk_buf, chunk_size)) return XPBD_BODY_CONSUMED; else return XPBD_BROKEN_ENCODING; } -asn_dec_rval_t -NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(NULL_t), opt_mname, buf_ptr, size, - NULL__xer_body_decode); +asn_dec_rval_t NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ + return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(NULL_t), + opt_mname, buf_ptr, size, + NULL__xer_body_decode); } -int -NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ - - if(sptr) { - return (cb("", 9, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + if (sptr) + { + return (cb("", 9, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -asn_dec_rval_t -NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, + asn_per_data_t *pd) +{ asn_dec_rval_t rv; (void)opt_codec_ctx; @@ -114,14 +121,18 @@ NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, (void)constraints; (void)pd; - if(!*sptr) { - *sptr = MALLOC(sizeof(NULL_t)); - if(*sptr) { - *(NULL_t *)*sptr = 0; - } else { - _ASN_DECODE_FAILED; + if (!*sptr) + { + *sptr = MALLOC(sizeof(NULL_t)); + if (*sptr) + { + *(NULL_t *)*sptr = 0; + } + else + { + _ASN_DECODE_FAILED; + } } - } /* * NULL type does not have content octets. @@ -132,9 +143,10 @@ NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } -asn_enc_rval_t -NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, - void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t NULL_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, + asn_per_outp_t *po) +{ asn_enc_rval_t er; (void)td; diff --git a/src/core/libs/supl/asn-rrlp/NULL.h b/src/core/libs/supl/asn-rrlp/NULL.h index 5720faf3b..8b04ed03e 100644 --- a/src/core/libs/supl/asn-rrlp/NULL.h +++ b/src/core/libs/supl/asn-rrlp/NULL.h @@ -13,9 +13,9 @@ extern "C" #endif /* - * The value of the NULL type is meaningless: see BOOLEAN if you want to - * carry true/false semantics. - */ + * The value of the NULL type is meaningless: see BOOLEAN if you want to + * carry true/false semantics. + */ typedef int NULL_t; extern asn_TYPE_descriptor_t asn_DEF_NULL; diff --git a/src/core/libs/supl/asn-rrlp/NativeEnumerated.c b/src/core/libs/supl/asn-rrlp/NativeEnumerated.c index d67c75c5c..dd4d3f235 100644 --- a/src/core/libs/supl/asn-rrlp/NativeEnumerated.c +++ b/src/core/libs/supl/asn-rrlp/NativeEnumerated.c @@ -16,10 +16,9 @@ * NativeEnumerated basic type description. */ static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { - "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ "ENUMERATED", NativeInteger_free, NativeInteger_print, @@ -32,92 +31,108 @@ asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { NativeEnumerated_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeEnumerated_tags, - sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), - asn_DEF_NativeEnumerated_tags, /* Same as above */ - sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_NativeEnumerated_tags) / + sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / + sizeof(asn_DEF_NativeEnumerated_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -asn_enc_rval_t -NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; - const long *native = (const long *)sptr; +asn_enc_rval_t NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, + void *sptr, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + const long *native = (const long *)sptr; const asn_INTEGER_enum_map_t *el; - (void)ilevel; - (void)flags; + (void)ilevel; + (void)flags; - if(!native) _ASN_ENCODE_FAILED; + if (!native) _ASN_ENCODE_FAILED; el = INTEGER_map_value2enum(specs, *native); - if(el) { - size_t srcsize = el->enum_len + 5; - char *src = (char *)alloca(srcsize); + if (el) + { + size_t srcsize = el->enum_len + 5; + char *src = (char *)alloca(srcsize); - er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); - assert(er.encoded > 0 && (size_t)er.encoded < srcsize); - if(cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } else { - ASN_DEBUG("ASN.1 forbids dealing with " - "unknown value of ENUMERATED type"); - _ASN_ENCODE_FAILED; - } + er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); + assert(er.encoded > 0 && (size_t)er.encoded < srcsize); + if (cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + else + { + ASN_DEBUG( + "ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + _ASN_ENCODE_FAILED; + } } -asn_dec_rval_t -NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, - void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; - asn_dec_rval_t rval = { RC_OK, 0 }; + asn_dec_rval_t rval = {RC_OK, 0}; long *native = (long *)*sptr; asn_per_constraint_t *ct; long value; (void)opt_codec_ctx; - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else _ASN_DECODE_FAILED; /* Mandatory! */ - if(!specs) _ASN_DECODE_FAILED; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + _ASN_DECODE_FAILED; /* Mandatory! */ + if (!specs) _ASN_DECODE_FAILED; - if(!native) { - native = (long *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); - if(ct->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) _ASN_DECODE_STARVED; - if(inext) ct = 0; - } + if (ct->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) _ASN_DECODE_STARVED; + if (inext) ct = 0; + } - if(ct && ct->range_bits >= 0) { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - if(value >= (specs->extension - ? specs->extension - 1 : specs->map_count)) - _ASN_DECODE_FAILED; - } else { - if(!specs->extension) - _ASN_DECODE_FAILED; - /* - * X.691, #10.6: normally small non-negative whole number; - */ - value = uper_get_nsnnwn(pd); - if(value < 0) _ASN_DECODE_STARVED; - value += specs->extension - 1; - if(value >= specs->map_count) - _ASN_DECODE_FAILED; - } + if (ct && ct->range_bits >= 0) + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + if (value >= + (specs->extension ? specs->extension - 1 : specs->map_count)) + _ASN_DECODE_FAILED; + } + else + { + if (!specs->extension) _ASN_DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if (value < 0) _ASN_DECODE_STARVED; + value += specs->extension - 1; + if (value >= specs->map_count) _ASN_DECODE_FAILED; + } *native = specs->value2enum[value].nat_value; ASN_DEBUG("Decoded %s = %ld", td->name, *native); @@ -125,20 +140,19 @@ NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } -static int -NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { +static int NativeEnumerated__compar_value2enum(const void *ap, const void *bp) +{ const asn_INTEGER_enum_map_t *a = ap; const asn_INTEGER_enum_map_t *b = bp; - if(a->nat_value == b->nat_value) - return 0; - if(a->nat_value < b->nat_value) - return -1; + if (a->nat_value == b->nat_value) return 0; + if (a->nat_value < b->nat_value) return -1; return 1; } -asn_enc_rval_t -NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native; @@ -148,61 +162,65 @@ NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, asn_INTEGER_enum_map_t key; asn_INTEGER_enum_map_t *kf; - if(!sptr) _ASN_ENCODE_FAILED; - if(!specs) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; + if (!specs) _ASN_ENCODE_FAILED; - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else _ASN_ENCODE_FAILED; /* Mandatory! */ + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + _ASN_ENCODE_FAILED; /* Mandatory! */ ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); er.encoded = 0; native = *(long *)sptr; - if(native < 0) _ASN_ENCODE_FAILED; + if (native < 0) _ASN_ENCODE_FAILED; key.nat_value = native; - kf = bsearch(&key, specs->value2enum, specs->map_count, - sizeof(key), NativeEnumerated__compar_value2enum); - if(!kf) { - ASN_DEBUG("No element corresponds to %ld", native); - _ASN_ENCODE_FAILED; - } + kf = bsearch(&key, specs->value2enum, specs->map_count, sizeof(key), + NativeEnumerated__compar_value2enum); + if (!kf) + { + ASN_DEBUG("No element corresponds to %ld", native); + _ASN_ENCODE_FAILED; + } value = kf - specs->value2enum; - if(ct->range_bits >= 0) { - int cmpWith = specs->extension - ? specs->extension - 1 : specs->map_count; - if(value >= cmpWith) - inext = 1; - } - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, inext, 1)) + if (ct->range_bits >= 0) + { + int cmpWith = + specs->extension ? specs->extension - 1 : specs->map_count; + if (value >= cmpWith) inext = 1; + } + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + if (inext) ct = 0; + } + else if (inext) + { _ASN_ENCODE_FAILED; - if(inext) ct = 0; - } else if(inext) { - _ASN_ENCODE_FAILED; - } + } - if(ct && ct->range_bits >= 0) { - if(per_put_few_bits(po, value, ct->range_bits)) - _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } + if (ct && ct->range_bits >= 0) + { + if (per_put_few_bits(po, value, ct->range_bits)) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } - if(!specs->extension) - _ASN_ENCODE_FAILED; + if (!specs->extension) _ASN_ENCODE_FAILED; /* * X.691, #10.6: normally small non-negative whole number; */ - ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", - value, specs->extension, inext, - value - (inext ? (specs->extension - 1) : 0)); - if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", value, + specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if (uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } - diff --git a/src/core/libs/supl/asn-rrlp/NativeInteger.c b/src/core/libs/supl/asn-rrlp/NativeInteger.c index 4d933a9ee..4439da598 100644 --- a/src/core/libs/supl/asn-rrlp/NativeInteger.c +++ b/src/core/libs/supl/asn-rrlp/NativeInteger.c @@ -17,10 +17,9 @@ * NativeInteger basic type description. */ static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_NativeInteger = { - "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", /* The ASN.1 type is still INTEGER */ "INTEGER", NativeInteger_free, NativeInteger_print, @@ -29,26 +28,28 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = { NativeInteger_encode_der, NativeInteger_decode_xer, NativeInteger_encode_xer, - NativeInteger_decode_uper, /* Unaligned PER decoder */ - NativeInteger_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeInteger_tags, sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), - asn_DEF_NativeInteger_tags, /* Same as above */ + asn_DEF_NativeInteger_tags, /* Same as above */ sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Decode INTEGER type. */ -asn_dec_rval_t -NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **nint_ptr, const void *buf_ptr, + size_t size, int tag_mode) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; long *native = (long *)*nint_ptr; asn_dec_rval_t rval; ber_tlv_len_t length; @@ -56,25 +57,25 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * If the structure is not there, allocate it. */ - if(native == NULL) { - native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); - if(native == NULL) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; + if (native == NULL) + { + native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if (native == NULL) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } } - } - ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", td->name, tag_mode); /* * Check tags. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); @@ -83,11 +84,12 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } /* * ASN.1 encoded INTEGER: buf_ptr, length @@ -96,7 +98,8 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, */ { INTEGER_t tmp; - union { + union + { const void *constbuf; void *nonconstbuf; } unconst_buf; @@ -106,13 +109,14 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; tmp.size = length; - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmp, (uint64_t*)&l) - : asn_INTEGER2long(&tmp, &l)) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; - } + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, (uint64_t *)&l) + : asn_INTEGER2long(&tmp, &l)) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } *native = l; } @@ -120,8 +124,8 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", - (long)rval.consumed, (long)length, td->name, *native); + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", (long)rval.consumed, + (long)length, td->name, *native); return rval; } @@ -129,114 +133,125 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * Encode the NativeInteger using the standard INTEGER type DER encoder. */ -asn_enc_rval_t -NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */ +asn_enc_rval_t NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */ asn_enc_rval_t erval; INTEGER_t tmp; -#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ tmp.buf = (uint8_t *)&native; tmp.size = sizeof(native); -#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ uint8_t buf[sizeof(native)]; uint8_t *p; /* Prepare a fake INTEGER */ - for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + for (p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) *p = (uint8_t)native; tmp.buf = buf; tmp.size = sizeof(buf); -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ /* Encode fake INTEGER */ erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); - if(erval.encoded == -1) { - assert(erval.structure_ptr == &tmp); - erval.structure_ptr = ptr; - } + if (erval.encoded == -1) + { + assert(erval.structure_ptr == &tmp); + erval.structure_ptr = ptr; + } return erval; } /* * Decode the chunk of XML text encoding INTEGER. */ -asn_dec_rval_t -NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, + const void *buf_ptr, size_t size) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; INTEGER_t st; void *st_ptr = (void *)&st; long *native = (long *)*sptr; - if(!native) { - native = (long *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } memset(&st, 0, sizeof(st)); - rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, - opt_mname, buf_ptr, size); - if(rval.code == RC_OK) { - int64_t l; - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&st, (uint64_t*)&l) - : asn_INTEGER2long(&st, &l)) { - rval.code = RC_FAIL; - rval.consumed = 0; - } else { - *native = l; + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, + size); + if (rval.code == RC_OK) + { + int64_t l; + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&st, (uint64_t *)&l) + : asn_INTEGER2long(&st, &l)) + { + rval.code = RC_FAIL; + rval.consumed = 0; + } + else + { + *native = l; + } + } + else + { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; } - } else { - /* - * Cannot restart from the middle; - * there is no place to save state in the native type. - * Request a continuation from the very beginning. - */ - rval.consumed = 0; - } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); return rval; } - -asn_enc_rval_t -NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - char scratch[32]; /* Enough for 64-bit int */ +asn_enc_rval_t NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ asn_enc_rval_t er; const long *native = (const long *)sptr; (void)ilevel; (void)flags; - if(!native) _ASN_ENCODE_FAILED; + if (!native) _ASN_ENCODE_FAILED; - er.encoded = snprintf(scratch, sizeof(scratch), - (specs && specs->field_unsigned) - ? "%lu" : "%ld", *native); - if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) - || cb(scratch, er.encoded, app_key) < 0) + er.encoded = + snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) ? "%lu" : "%ld", *native); + if (er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) || + cb(scratch, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } -asn_dec_rval_t -NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; int64_t *native = (int64_t *)*sptr; INTEGER_t tmpint; @@ -245,46 +260,46 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, (void)opt_codec_ctx; ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); - if(!native) { - native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } memset(&tmpint, 0, sizeof tmpint); - rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, - &tmpintptr, pd); - if(rval.code == RC_OK) { - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmpint, (uint64_t*)native) - : asn_INTEGER2long(&tmpint, native)) - rval.code = RC_FAIL; - else - ASN_DEBUG("NativeInteger %s got value %ld", - td->name, *native); - } + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, &tmpintptr, pd); + if (rval.code == RC_OK) + { + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (uint64_t *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", td->name, *native); + } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); return rval; } -asn_enc_rval_t -NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_enc_rval_t NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native; INTEGER_t tmpint; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; native = *(long *)sptr; ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); memset(&tmpint, 0, sizeof(tmpint)); - if((specs&&specs->field_unsigned) - ? asn_ulong2INTEGER(&tmpint, native) - : asn_long2INTEGER(&tmpint, native)) + if ((specs && specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) _ASN_ENCODE_FAILED; er = INTEGER_encode_uper(td, constraints, &tmpint, po); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); @@ -294,38 +309,40 @@ NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, /* * INTEGER specific human-readable output. */ -int -NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +int NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const long *native = (const long *)sptr; - char scratch[32]; /* Enough for 64-bit int */ + char scratch[32]; /* Enough for 64-bit int */ int ret; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(native) { - ret = snprintf(scratch, sizeof(scratch), - (specs && specs->field_unsigned) - ? "%lu" : "%ld", *native); - assert(ret > 0 && (size_t)ret < sizeof(scratch)); - return (cb(scratch, ret, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + if (native) + { + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) ? "%lu" : "%ld", + *native); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + return (cb(scratch, ret, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -void -NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { +void NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (!td || !ptr) return; - if(!td || !ptr) - return; + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", td->name, contents_only, + ptr); - ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", - td->name, contents_only, ptr); - - if(!contents_only) { - FREEMEM(ptr); - } + if (!contents_only) + { + FREEMEM(ptr); + } } diff --git a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c index 26c825c1e..5f729c464 100644 --- a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c +++ b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.c @@ -6,661 +6,672 @@ #include "NavModel-KeplerianSet.h" -static int -memb_keplerToeLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerToeLSB_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerW_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerDeltaN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerDeltaN_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerM0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerOmegaDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerOmegaDot_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerELSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerELSB_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 33554431)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 33554431)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerIDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerIDot_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8192 && value <= 8191)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8192 && value <= 8191)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerAPowerHalfLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerAPowerHalfLSB_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 67108863)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 67108863)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerI0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerI0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerOmega0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerOmega0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCrs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCrs_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCis_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCis_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCus_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCus_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCrc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCrc_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCic_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCic_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_keplerCuc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_keplerCuc_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_KEPLER_TOE_LSB_CONSTR_2 = { - { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 9, 9, 0, 511} /* (0..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_W_CONSTR_3 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_DELTA_N_CONSTR_4 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_M0_CONSTR_5 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_OMEGA_DOT_CONSTR_6 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_ELSB_CONSTR_7 = { - { APC_CONSTRAINED, 25, -1, 0, 33554431 } /* (0..33554431) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 25, -1, 0, 33554431} /* (0..33554431) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_I_DOT_CONSTR_8 = { - { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, -8192, 8191} /* (-8192..8191) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_A_POWER_HALF_LSB_CONSTR_9 = { - { APC_CONSTRAINED, 26, -1, 0, 67108863 } /* (0..67108863) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 26, -1, 0, 67108863} /* (0..67108863) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_I0_CONSTR_10 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_OMEGA0_CONSTR_11 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CRS_CONSTR_12 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CIS_CONSTR_13 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CUS_CONSTR_14 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CRC_CONSTR_15 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CIC_CONSTR_16 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_KEPLER_CUC_CONSTR_17 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_NavModel_KeplerianSet_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerToeLSB), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerToeLSB_constraint_1, - &ASN_PER_MEMB_KEPLER_TOE_LSB_CONSTR_2, - 0, - "keplerToeLSB" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerW), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerW_constraint_1, - &ASN_PER_MEMB_KEPLER_W_CONSTR_3, - 0, - "keplerW" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerDeltaN), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerDeltaN_constraint_1, - &ASN_PER_MEMB_KEPLER_DELTA_N_CONSTR_4, - 0, - "keplerDeltaN" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerM0), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerM0_constraint_1, - &ASN_PER_MEMB_KEPLER_M0_CONSTR_5, - 0, - "keplerM0" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmegaDot), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerOmegaDot_constraint_1, - &ASN_PER_MEMB_KEPLER_OMEGA_DOT_CONSTR_6, - 0, - "keplerOmegaDot" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerELSB), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerELSB_constraint_1, - &ASN_PER_MEMB_KEPLER_ELSB_CONSTR_7, - 0, - "keplerELSB" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerIDot), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerIDot_constraint_1, - &ASN_PER_MEMB_KEPLER_I_DOT_CONSTR_8, - 0, - "keplerIDot" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerAPowerHalfLSB), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerAPowerHalfLSB_constraint_1, - &ASN_PER_MEMB_KEPLER_A_POWER_HALF_LSB_CONSTR_9, - 0, - "keplerAPowerHalfLSB" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerI0), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerI0_constraint_1, - &ASN_PER_MEMB_KEPLER_I0_CONSTR_10, - 0, - "keplerI0" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmega0), - (ASN_TAG_CLASS_CONTEXT | (9 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerOmega0_constraint_1, - &ASN_PER_MEMB_KEPLER_OMEGA0_CONSTR_11, - 0, - "keplerOmega0" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrs), - (ASN_TAG_CLASS_CONTEXT | (10 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCrs_constraint_1, - &ASN_PER_MEMB_KEPLER_CRS_CONSTR_12, - 0, - "keplerCrs" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCis), - (ASN_TAG_CLASS_CONTEXT | (11 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCis_constraint_1, - &ASN_PER_MEMB_KEPLER_CIS_CONSTR_13, - 0, - "keplerCis" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCus), - (ASN_TAG_CLASS_CONTEXT | (12 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCus_constraint_1, - &ASN_PER_MEMB_KEPLER_CUS_CONSTR_14, - 0, - "keplerCus" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrc), - (ASN_TAG_CLASS_CONTEXT | (13 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCrc_constraint_1, - &ASN_PER_MEMB_KEPLER_CRC_CONSTR_15, - 0, - "keplerCrc" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCic), - (ASN_TAG_CLASS_CONTEXT | (14 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCic_constraint_1, - &ASN_PER_MEMB_KEPLER_CIC_CONSTR_16, - 0, - "keplerCic" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCuc), - (ASN_TAG_CLASS_CONTEXT | (15 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_keplerCuc_constraint_1, - &ASN_PER_MEMB_KEPLER_CUC_CONSTR_17, - 0, - "keplerCuc" - }, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerToeLSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerToeLSB_constraint_1, + &ASN_PER_MEMB_KEPLER_TOE_LSB_CONSTR_2, 0, "keplerToeLSB"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerW), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerW_constraint_1, + &ASN_PER_MEMB_KEPLER_W_CONSTR_3, 0, "keplerW"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerDeltaN), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerDeltaN_constraint_1, + &ASN_PER_MEMB_KEPLER_DELTA_N_CONSTR_4, 0, "keplerDeltaN"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerM0), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerM0_constraint_1, + &ASN_PER_MEMB_KEPLER_M0_CONSTR_5, 0, "keplerM0"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmegaDot), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerOmegaDot_constraint_1, + &ASN_PER_MEMB_KEPLER_OMEGA_DOT_CONSTR_6, 0, "keplerOmegaDot"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerELSB), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerELSB_constraint_1, + &ASN_PER_MEMB_KEPLER_ELSB_CONSTR_7, 0, "keplerELSB"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerIDot), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerIDot_constraint_1, + &ASN_PER_MEMB_KEPLER_I_DOT_CONSTR_8, 0, "keplerIDot"}, + {ATF_NOFLAGS, 0, + offsetof(struct NavModel_KeplerianSet, keplerAPowerHalfLSB), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerAPowerHalfLSB_constraint_1, + &ASN_PER_MEMB_KEPLER_A_POWER_HALF_LSB_CONSTR_9, 0, "keplerAPowerHalfLSB"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerI0), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerI0_constraint_1, + &ASN_PER_MEMB_KEPLER_I0_CONSTR_10, 0, "keplerI0"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerOmega0), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerOmega0_constraint_1, + &ASN_PER_MEMB_KEPLER_OMEGA0_CONSTR_11, 0, "keplerOmega0"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrs), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCrs_constraint_1, + &ASN_PER_MEMB_KEPLER_CRS_CONSTR_12, 0, "keplerCrs"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCis), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCis_constraint_1, + &ASN_PER_MEMB_KEPLER_CIS_CONSTR_13, 0, "keplerCis"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCus), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCus_constraint_1, + &ASN_PER_MEMB_KEPLER_CUS_CONSTR_14, 0, "keplerCus"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCrc), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCrc_constraint_1, + &ASN_PER_MEMB_KEPLER_CRC_CONSTR_15, 0, "keplerCrc"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCic), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCic_constraint_1, + &ASN_PER_MEMB_KEPLER_CIC_CONSTR_16, 0, "keplerCic"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModel_KeplerianSet, keplerCuc), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_keplerCuc_constraint_1, + &ASN_PER_MEMB_KEPLER_CUC_CONSTR_17, 0, "keplerCuc"}, }; static ber_tlv_tag_t asn_DEF_NavModel_KeplerianSet_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_NavModel_KeplerianSet_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* keplerToeLSB at 1254 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* keplerW at 1255 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* keplerDeltaN at 1256 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* keplerM0 at 1257 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* keplerOmegaDot at 1258 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* keplerELSB at 1259 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* keplerIDot at 1260 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* keplerAPowerHalfLSB at 1261 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* keplerI0 at 1262 */ - { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* keplerOmega0 at 1263 */ - { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* keplerCrs at 1264 */ - { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* keplerCis at 1265 */ - { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* keplerCus at 1266 */ - { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* keplerCrc at 1267 */ - { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* keplerCic at 1268 */ - { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 } /* keplerCuc at 1269 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* keplerToeLSB at 1254 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* keplerW at 1255 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* keplerDeltaN at 1256 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* keplerM0 at 1257 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* keplerOmegaDot at 1258 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* keplerELSB at 1259 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* keplerIDot at 1260 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* keplerAPowerHalfLSB at 1261 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0}, /* keplerI0 at 1262 */ + {(ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0}, /* keplerOmega0 at 1263 */ + {(ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0}, /* keplerCrs at 1264 */ + {(ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0}, /* keplerCis at 1265 */ + {(ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0}, /* keplerCus at 1266 */ + {(ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0}, /* keplerCrc at 1267 */ + {(ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0}, /* keplerCic at 1268 */ + {(ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0} /* keplerCuc at 1269 */ }; static asn_SEQUENCE_specifics_t asn_SPC_NavModel_KeplerianSet_specs_1 = { sizeof(struct NavModel_KeplerianSet), offsetof(struct NavModel_KeplerianSet, _asn_ctx), asn_MAP_NavModel_KeplerianSet_tag2el_1, - 16, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 16, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_NavModel_KeplerianSet = { "NavModel-KeplerianSet", @@ -674,16 +685,15 @@ asn_TYPE_descriptor_t asn_DEF_NavModel_KeplerianSet = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NavModel_KeplerianSet_tags_1, - sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) - /sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ - asn_DEF_NavModel_KeplerianSet_tags_1, /* Same as above */ - sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) - /sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) / + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ + asn_DEF_NavModel_KeplerianSet_tags_1, /* Same as above */ + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1) / + sizeof(asn_DEF_NavModel_KeplerianSet_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_NavModel_KeplerianSet_1, - 16, /* Elements count */ - &asn_SPC_NavModel_KeplerianSet_specs_1 /* Additional specs */ + 16, /* Elements count */ + &asn_SPC_NavModel_KeplerianSet_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h index 86acee170..32864f9da 100644 --- a/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h +++ b/src/core/libs/supl/asn-rrlp/NavModel-KeplerianSet.h @@ -7,7 +7,6 @@ #ifndef _NavModel_KeplerianSet_H_ #define _NavModel_KeplerianSet_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/NavModelElement.c b/src/core/libs/supl/asn-rrlp/NavModelElement.c index 0370431b7..b0637344a 100644 --- a/src/core/libs/supl/asn-rrlp/NavModelElement.c +++ b/src/core/libs/supl/asn-rrlp/NavModelElement.c @@ -7,40 +7,34 @@ #include "NavModelElement.h" static asn_TYPE_member_t asn_MBR_NavModelElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satelliteID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satelliteID" - }, - { ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satStatus), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SatStatus, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satStatus" - }, + {ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satelliteID"}, + {ATF_NOFLAGS, 0, offsetof(struct NavModelElement, satStatus), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SatStatus, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satStatus"}, }; static ber_tlv_tag_t asn_DEF_NavModelElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_NavModelElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 703 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* satStatus at 705 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satelliteID at 703 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* satStatus at 705 */ }; static asn_SEQUENCE_specifics_t asn_SPC_NavModelElement_specs_1 = { sizeof(struct NavModelElement), offsetof(struct NavModelElement, _asn_ctx), asn_MAP_NavModelElement_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_NavModelElement = { "NavModelElement", @@ -54,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_NavModelElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NavModelElement_tags_1, - sizeof(asn_DEF_NavModelElement_tags_1) - /sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ - asn_DEF_NavModelElement_tags_1, /* Same as above */ - sizeof(asn_DEF_NavModelElement_tags_1) - /sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_NavModelElement_tags_1) / + sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ + asn_DEF_NavModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_NavModelElement_tags_1) / + sizeof(asn_DEF_NavModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_NavModelElement_1, - 2, /* Elements count */ - &asn_SPC_NavModelElement_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_NavModelElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/NavModelElement.h b/src/core/libs/supl/asn-rrlp/NavModelElement.h index 71d2168a4..26cc9f352 100644 --- a/src/core/libs/supl/asn-rrlp/NavModelElement.h +++ b/src/core/libs/supl/asn-rrlp/NavModelElement.h @@ -7,7 +7,6 @@ #ifndef _NavModelElement_H_ #define _NavModelElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/NavigationModel.c b/src/core/libs/supl/asn-rrlp/NavigationModel.c index 539b50020..ad132ef17 100644 --- a/src/core/libs/supl/asn-rrlp/NavigationModel.c +++ b/src/core/libs/supl/asn-rrlp/NavigationModel.c @@ -7,30 +7,28 @@ #include "NavigationModel.h" static asn_TYPE_member_t asn_MBR_NavigationModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct NavigationModel, navModelList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfNavModelElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "navModelList" - }, + {ATF_NOFLAGS, 0, offsetof(struct NavigationModel, navModelList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfNavModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "navModelList"}, }; static ber_tlv_tag_t asn_DEF_NavigationModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_NavigationModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* navModelList at 697 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* navModelList at 697 */ }; static asn_SEQUENCE_specifics_t asn_SPC_NavigationModel_specs_1 = { sizeof(struct NavigationModel), offsetof(struct NavigationModel, _asn_ctx), asn_MAP_NavigationModel_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_NavigationModel = { "NavigationModel", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_NavigationModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NavigationModel_tags_1, - sizeof(asn_DEF_NavigationModel_tags_1) - /sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ - asn_DEF_NavigationModel_tags_1, /* Same as above */ - sizeof(asn_DEF_NavigationModel_tags_1) - /sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_NavigationModel_tags_1) / + sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ + asn_DEF_NavigationModel_tags_1, /* Same as above */ + sizeof(asn_DEF_NavigationModel_tags_1) / + sizeof(asn_DEF_NavigationModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_NavigationModel_1, - 1, /* Elements count */ - &asn_SPC_NavigationModel_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_NavigationModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/NavigationModel.h b/src/core/libs/supl/asn-rrlp/NavigationModel.h index 915e5cef5..2c158dcbe 100644 --- a/src/core/libs/supl/asn-rrlp/NavigationModel.h +++ b/src/core/libs/supl/asn-rrlp/NavigationModel.h @@ -7,7 +7,6 @@ #ifndef _NavigationModel_H_ #define _NavigationModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/NeighborIdentity.c b/src/core/libs/supl/asn-rrlp/NeighborIdentity.c index 6bbef2a2a..c932fd1f0 100644 --- a/src/core/libs/supl/asn-rrlp/NeighborIdentity.c +++ b/src/core/libs/supl/asn-rrlp/NeighborIdentity.c @@ -7,73 +7,57 @@ #include "NeighborIdentity.h" static asn_per_constraints_t ASN_PER_TYPE_NEIGHBOR_IDENTITY_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 5 } /* (0..5) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 5} /* (0..5) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_NeighborIdentity_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.bsicAndCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSICAndCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsicAndCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ci), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ci" - }, - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.multiFrameCarrier), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MultiFrameCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "multiFrameCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.requestIndex), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RequestIndex, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "requestIndex" - }, - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.systemInfoIndex), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SystemInfoIndex, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoIndex" - }, - { ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ciAndLAC), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellIDAndLAC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ciAndLAC" - }, + {ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.bsicAndCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSICAndCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsicAndCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ci), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ci"}, + {ATF_NOFLAGS, 0, + offsetof(struct NeighborIdentity, choice.multiFrameCarrier), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MultiFrameCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "multiFrameCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.requestIndex), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "requestIndex"}, + {ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.systemInfoIndex), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoIndex"}, + {ATF_NOFLAGS, 0, offsetof(struct NeighborIdentity, choice.ciAndLAC), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellIDAndLAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ciAndLAC"}, }; static asn_TYPE_tag2member_t asn_MAP_NeighborIdentity_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsicAndCarrier at 398 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ci at 399 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* multiFrameCarrier at 400 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* requestIndex at 401 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* systemInfoIndex at 402 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* ciAndLAC at 407 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bsicAndCarrier at 398 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ci at 399 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* multiFrameCarrier at 400 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* requestIndex at 401 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* systemInfoIndex at 402 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* ciAndLAC at 407 */ }; static asn_CHOICE_specifics_t asn_SPC_NeighborIdentity_specs_1 = { sizeof(struct NeighborIdentity), @@ -81,9 +65,9 @@ static asn_CHOICE_specifics_t asn_SPC_NeighborIdentity_specs_1 = { offsetof(struct NeighborIdentity, present), sizeof(((struct NeighborIdentity *)0)->present), asn_MAP_NeighborIdentity_tag2el_1, - 6, /* Count of tags in the map */ + 6, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_NeighborIdentity = { "NeighborIdentity", @@ -98,13 +82,12 @@ asn_TYPE_descriptor_t asn_DEF_NeighborIdentity = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_NEIGHBOR_IDENTITY_CONSTR_1, asn_MBR_NeighborIdentity_1, - 6, /* Elements count */ - &asn_SPC_NeighborIdentity_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_NeighborIdentity_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/NeighborIdentity.h b/src/core/libs/supl/asn-rrlp/NeighborIdentity.h index 18888de77..8923e9e4a 100644 --- a/src/core/libs/supl/asn-rrlp/NeighborIdentity.h +++ b/src/core/libs/supl/asn-rrlp/NeighborIdentity.h @@ -7,7 +7,6 @@ #ifndef _NeighborIdentity_H_ #define _NeighborIdentity_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c index fa4fabc5e..df8d88813 100644 --- a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c +++ b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.c @@ -6,119 +6,141 @@ #include "NumOfMeasurements.h" -int -NumOfMeasurements_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int NumOfMeasurements_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -NumOfMeasurements_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void NumOfMeasurements_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -NumOfMeasurements_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void NumOfMeasurements_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -NumOfMeasurements_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int NumOfMeasurements_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -NumOfMeasurements_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t NumOfMeasurements_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -NumOfMeasurements_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NumOfMeasurements_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -NumOfMeasurements_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t NumOfMeasurements_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -NumOfMeasurements_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NumOfMeasurements_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -NumOfMeasurements_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t NumOfMeasurements_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -NumOfMeasurements_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t NumOfMeasurements_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ NumOfMeasurements_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_NUM_OF_MEASUREMENTS_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_NumOfMeasurements_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_NumOfMeasurements = { "NumOfMeasurements", "NumOfMeasurements", @@ -131,15 +153,15 @@ asn_TYPE_descriptor_t asn_DEF_NumOfMeasurements = { NumOfMeasurements_encode_xer, NumOfMeasurements_decode_uper, NumOfMeasurements_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NumOfMeasurements_tags_1, - sizeof(asn_DEF_NumOfMeasurements_tags_1) - /sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ - asn_DEF_NumOfMeasurements_tags_1, /* Same as above */ - sizeof(asn_DEF_NumOfMeasurements_tags_1) - /sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ + sizeof(asn_DEF_NumOfMeasurements_tags_1) / + sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ + asn_DEF_NumOfMeasurements_tags_1, /* Same as above */ + sizeof(asn_DEF_NumOfMeasurements_tags_1) / + sizeof(asn_DEF_NumOfMeasurements_tags_1[0]), /* 1 */ &ASN_PER_TYPE_NUM_OF_MEASUREMENTS_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h index 412f86456..46cd42335 100644 --- a/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h +++ b/src/core/libs/supl/asn-rrlp/NumOfMeasurements.h @@ -7,7 +7,6 @@ #ifndef _NumOfMeasurements_H_ #define _NumOfMeasurements_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c index f7fbf670e..e66360994 100644 --- a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c @@ -5,104 +5,116 @@ */ #include #include -#include /* for .bits_unused member */ +#include /* for .bits_unused member */ #include /* * OCTET STRING basic type description. */ static ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { - sizeof(OCTET_STRING_t), - offsetof(OCTET_STRING_t, _asn_ctx), - ASN_OSUBV_STR -}; + sizeof(OCTET_STRING_t), offsetof(OCTET_STRING_t, _asn_ctx), ASN_OSUBV_STR}; static asn_per_constraints_t ASN_DEF_OCTET_STRING_CONSTRAINTS = { - { APC_CONSTRAINED, 8, 8, 0, 255 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, - 0, 0 -}; + {APC_CONSTRAINED, 8, 8, 0, 255}, + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { - "OCTET STRING", /* Canonical name */ - "OCTET_STRING", /* XML tag name */ + "OCTET STRING", /* Canonical name */ + "OCTET_STRING", /* XML tag name */ OCTET_STRING_free, - OCTET_STRING_print, /* non-ascii stuff, generally */ + OCTET_STRING_print, /* non-ascii stuff, generally */ asn_generic_no_constraint, OCTET_STRING_decode_ber, OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, - OCTET_STRING_decode_uper, /* Unaligned PER decoder */ - OCTET_STRING_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OCTET_STRING_tags, - sizeof(asn_DEF_OCTET_STRING_tags) - / sizeof(asn_DEF_OCTET_STRING_tags[0]), - asn_DEF_OCTET_STRING_tags, /* Same as above */ - sizeof(asn_DEF_OCTET_STRING_tags) - / sizeof(asn_DEF_OCTET_STRING_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - &asn_DEF_OCTET_STRING_specs -}; + sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), + asn_DEF_OCTET_STRING_tags, /* Same as above */ + sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + &asn_DEF_OCTET_STRING_specs}; -#undef _CH_PHASE -#undef NEXT_PHASE -#undef PREV_PHASE -#define _CH_PHASE(ctx, inc) do { \ - if((ctx)->phase == 0) \ - (ctx)->context = 0; \ - (ctx)->phase += (inc); \ - } while(0) -#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) -#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) +#undef _CH_PHASE +#undef NEXT_PHASE +#undef PREV_PHASE +#define _CH_PHASE(ctx, inc) \ + do \ + { \ + if ((ctx)->phase == 0) (ctx)->context = 0; \ + (ctx)->phase += (inc); \ + } \ + while (0) +#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) +#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = (num_bytes); \ - buf_ptr = ((const char *)buf_ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) -#undef RETURN -#define RETURN(_code) do { \ - asn_dec_rval_t tmprval; \ - tmprval.code = _code; \ - tmprval.consumed = consumed_myself; \ - return tmprval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } \ + while (0) -#undef APPEND -#define APPEND(bufptr, bufsize) do { \ - size_t _bs = (bufsize); /* Append size */ \ - size_t _ns = ctx->context; /* Allocated now */ \ - size_t _es = st->size + _bs; /* Expected size */ \ - /* int is really a typeof(st->size): */ \ - if((int)_es < 0) RETURN(RC_FAIL); \ - if(_ns <= _es) { \ - void *ptr; \ - /* Be nice and round to the memory allocator */ \ - do { _ns = _ns ? _ns << 1 : 16; } \ - while(_ns <= _es); \ - /* int is really a typeof(st->size): */ \ - if((int)_ns < 0) RETURN(RC_FAIL); \ - ptr = REALLOC(st->buf, _ns); \ - if(ptr) { \ - st->buf = (uint8_t *)ptr; \ - ctx->context = _ns; \ - } else { \ - RETURN(RC_FAIL); \ - } \ - ASN_DEBUG("Reallocating into %ld", (long)_ns); \ - } \ - memcpy(st->buf + st->size, bufptr, _bs); \ - /* Convenient nul-termination */ \ - st->buf[_es] = '\0'; \ - st->size = _es; \ - } while(0) +#undef APPEND +#define APPEND(bufptr, bufsize) \ + do \ + { \ + size_t _bs = (bufsize); /* Append size */ \ + size_t _ns = ctx->context; /* Allocated now */ \ + size_t _es = st->size + _bs; /* Expected size */ \ + /* int is really a typeof(st->size): */ \ + if ((int)_es < 0) RETURN(RC_FAIL); \ + if (_ns <= _es) \ + { \ + void *ptr; \ + /* Be nice and round to the memory allocator */ \ + do \ + { \ + _ns = _ns ? _ns << 1 : 16; \ + } \ + while (_ns <= _es); \ + /* int is really a typeof(st->size): */ \ + if ((int)_ns < 0) RETURN(RC_FAIL); \ + ptr = REALLOC(st->buf, _ns); \ + if (ptr) \ + { \ + st->buf = (uint8_t *)ptr; \ + ctx->context = _ns; \ + } \ + else \ + { \ + RETURN(RC_FAIL); \ + } \ + ASN_DEBUG("Reallocating into %ld", (long)_ns); \ + } \ + memcpy(st->buf + st->size, bufptr, _bs); \ + /* Convenient nul-termination */ \ + st->buf[_es] = '\0'; \ + st->size = _es; \ + } \ + while (0) /* * The main reason why ASN.1 is still alive is that too much time and effort @@ -110,403 +122,465 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { * necessity to demonstrate that acquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ -struct _stack_el { - ber_tlv_len_t left; /* What's left to read (or -1) */ - ber_tlv_len_t got; /* What was actually processed */ - int cont_level; /* Depth of subcontainment */ - int want_nulls; /* Want null "end of content" octets? */ - int bits_chopped; /* Flag in BIT STRING mode */ - ber_tlv_tag_t tag; /* For debugging purposes */ +struct _stack_el +{ + ber_tlv_len_t left; /* What's left to read (or -1) */ + ber_tlv_len_t got; /* What was actually processed */ + int cont_level; /* Depth of subcontainment */ + int want_nulls; /* Want null "end of content" octets? */ + int bits_chopped; /* Flag in BIT STRING mode */ + ber_tlv_tag_t tag; /* For debugging purposes */ struct _stack_el *prev; struct _stack_el *next; }; -struct _stack { +struct _stack +{ struct _stack_el *tail; struct _stack_el *cur_ptr; }; -static struct _stack_el * -OS__add_stack_el(struct _stack *st) { +static struct _stack_el *OS__add_stack_el(struct _stack *st) +{ struct _stack_el *nel; /* * Reuse the old stack frame or allocate a new one. */ - if(st->cur_ptr && st->cur_ptr->next) { - nel = st->cur_ptr->next; - nel->bits_chopped = 0; - nel->got = 0; - /* Retain the nel->cont_level, it's correct. */ - } else { - nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); - if(nel == NULL) - return NULL; - - if(st->tail) { - /* Increase a subcontainment depth */ - nel->cont_level = st->tail->cont_level + 1; - st->tail->next = nel; + if (st->cur_ptr && st->cur_ptr->next) + { + nel = st->cur_ptr->next; + nel->bits_chopped = 0; + nel->got = 0; + /* Retain the nel->cont_level, it's correct. */ + } + else + { + nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); + if (nel == NULL) return NULL; + + if (st->tail) + { + /* Increase a subcontainment depth */ + nel->cont_level = st->tail->cont_level + 1; + st->tail->next = nel; + } + nel->prev = st->tail; + st->tail = nel; } - nel->prev = st->tail; - st->tail = nel; - } st->cur_ptr = nel; return nel; } -static struct _stack * -_new_stack() { +static struct _stack *_new_stack() +{ return (struct _stack *)CALLOC(1, sizeof(struct _stack)); } /* * Decode OCTET STRING type. */ -asn_dec_rval_t -OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, const void *buf_ptr, size_t size, int tag_mode) { - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; +asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buf_ptr, size_t size, + int tag_mode) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; asn_dec_rval_t rval; asn_struct_ctx_t *ctx; ssize_t consumed_myself = 0; - struct _stack *stck; /* Expectations stack structure */ - struct _stack_el *sel = 0; /* Stack element */ + struct _stack *stck; /* Expectations stack structure */ + struct _stack_el *sel = 0; /* Stack element */ int tlv_constr; enum asn_OS_Subvariant type_variant = specs->subvariant; - ASN_DEBUG("Decoding %s as %s (frame %ld)", - td->name, - (type_variant == ASN_OSUBV_STR) ? - "OCTET STRING" : "OS-SpecialCase", + ASN_DEBUG( + "Decoding %s as %s (frame %ld)", td->name, + (type_variant == ASN_OSUBV_STR) ? "OCTET STRING" : "OS-SpecialCase", (long)size); /* * Create the string if does not exist. */ - if(st == NULL) { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(st == NULL) RETURN(RC_FAIL); - } + if (st == NULL) + { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if (st == NULL) RETURN(RC_FAIL); + } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - switch(ctx->phase) { - case 0: - /* - * Check tags. - */ - rval = ber_check_tags(opt_codec_ctx, td, ctx, - buf_ptr, size, tag_mode, -1, - &ctx->left, &tlv_constr); - if(rval.code != RC_OK) - return rval; + switch (ctx->phase) + { + case 0: + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size, + tag_mode, -1, &ctx->left, &tlv_constr); + if (rval.code != RC_OK) return rval; - if(tlv_constr) { - /* - * Complex operation, requires stack of expectations. - */ - ctx->ptr = _new_stack(); - if(ctx->ptr) { + if (tlv_constr) + { + /* + * Complex operation, requires stack of expectations. + */ + ctx->ptr = _new_stack(); + if (ctx->ptr) + { + stck = (struct _stack *)ctx->ptr; + } + else + { + RETURN(RC_FAIL); + } + } + else + { + /* + * Jump into stackless primitive decoding. + */ + _CH_PHASE(ctx, 3); + if (type_variant == ASN_OSUBV_ANY && tag_mode != 1) + APPEND(buf_ptr, rval.consumed); + ADVANCE(rval.consumed); + goto phase3; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + phase1: + /* + * Fill the stack with expectations. + */ stck = (struct _stack *)ctx->ptr; - } else { - RETURN(RC_FAIL); - } - } else { - /* - * Jump into stackless primitive decoding. - */ - _CH_PHASE(ctx, 3); - if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) - APPEND(buf_ptr, rval.consumed); - ADVANCE(rval.consumed); - goto phase3; - } + sel = stck->cur_ptr; + do + { + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_tag_t expected_tag; + ssize_t tl; + ssize_t ll; + ssize_t tlvl; + /* This one works even if (sel->left == -1) */ + ssize_t Left = + ((!sel || (size_t)sel->left >= size) ? (ssize_t)size + : sel->left); - NEXT_PHASE(ctx); - /* Fall through */ - case 1: - phase1: - /* - * Fill the stack with expectations. - */ - stck = (struct _stack *)ctx->ptr; - sel = stck->cur_ptr; - do { - ber_tlv_tag_t tlv_tag; - ber_tlv_len_t tlv_len; - ber_tlv_tag_t expected_tag; - ssize_t tl; - ssize_t ll; - ssize_t tlvl; - /* This one works even if (sel->left == -1) */ - ssize_t Left = ((!sel||(size_t)sel->left >= size) - ?(ssize_t)size:sel->left); + ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, + (sel ? sel->left : 0), + (long)(sel ? sel->want_nulls : 0), + (sel ? sel->got : 0)); + if (sel && sel->left <= 0 && sel->want_nulls == 0) + { + if (sel->prev) + { + struct _stack_el *prev = sel->prev; + if (prev->left != -1) + { + if (prev->left < sel->got) + RETURN(RC_FAIL); + prev->left -= sel->got; + } + prev->got += sel->got; + sel = stck->cur_ptr = prev; + if (!sel) break; + tlv_constr = 1; + continue; + } + else + { + sel = stck->cur_ptr = 0; + break; /* Nothing to wait */ + } + } + tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); + ASN_DEBUG( + "fetch tag(size=%ld,L=%ld), %sstack, left=%ld, " + "wn=%ld, " + "tl=%ld", + (long)size, (long)Left, sel ? "" : "!", + (sel ? sel->left : 0), + (long)(sel ? sel->want_nulls : 0), (long)tl); + switch (tl) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } - ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, - (sel?sel->left:0), - (long)(sel?sel->want_nulls:0), - (sel?sel->got:0) - ); - if(sel && sel->left <= 0 && sel->want_nulls == 0) { - if(sel->prev) { - struct _stack_el *prev = sel->prev; - if(prev->left != -1) { - if(prev->left < sel->got) - RETURN(RC_FAIL); - prev->left -= sel->got; + tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); + + ll = ber_fetch_length(tlv_constr, + (const char *)buf_ptr + tl, + Left - tl, &tlv_len); + ASN_DEBUG( + "Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, " + "ll=%ld", + ber_tlv_tag_string(tlv_tag), tlv_constr, (long)Left, + (long)tl, (long)tlv_len, (long)ll); + switch (ll) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + + if (sel && sel->want_nulls && + ((const uint8_t *)buf_ptr)[0] == 0 && + ((const uint8_t *)buf_ptr)[1] == 0) + { + ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); + + if (type_variant == ASN_OSUBV_ANY && + (tag_mode != 1 || sel->cont_level)) + APPEND("\0\0", 2); + + ADVANCE(2); + sel->got += 2; + if (sel->left != -1) + { + sel->left -= + 2; /* assert(sel->left >= 2) */ + } + + sel->want_nulls--; + if (sel->want_nulls == 0) + { + /* Move to the next expectation */ + sel->left = 0; + tlv_constr = 1; + } + + continue; + } + + /* + * Set up expected tags, + * depending on ASN.1 type being decoded. + */ + switch (type_variant) + { + case ASN_OSUBV_BIT: + /* X.690: 8.6.4.1, NOTE 2 */ + /* Fall through */ + case ASN_OSUBV_STR: + default: + if (sel) + { + int level = sel->cont_level; + if (level < td->all_tags_count) + { + expected_tag = + td->all_tags[level]; + break; + } + else if (td->all_tags_count) + { + expected_tag = + td->all_tags + [td->all_tags_count - + 1]; + break; + } + /* else, Fall through */ + } + /* Fall through */ + case ASN_OSUBV_ANY: + expected_tag = tlv_tag; + break; + } + + if (tlv_tag != expected_tag) + { + char buf[2][32]; + ber_tlv_tag_snprint(tlv_tag, buf[0], + sizeof(buf[0])); + ber_tlv_tag_snprint( + td->tags[td->tags_count - 1], buf[1], + sizeof(buf[1])); + ASN_DEBUG( + "Tag does not match expectation: %s != %s", + buf[0], buf[1]); + RETURN(RC_FAIL); + } + + tlvl = + tl + ll; /* Combined length of T and L encoding */ + if ((tlv_len + tlvl) < 0) + { + /* tlv_len value is too big */ + ASN_DEBUG( + "TLV encoding + length (%ld) is too big", + (long)tlv_len); + RETURN(RC_FAIL); + } + + /* + * Append a new expectation. + */ + sel = OS__add_stack_el(stck); + if (!sel) RETURN(RC_FAIL); + + sel->tag = tlv_tag; + + sel->want_nulls = (tlv_len == -1); + if (sel->prev && sel->prev->left != -1) + { + /* Check that the parent frame is big enough */ + if (sel->prev->left < + tlvl + (tlv_len == -1 ? 0 : tlv_len)) + RETURN(RC_FAIL); + if (tlv_len == -1) + sel->left = sel->prev->left - tlvl; + else + sel->left = tlv_len; + } + else + { + sel->left = tlv_len; + } + if (type_variant == ASN_OSUBV_ANY && + (tag_mode != 1 || sel->cont_level)) + APPEND(buf_ptr, tlvl); + sel->got += tlvl; + ADVANCE(tlvl); + + ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", + (long)sel->got, (long)sel->left, + sel->want_nulls, sel->cont_level); + } + while (tlv_constr); + if (sel == NULL) + { + /* Finished operation, "phase out" */ + ASN_DEBUG("Phase out"); + _CH_PHASE(ctx, +3); + break; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 2: + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", + (long)sel->left, (long)size, (long)sel->got, + sel->want_nulls); + { + ber_tlv_len_t len; + + assert(sel->left >= 0); + + len = ((ber_tlv_len_t)size < sel->left) + ? (ber_tlv_len_t)size + : sel->left; + if (len > 0) + { + if (type_variant == ASN_OSUBV_BIT && + sel->bits_chopped == 0) + { + /* Put the unused-bits-octet away */ + st->bits_unused = *(const uint8_t *)buf_ptr; + APPEND(((const char *)buf_ptr + 1), + (len - 1)); + sel->bits_chopped = 1; + } + else + { + APPEND(buf_ptr, len); + } + ADVANCE(len); + sel->left -= len; + sel->got += len; + } + + if (sel->left) + { + ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", + (long)sel->left, (long)size, + sel->want_nulls); + RETURN(RC_WMORE); + } + + PREV_PHASE(ctx); + goto phase1; } - prev->got += sel->got; - sel = stck->cur_ptr = prev; - if(!sel) break; - tlv_constr = 1; - continue; - } else { - sel = stck->cur_ptr = 0; - break; /* Nothing to wait */ - } + break; + case 3: + phase3: + /* + * Primitive form, no stack required. + */ + assert(ctx->left >= 0); + + if (size < (size_t)ctx->left) + { + if (!size) RETURN(RC_WMORE); + if (type_variant == ASN_OSUBV_BIT && !ctx->context) + { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, size); + assert(ctx->context > 0); + ctx->left -= size; + ADVANCE(size); + RETURN(RC_WMORE); + } + else + { + if (type_variant == ASN_OSUBV_BIT && !ctx->context && + ctx->left) + { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, ctx->left); + ADVANCE(ctx->left); + ctx->left = 0; + + NEXT_PHASE(ctx); + } + break; } - tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); - ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", - (long)size, (long)Left, sel?"":"!", - (sel?sel->left:0), - (long)(sel?sel->want_nulls:0), - (long)tl); - switch(tl) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); - - ll = ber_fetch_length(tlv_constr, - (const char *)buf_ptr + tl,Left - tl,&tlv_len); - ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", - ber_tlv_tag_string(tlv_tag), tlv_constr, - (long)Left, (long)tl, (long)tlv_len, (long)ll); - switch(ll) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - if(sel && sel->want_nulls - && ((const uint8_t *)buf_ptr)[0] == 0 - && ((const uint8_t *)buf_ptr)[1] == 0) + if (sel) { - - ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); - - if(type_variant == ASN_OSUBV_ANY - && (tag_mode != 1 || sel->cont_level)) - APPEND("\0\0", 2); - - ADVANCE(2); - sel->got += 2; - if(sel->left != -1) { - sel->left -= 2; /* assert(sel->left >= 2) */ - } - - sel->want_nulls--; - if(sel->want_nulls == 0) { - /* Move to the next expectation */ - sel->left = 0; - tlv_constr = 1; - } - - continue; - } - - /* - * Set up expected tags, - * depending on ASN.1 type being decoded. - */ - switch(type_variant) { - case ASN_OSUBV_BIT: - /* X.690: 8.6.4.1, NOTE 2 */ - /* Fall through */ - case ASN_OSUBV_STR: - default: - if(sel) { - int level = sel->cont_level; - if(level < td->all_tags_count) { - expected_tag = td->all_tags[level]; - break; - } else if(td->all_tags_count) { - expected_tag = td->all_tags - [td->all_tags_count - 1]; - break; + ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", sel->prev, + sel->want_nulls, (long)sel->left, (long)sel->got, + (long)size); + if (sel->prev || sel->want_nulls > 1 || sel->left > 0) + { + RETURN(RC_WMORE); } - /* else, Fall through */ - } - /* Fall through */ - case ASN_OSUBV_ANY: - expected_tag = tlv_tag; - break; } - - if(tlv_tag != expected_tag) { - char buf[2][32]; - ber_tlv_tag_snprint(tlv_tag, - buf[0], sizeof(buf[0])); - ber_tlv_tag_snprint(td->tags[td->tags_count-1], - buf[1], sizeof(buf[1])); - ASN_DEBUG("Tag does not match expectation: %s != %s", - buf[0], buf[1]); - RETURN(RC_FAIL); - } - - tlvl = tl + ll; /* Combined length of T and L encoding */ - if((tlv_len + tlvl) < 0) { - /* tlv_len value is too big */ - ASN_DEBUG("TLV encoding + length (%ld) is too big", - (long)tlv_len); - RETURN(RC_FAIL); - } - - /* - * Append a new expectation. - */ - sel = OS__add_stack_el(stck); - if(!sel) RETURN(RC_FAIL); - - sel->tag = tlv_tag; - - sel->want_nulls = (tlv_len==-1); - if(sel->prev && sel->prev->left != -1) { - /* Check that the parent frame is big enough */ - if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) - RETURN(RC_FAIL); - if(tlv_len == -1) - sel->left = sel->prev->left - tlvl; - else - sel->left = tlv_len; - } else { - sel->left = tlv_len; - } - if(type_variant == ASN_OSUBV_ANY - && (tag_mode != 1 || sel->cont_level)) - APPEND(buf_ptr, tlvl); - sel->got += tlvl; - ADVANCE(tlvl); - - ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", - (long)sel->got, (long)sel->left, - sel->want_nulls, sel->cont_level); - - } while(tlv_constr); - if(sel == NULL) { - /* Finished operation, "phase out" */ - ASN_DEBUG("Phase out"); - _CH_PHASE(ctx, +3); - break; - } - - NEXT_PHASE(ctx); - /* Fall through */ - case 2: - stck = (struct _stack *)ctx->ptr; - sel = stck->cur_ptr; - ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", - (long)sel->left, (long)size, (long)sel->got, - sel->want_nulls); - { - ber_tlv_len_t len; - - assert(sel->left >= 0); - - len = ((ber_tlv_len_t)size < sel->left) - ? (ber_tlv_len_t)size : sel->left; - if(len > 0) { - if(type_variant == ASN_OSUBV_BIT - && sel->bits_chopped == 0) { - /* Put the unused-bits-octet away */ - st->bits_unused = *(const uint8_t *)buf_ptr; - APPEND(((const char *)buf_ptr+1), (len - 1)); - sel->bits_chopped = 1; - } else { - APPEND(buf_ptr, len); - } - ADVANCE(len); - sel->left -= len; - sel->got += len; - } - - if(sel->left) { - ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", - (long)sel->left, (long)size, sel->want_nulls); - RETURN(RC_WMORE); - } - - PREV_PHASE(ctx); - goto phase1; - } - break; - case 3: - phase3: - /* - * Primitive form, no stack required. - */ - assert(ctx->left >= 0); - - if(size < (size_t)ctx->left) { - if(!size) RETURN(RC_WMORE); - if(type_variant == ASN_OSUBV_BIT && !ctx->context) { - st->bits_unused = *(const uint8_t *)buf_ptr; - ctx->left--; - ADVANCE(1); - } - APPEND(buf_ptr, size); - assert(ctx->context > 0); - ctx->left -= size; - ADVANCE(size); - RETURN(RC_WMORE); - } else { - if(type_variant == ASN_OSUBV_BIT - && !ctx->context && ctx->left) { - st->bits_unused = *(const uint8_t *)buf_ptr; - ctx->left--; - ADVANCE(1); - } - APPEND(buf_ptr, ctx->left); - ADVANCE(ctx->left); - ctx->left = 0; - - NEXT_PHASE(ctx); - } - break; - } - - if(sel) { - ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", - sel->prev, sel->want_nulls, - (long)sel->left, (long)sel->got, (long)size); - if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { - RETURN(RC_WMORE); - } - } - /* * BIT STRING-specific processing. */ - if(type_variant == ASN_OSUBV_BIT && st->size) { - /* Finalize BIT STRING: zero out unused bits. */ - st->buf[st->size-1] &= 0xff << st->bits_unused; - } - - ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", - (long)consumed_myself, td->name, - (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", - (long)st->size); + if (type_variant == ASN_OSUBV_BIT && st->size) + { + /* Finalize BIT STRING: zero out unused bits. */ + st->buf[st->size - 1] &= 0xff << st->bits_unused; + } + ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", (long)consumed_myself, + td->name, + (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", + (long)st->size); RETURN(RC_OK); } @@ -514,63 +588,70 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * Encode OCTET STRING type using DER. */ -asn_enc_rval_t -OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_enc_rval_t er; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)sptr; enum asn_OS_Subvariant type_variant = specs->subvariant; int fix_last_byte = 0; - ASN_DEBUG("%s %s as OCTET STRING", - cb?"Estimating":"Encoding", td->name); + ASN_DEBUG("%s %s as OCTET STRING", cb ? "Estimating" : "Encoding", + td->name); /* * Write tags. */ - if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { - er.encoded = der_write_tags(td, - (type_variant == ASN_OSUBV_BIT) + st->size, - tag_mode, type_variant == ASN_OSUBV_ANY, tag, - cb, app_key); - if(er.encoded == -1) { - er.failed_type = td; - er.structure_ptr = sptr; - return er; + if (type_variant != ASN_OSUBV_ANY || tag_mode == 1) + { + er.encoded = der_write_tags( + td, (type_variant == ASN_OSUBV_BIT) + st->size, tag_mode, + type_variant == ASN_OSUBV_ANY, tag, cb, app_key); + if (er.encoded == -1) + { + er.failed_type = td; + er.structure_ptr = sptr; + return er; + } + } + else + { + /* Disallow: [] IMPLICIT ANY */ + assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); + er.encoded = 0; } - } else { - /* Disallow: [] IMPLICIT ANY */ - assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); - er.encoded = 0; - } - if(!cb) { - er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; - _ASN_ENCODED_OK(er); - } + if (!cb) + { + er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; + _ASN_ENCODED_OK(er); + } /* * Prepare to deal with the last octet of BIT STRING. */ - if(type_variant == ASN_OSUBV_BIT) { - uint8_t b = st->bits_unused & 0x07; - if(b && st->size) fix_last_byte = 1; - _ASN_CALLBACK(&b, 1); - er.encoded++; - } + if (type_variant == ASN_OSUBV_BIT) + { + uint8_t b = st->bits_unused & 0x07; + if (b && st->size) fix_last_byte = 1; + _ASN_CALLBACK(&b, 1); + er.encoded++; + } /* Invoke callback for the main part of the buffer */ _ASN_CALLBACK(st->buf, st->size - fix_last_byte); /* The last octet should be stripped off the unused bits */ - if(fix_last_byte) { - uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); - _ASN_CALLBACK(&b, 1); - } + if (fix_last_byte) + { + uint8_t b = st->buf[st->size - 1] & (0xff << st->bits_unused); + _ASN_CALLBACK(&b, 1); + } er.encoded += st->size; _ASN_ENCODED_OK(er); @@ -578,10 +659,12 @@ cb_failed: _ASN_ENCODE_FAILED; } -asn_enc_rval_t -OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; @@ -591,8 +674,7 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, uint8_t *end; size_t i; - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; er.encoded = 0; @@ -601,101 +683,129 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, */ buf = st->buf; end = buf + st->size; - if(flags & XER_F_CANONICAL) { - char *scend = scratch + (sizeof(scratch) - 2); - for(; buf < end; buf++) { - if(p >= scend) { - _ASN_CALLBACK(scratch, p - scratch); - er.encoded += p - scratch; - p = scratch; - } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - } + if (flags & XER_F_CANONICAL) + { + char *scend = scratch + (sizeof(scratch) - 2); + for (; buf < end; buf++) + { + if (p >= scend) + { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += p - scratch; + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + } - _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ - er.encoded += p - scratch; - } else { - for(i = 0; buf < end; buf++, i++) { - if(!(i % 16) && (i || st->size > 16)) { - _ASN_CALLBACK(scratch, p-scratch); - er.encoded += (p-scratch); - p = scratch; - _i_ASN_TEXT_INDENT(1, ilevel); - } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - if(p - scratch) { - p--; /* Remove the tail space */ - _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + _ASN_CALLBACK(scratch, p - scratch); /* Dump the rest */ er.encoded += p - scratch; - if(st->size > 16) - _i_ASN_TEXT_INDENT(1, ilevel-1); } - } + else + { + for (i = 0; buf < end; buf++, i++) + { + if (!(i % 16) && (i || st->size > 16)) + { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += (p - scratch); + p = scratch; + _i_ASN_TEXT_INDENT(1, ilevel); + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + if (p - scratch) + { + p--; /* Remove the tail space */ + _ASN_CALLBACK(scratch, p - scratch); /* Dump the rest */ + er.encoded += p - scratch; + if (st->size > 16) _i_ASN_TEXT_INDENT(1, ilevel - 1); + } + } _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -static struct OCTET_STRING__xer_escape_table_s { +static struct OCTET_STRING__xer_escape_table_s +{ char *string; int size; } OCTET_STRING__xer_escape_table[] = { -#define OSXET(s) { s, sizeof(s) - 1 } - OSXET("\074\156\165\154\057\076"), /* */ - OSXET("\074\163\157\150\057\076"), /* */ - OSXET("\074\163\164\170\057\076"), /* */ - OSXET("\074\145\164\170\057\076"), /* */ - OSXET("\074\145\157\164\057\076"), /* */ - OSXET("\074\145\156\161\057\076"), /* */ - OSXET("\074\141\143\153\057\076"), /* */ - OSXET("\074\142\145\154\057\076"), /* */ - OSXET("\074\142\163\057\076"), /* */ - OSXET("\011"), /* \t */ - OSXET("\012"), /* \n */ - OSXET("\074\166\164\057\076"), /* */ - OSXET("\074\146\146\057\076"), /* */ - OSXET("\015"), /* \r */ - OSXET("\074\163\157\057\076"), /* */ - OSXET("\074\163\151\057\076"), /* */ - OSXET("\074\144\154\145\057\076"), /* */ - OSXET("\074\144\143\061\057\076"), /* */ - OSXET("\074\144\143\062\057\076"), /* */ - OSXET("\074\144\143\063\057\076"), /* */ - OSXET("\074\144\143\064\057\076"), /* */ - OSXET("\074\156\141\153\057\076"), /* */ - OSXET("\074\163\171\156\057\076"), /* */ - OSXET("\074\145\164\142\057\076"), /* */ - OSXET("\074\143\141\156\057\076"), /* */ - OSXET("\074\145\155\057\076"), /* */ - OSXET("\074\163\165\142\057\076"), /* */ - OSXET("\074\145\163\143\057\076"), /* */ - OSXET("\074\151\163\064\057\076"), /* */ - OSXET("\074\151\163\063\057\076"), /* */ - OSXET("\074\151\163\062\057\076"), /* */ - OSXET("\074\151\163\061\057\076"), /* */ - { 0, 0 }, /* " " */ - { 0, 0 }, /* ! */ - { 0, 0 }, /* \" */ - { 0, 0 }, /* # */ - { 0, 0 }, /* $ */ - { 0, 0 }, /* % */ - OSXET("\046\141\155\160\073"), /* & */ - { 0, 0 }, /* ' */ - {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ - {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ - {0,0},{0,0},{0,0},{0,0}, /* 89:; */ - OSXET("\046\154\164\073"), /* < */ - { 0, 0 }, /* = */ - OSXET("\046\147\164\073"), /* > */ +#define OSXET(s) \ + { \ + s, sizeof(s) - 1 \ + } + OSXET("\074\156\165\154\057\076"), /* */ + OSXET("\074\163\157\150\057\076"), /* */ + OSXET("\074\163\164\170\057\076"), /* */ + OSXET("\074\145\164\170\057\076"), /* */ + OSXET("\074\145\157\164\057\076"), /* */ + OSXET("\074\145\156\161\057\076"), /* */ + OSXET("\074\141\143\153\057\076"), /* */ + OSXET("\074\142\145\154\057\076"), /* */ + OSXET("\074\142\163\057\076"), /* */ + OSXET("\011"), /* \t */ + OSXET("\012"), /* \n */ + OSXET("\074\166\164\057\076"), /* */ + OSXET("\074\146\146\057\076"), /* */ + OSXET("\015"), /* \r */ + OSXET("\074\163\157\057\076"), /* */ + OSXET("\074\163\151\057\076"), /* */ + OSXET("\074\144\154\145\057\076"), /* */ + OSXET("\074\144\143\061\057\076"), /* */ + OSXET("\074\144\143\062\057\076"), /* */ + OSXET("\074\144\143\063\057\076"), /* */ + OSXET("\074\144\143\064\057\076"), /* */ + OSXET("\074\156\141\153\057\076"), /* */ + OSXET("\074\163\171\156\057\076"), /* */ + OSXET("\074\145\164\142\057\076"), /* */ + OSXET("\074\143\141\156\057\076"), /* */ + OSXET("\074\145\155\057\076"), /* */ + OSXET("\074\163\165\142\057\076"), /* */ + OSXET("\074\145\163\143\057\076"), /* */ + OSXET("\074\151\163\064\057\076"), /* */ + OSXET("\074\151\163\063\057\076"), /* */ + OSXET("\074\151\163\062\057\076"), /* */ + OSXET("\074\151\163\061\057\076"), /* */ + {0, 0}, /* " " */ + {0, 0}, /* ! */ + {0, 0}, /* \" */ + {0, 0}, /* # */ + {0, 0}, /* $ */ + {0, 0}, /* % */ + OSXET("\046\141\155\160\073"), /* & */ + {0, 0}, /* ' */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* ()*+,-./ */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* 01234567 */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* 89:; */ + OSXET("\046\154\164\073"), /* < */ + {0, 0}, /* = */ + OSXET("\046\147\164\073"), /* > */ }; -static int -OS__check_escaped_control_char(const void *buf, int size) { +static int OS__check_escaped_control_char(const void *buf, int size) +{ size_t i; /* * Inefficient algorithm which translates the escape sequences @@ -703,78 +813,85 @@ OS__check_escaped_control_char(const void *buf, int size) { * TODO: replace by a faster algorithm (bsearch(), hash or * nested table lookups). */ - for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { - struct OCTET_STRING__xer_escape_table_s *el; - el = &OCTET_STRING__xer_escape_table[i]; - if(el->size == size && memcmp(buf, el->string, size) == 0) - return i; - } + for (i = 0; i < 32 /* Don't spend time on the bottom half */; i++) + { + struct OCTET_STRING__xer_escape_table_s *el; + el = &OCTET_STRING__xer_escape_table[i]; + if (el->size == size && memcmp(buf, el->string, size) == 0) + return i; + } return -1; } -static int -OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { +static int OCTET_STRING__handle_control_chars(void *struct_ptr, + const void *chunk_buf, + size_t chunk_size) +{ /* * This might be one of the escape sequences * for control characters. Check it out. * #11.15.5 */ - int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); - if(control_char >= 0) { - OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; - void *p = REALLOC(st->buf, st->size + 2); - if(p) { - st->buf = (uint8_t *)p; - st->buf[st->size++] = control_char; - st->buf[st->size] = '\0'; /* nul-termination */ - return 0; + int control_char = OS__check_escaped_control_char(chunk_buf, chunk_size); + if (control_char >= 0) + { + OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; + void *p = REALLOC(st->buf, st->size + 2); + if (p) + { + st->buf = (uint8_t *)p; + st->buf[st->size++] = control_char; + st->buf[st->size] = '\0'; /* nul-termination */ + return 0; + } } - } - return -1; /* No, it's not */ + return -1; /* No, it's not */ } -asn_enc_rval_t -OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, + void *sptr, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; uint8_t *buf; uint8_t *end; - uint8_t *ss; /* Sequence start */ + uint8_t *ss; /* Sequence start */ ssize_t encoded_len = 0; - (void)ilevel; /* Unused argument */ - (void)flags; /* Unused argument */ + (void)ilevel; /* Unused argument */ + (void)flags; /* Unused argument */ - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; buf = st->buf; end = buf + st->size; - for(ss = buf; buf < end; buf++) { - unsigned int ch = *buf; - int s_len; /* Special encoding sequence length */ + for (ss = buf; buf < end; buf++) + { + unsigned int ch = *buf; + int s_len; /* Special encoding sequence length */ - /* - * Escape certain characters: X.680/11.15 - */ - if(ch < sizeof(OCTET_STRING__xer_escape_table) - /sizeof(OCTET_STRING__xer_escape_table[0]) - && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { - if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) - || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, - app_key) < 0) - _ASN_ENCODE_FAILED; - encoded_len += (buf - ss) + s_len; - ss = buf + 1; + /* + * Escape certain characters: X.680/11.15 + */ + if (ch < sizeof(OCTET_STRING__xer_escape_table) / + sizeof(OCTET_STRING__xer_escape_table[0]) && + (s_len = OCTET_STRING__xer_escape_table[ch].size)) + { + if (((buf - ss) && cb(ss, buf - ss, app_key) < 0) || + cb(OCTET_STRING__xer_escape_table[ch].string, s_len, + app_key) < 0) + _ASN_ENCODE_FAILED; + encoded_len += (buf - ss) + s_len; + ss = buf + 1; + } } - } encoded_len += (buf - ss); - if((buf - ss) && cb(ss, buf - ss, app_key) < 0) - _ASN_ENCODE_FAILED; + if ((buf - ss) && cb(ss, buf - ss, app_key) < 0) _ASN_ENCODE_FAILED; er.encoded = encoded_len; _ASN_ENCODED_OK(er); @@ -783,19 +900,23 @@ OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, /* * Convert from hexadecimal format (cstring): "AB CD EF" */ -static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, + const void *chunk_buf, + size_t chunk_size, + int have_more) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *chunk_stop = (const char *)chunk_buf; const char *p = chunk_stop; const char *pend = p + chunk_size; unsigned int clv = 0; - int half = 0; /* Half bit */ + int half = 0; /* Half bit */ uint8_t *buf; /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 1) / 2; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; @@ -804,63 +925,91 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b * converted, and the rest skipped. That is, unless buf_size is greater * than chunk_size, then it'll be equivalent to "ABC0". */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - switch(ch) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* Ignore whitespace */ - continue; - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ - clv = (clv << 4) + (ch - 0x30); - break; - case 0x41: case 0x42: case 0x43: /* ABC */ - case 0x44: case 0x45: case 0x46: /* DEF */ - clv = (clv << 4) + (ch - 0x41 + 10); - break; - case 0x61: case 0x62: case 0x63: /* abc */ - case 0x64: case 0x65: case 0x66: /* def */ - clv = (clv << 4) + (ch - 0x61 + 10); - break; - default: - *buf = 0; /* JIC */ - return -1; + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + switch (ch) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* Ignore whitespace */ + continue; + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: /*01234*/ + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: /*56789*/ + clv = (clv << 4) + (ch - 0x30); + break; + case 0x41: + case 0x42: + case 0x43: /* ABC */ + case 0x44: + case 0x45: + case 0x46: /* DEF */ + clv = (clv << 4) + (ch - 0x41 + 10); + break; + case 0x61: + case 0x62: + case 0x63: /* abc */ + case 0x64: + case 0x65: + case 0x66: /* def */ + clv = (clv << 4) + (ch - 0x61 + 10); + break; + default: + *buf = 0; /* JIC */ + return -1; + } + if (half++) + { + half = 0; + *buf++ = clv; + chunk_stop = p + 1; + } } - if(half++) { - half = 0; - *buf++ = clv; - chunk_stop = p + 1; - } - } /* * Check partial decoding. */ - if(half) { - if(have_more) { - /* - * Partial specification is fine, - * because no more more PXER_TEXT data is available. - */ - *buf++ = clv << 4; + if (half) + { + if (have_more) + { + /* + * Partial specification is fine, + * because no more more PXER_TEXT data is available. + */ + *buf++ = clv << 4; + chunk_stop = p; + } + } + else + { chunk_stop = p; } - } else { - chunk_stop = p; - } - st->size = buf - st->buf; /* Adjust the buffer size */ + st->size = buf - st->buf; /* Adjust the buffer size */ assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return (chunk_stop - (const char *)chunk_buf); /* Converted size */ + return (chunk_stop - (const char *)chunk_buf); /* Converted size */ } /* * Convert from binary format: "00101011101" */ -static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, + size_t chunk_size, int have_more) +{ BIT_STRING_t *st = (BIT_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; @@ -870,90 +1019,117 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, s /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 7) / 8; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; (void)have_more; - if(bits_unused == 0) + if (bits_unused == 0) bits_unused = 8; - else if(st->size) + else if (st->size) buf--; /* * Convert series of 0 and 1 into the octet string. */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - switch(ch) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* Ignore whitespace */ - break; - case 0x30: - case 0x31: - if(bits_unused-- <= 0) { - *++buf = 0; /* Clean the cell */ - bits_unused = 7; - } - *buf |= (ch&1) << bits_unused; - break; - default: - st->bits_unused = bits_unused; - return -1; + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + switch (ch) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* Ignore whitespace */ + break; + case 0x30: + case 0x31: + if (bits_unused-- <= 0) + { + *++buf = 0; /* Clean the cell */ + bits_unused = 7; + } + *buf |= (ch & 1) << bits_unused; + break; + default: + st->bits_unused = bits_unused; + return -1; + } } - } - if(bits_unused == 8) { - st->size = buf - st->buf; - st->bits_unused = 0; - } else { - st->size = buf - st->buf + 1; - st->bits_unused = bits_unused; - } + if (bits_unused == 8) + { + st->size = buf - st->buf; + st->bits_unused = 0; + } + else + { + st->size = buf - st->buf + 1; + st->bits_unused = bits_unused; + } assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return chunk_size; /* Converted in full */ + return chunk_size; /* Converted in full */ } /* * Something like strtod(), but with stricter rules. */ -static int -OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { +static int OS__strtoent(int base, const char *buf, const char *end, + int32_t *ret_value) +{ int32_t val = 0; const char *p; - for(p = buf; p < end; p++) { - int ch = *p; + for (p = buf; p < end; p++) + { + int ch = *p; - /* Strange huge value */ - if((val * base + base) < 0) - return -1; + /* Strange huge value */ + if ((val * base + base) < 0) return -1; - switch(ch) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ - val = val * base + (ch - 0x30); - break; - case 0x41: case 0x42: case 0x43: /* ABC */ - case 0x44: case 0x45: case 0x46: /* DEF */ - val = val * base + (ch - 0x41 + 10); - break; - case 0x61: case 0x62: case 0x63: /* abc */ - case 0x64: case 0x65: case 0x66: /* def */ - val = val * base + (ch - 0x61 + 10); - break; - case 0x3b: /* ';' */ - *ret_value = val; - return (p - buf) + 1; - default: - return -1; /* Character set error */ + switch (ch) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: /*01234*/ + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: /*56789*/ + val = val * base + (ch - 0x30); + break; + case 0x41: + case 0x42: + case 0x43: /* ABC */ + case 0x44: + case 0x45: + case 0x46: /* DEF */ + val = val * base + (ch - 0x41 + 10); + break; + case 0x61: + case 0x62: + case 0x63: /* abc */ + case 0x64: + case 0x65: + case 0x66: /* def */ + val = val * base + (ch - 0x61 + 10); + break; + case 0x3b: /* ';' */ + *ret_value = val; + return (p - buf) + 1; + default: + return -1; /* Character set error */ + } } - } *ret_value = -1; return (p - buf); @@ -962,7 +1138,9 @@ OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { /* * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" */ -static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, + size_t chunk_size, int have_more) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; @@ -971,185 +1149,216 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, /* Reallocate buffer */ ssize_t _ns = st->size + chunk_size; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; /* * Convert series of 0 and 1 into the octet string. */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - int len; /* Length of the rest of the chunk */ + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + int len; /* Length of the rest of the chunk */ - if(ch != 0x26 /* '&' */) { - *buf++ = ch; - continue; /* That was easy... */ - } + if (ch != 0x26 /* '&' */) + { + *buf++ = ch; + continue; /* That was easy... */ + } - /* - * Process entity reference. - */ - len = chunk_size - (p - (const char *)chunk_buf); - if(len == 1 /* "&" */) goto want_more; - if(p[1] == 0x23 /* '#' */) { - const char *pval; /* Pointer to start of digits */ - int32_t val = 0; /* Entity reference value */ - int base; + /* + * Process entity reference. + */ + len = chunk_size - (p - (const char *)chunk_buf); + if (len == 1 /* "&" */) goto want_more; + if (p[1] == 0x23 /* '#' */) + { + const char *pval; /* Pointer to start of digits */ + int32_t val = 0; /* Entity reference value */ + int base; - if(len == 2 /* "&#" */) goto want_more; - if(p[2] == 0x78 /* 'x' */) - pval = p + 3, base = 16; + if (len == 2 /* "&#" */) goto want_more; + if (p[2] == 0x78 /* 'x' */) + pval = p + 3, base = 16; + else + pval = p + 2, base = 10; + len = OS__strtoent(base, pval, p + len, &val); + if (len == -1) + { + /* Invalid charset. Just copy verbatim. */ + *buf++ = ch; + continue; + } + if (!len || pval[len - 1] != 0x3b) goto want_more; + assert(val > 0); + p += (pval - p) + len - 1; /* Advance past entref */ + + if (val < 0x80) + { + *buf++ = (char)val; + } + else if (val < 0x800) + { + *buf++ = 0xc0 | ((val >> 6)); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x10000) + { + *buf++ = 0xe0 | ((val >> 12)); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x200000) + { + *buf++ = 0xf0 | ((val >> 18)); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x4000000) + { + *buf++ = 0xf8 | ((val >> 24)); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else + { + *buf++ = 0xfc | ((val >> 30) & 0x1); + *buf++ = 0x80 | ((val >> 24) & 0x3f); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + } else - pval = p + 2, base = 10; - len = OS__strtoent(base, pval, p + len, &val); - if(len == -1) { - /* Invalid charset. Just copy verbatim. */ - *buf++ = ch; - continue; - } - if(!len || pval[len-1] != 0x3b) goto want_more; - assert(val > 0); - p += (pval - p) + len - 1; /* Advance past entref */ - - if(val < 0x80) { - *buf++ = (char)val; - } else if(val < 0x800) { - *buf++ = 0xc0 | ((val >> 6)); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x10000) { - *buf++ = 0xe0 | ((val >> 12)); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x200000) { - *buf++ = 0xf0 | ((val >> 18)); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x4000000) { - *buf++ = 0xf8 | ((val >> 24)); - *buf++ = 0x80 | ((val >> 18) & 0x3f); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else { - *buf++ = 0xfc | ((val >> 30) & 0x1); - *buf++ = 0x80 | ((val >> 24) & 0x3f); - *buf++ = 0x80 | ((val >> 18) & 0x3f); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } - } else { - /* - * Ugly, limited parsing of & > < - */ - char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); - if(!sc) goto want_more; - if((sc - p) == 4 - && p[1] == 0x61 /* 'a' */ - && p[2] == 0x6d /* 'm' */ - && p[3] == 0x70 /* 'p' */) { - *buf++ = 0x26; - p = sc; - continue; - } - if((sc - p) == 3) { - if(p[1] == 0x6c) { - *buf = 0x3c; /* '<' */ - } else if(p[1] == 0x67) { - *buf = 0x3e; /* '>' */ - } else { + { + /* + * Ugly, limited parsing of & > < + */ + char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); + if (!sc) goto want_more; + if ((sc - p) == 4 && p[1] == 0x61 /* 'a' */ + && p[2] == 0x6d /* 'm' */ + && p[3] == 0x70 /* 'p' */) + { + *buf++ = 0x26; + p = sc; + continue; + } + if ((sc - p) == 3) + { + if (p[1] == 0x6c) + { + *buf = 0x3c; /* '<' */ + } + else if (p[1] == 0x67) + { + *buf = 0x3e; /* '>' */ + } + else + { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + if (p[2] != 0x74) + { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + buf++; + p = sc; + continue; + } /* Unsupported entity reference */ *buf++ = ch; - continue; } - if(p[2] != 0x74) { - /* Unsupported entity reference */ - *buf++ = ch; - continue; - } - buf++; - p = sc; - continue; - } - /* Unsupported entity reference */ - *buf++ = ch; - } - continue; - want_more: - if(have_more) { - /* - * We know that no more data (of the same type) - * is coming. Copy the rest verbatim. - */ - *buf++ = ch; continue; + want_more: + if (have_more) + { + /* + * We know that no more data (of the same type) + * is coming. Copy the rest verbatim. + */ + *buf++ = ch; + continue; + } + chunk_size = (p - (const char *)chunk_buf); + /* Processing stalled: need more data */ + break; } - chunk_size = (p - (const char *)chunk_buf); - /* Processing stalled: need more data */ - break; - } st->size = buf - st->buf; assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return chunk_size; /* Converted in full */ + return chunk_size; /* Converted in full */ } /* * Decode OCTET STRING from the XML element's body. */ -static asn_dec_rval_t -OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, +static asn_dec_rval_t OCTET_STRING__decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder) - (void *struct_ptr, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver) - (void *struct_ptr, const void *chunk_buf, size_t chunk_size, - int have_more) -) { + int (*opt_unexpected_tag_decoder)(void *struct_ptr, const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_ptr, const void *chunk_buf, + size_t chunk_size, int have_more)) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; - asn_struct_ctx_t *ctx; /* Per-structure parser context */ - asn_dec_rval_t rval; /* Return value from the decoder */ + asn_struct_ctx_t *ctx; /* Per-structure parser context */ + asn_dec_rval_t rval; /* Return value from the decoder */ int st_allocated; /* * Create the string if does not exist. */ - if(!st) { - st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); - *sptr = (void *)st; - if(!st) goto sta_failed; - st_allocated = 1; - } else { - st_allocated = 0; - } - if(!st->buf) { - /* This is separate from above section */ - st->buf = (uint8_t *)CALLOC(1, 1); - if(!st->buf) { - if(st_allocated) { - *sptr = 0; - goto stb_failed; - } else { - goto sta_failed; - } + if (!st) + { + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + *sptr = (void *)st; + if (!st) goto sta_failed; + st_allocated = 1; + } + else + { + st_allocated = 0; + } + if (!st->buf) + { + /* This is separate from above section */ + st->buf = (uint8_t *)CALLOC(1, 1); + if (!st->buf) + { + if (st_allocated) + { + *sptr = 0; + goto stb_failed; + } + else + { + goto sta_failed; + } + } } - } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); - return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, - buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); + return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, buf_ptr, size, + opt_unexpected_tag_decoder, body_receiver); stb_failed: FREEMEM(st); @@ -1162,502 +1371,596 @@ sta_failed: /* * Decode OCTET STRING from the hexadecimal data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); +asn_dec_rval_t OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, 0, OCTET_STRING__convert_hexadecimal); } /* * Decode OCTET STRING from the binary (0/1) data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, 0, OCTET_STRING__convert_binary); +asn_dec_rval_t OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, + const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, 0, OCTET_STRING__convert_binary); } /* * Decode OCTET STRING from the string (ASCII/UTF-8) data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, - OCTET_STRING__handle_control_chars, - OCTET_STRING__convert_entrefs); +asn_dec_rval_t OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, OCTET_STRING__handle_control_chars, + OCTET_STRING__convert_entrefs); } -static int -OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, - size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { +static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, + size_t units, unsigned int bpc, + unsigned int unit_bits, long lb, + long ub, asn_per_constraints_t *pc) +{ uint8_t *end = buf + units * bpc; - ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", - (int)units, lb, ub, unit_bits); + ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", (int)units, lb, ub, + unit_bits); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { - /* Decode without translation */ - lb = 0; - } else if(pc && pc->code2value) { - if(unit_bits > 16) - return 1; /* FATAL: can't have constrained - * UniversalString with more than - * 16 million code points */ - for(; buf < end; buf += bpc) { - int value; - int code = per_get_few_bits(po, unit_bits); - if(code < 0) return -1; /* WMORE */ - value = pc->code2value(code); - if(value < 0) { - ASN_DEBUG("Code %d (0x%02x) is" - " not in map (%ld..%ld)", - code, code, lb, ub); - return 1; /* FATAL */ - } - switch(bpc) { - case 1: *buf = value; break; - case 2: buf[0] = value >> 8; buf[1] = value; break; - case 4: buf[0] = value >> 24; buf[1] = value >> 16; - buf[2] = value >> 8; buf[3] = value; break; - } + if ((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) + { + /* Decode without translation */ + lb = 0; + } + else if (pc && pc->code2value) + { + if (unit_bits > 16) + return 1; /* FATAL: can't have constrained + * UniversalString with more than + * 16 million code points */ + for (; buf < end; buf += bpc) + { + int value; + int code = per_get_few_bits(po, unit_bits); + if (code < 0) return -1; /* WMORE */ + value = pc->code2value(code); + if (value < 0) + { + ASN_DEBUG( + "Code %d (0x%02x) is" + " not in map (%ld..%ld)", + code, code, lb, ub); + return 1; /* FATAL */ + } + switch (bpc) + { + case 1: + *buf = value; + break; + case 2: + buf[0] = value >> 8; + buf[1] = value; + break; + case 4: + buf[0] = value >> 24; + buf[1] = value >> 16; + buf[2] = value >> 8; + buf[3] = value; + break; + } + } + return 0; } - return 0; - } /* Shortcut the no-op copying to the aligned structure */ - if(lb == 0 && (unit_bits == 8 * bpc)) { - return per_get_many_bits(po, buf, 0, unit_bits * units); - } + if (lb == 0 && (unit_bits == 8 * bpc)) + { + return per_get_many_bits(po, buf, 0, unit_bits * units); + } - for(; buf < end; buf += bpc) { - int code = per_get_few_bits(po, unit_bits); - int ch = code + lb; - if(code < 0) return -1; /* WMORE */ - if(ch > ub) { - ASN_DEBUG("Code %d is out of range (%ld..%ld)", - ch, lb, ub); - return 1; /* FATAL */ + for (; buf < end; buf += bpc) + { + int code = per_get_few_bits(po, unit_bits); + int ch = code + lb; + if (code < 0) return -1; /* WMORE */ + if (ch > ub) + { + ASN_DEBUG("Code %d is out of range (%ld..%ld)", ch, lb, ub); + return 1; /* FATAL */ + } + switch (bpc) + { + case 1: + *buf = ch; + break; + case 2: + buf[0] = ch >> 8; + buf[1] = ch; + break; + case 4: + buf[0] = ch >> 24; + buf[1] = ch >> 16; + buf[2] = ch >> 8; + buf[3] = ch; + break; + } } - switch(bpc) { - case 1: *buf = ch; break; - case 2: buf[0] = ch >> 8; buf[1] = ch; break; - case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; - buf[2] = ch >> 8; buf[3] = ch; break; - } - } return 0; } -static int -OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, - size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { +static int OCTET_STRING_per_put_characters(asn_per_outp_t *po, + const uint8_t *buf, size_t units, + unsigned int bpc, + unsigned int unit_bits, long lb, + long ub, asn_per_constraints_t *pc) +{ const uint8_t *end = buf + units * bpc; - ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", - (int)units, lb, ub, unit_bits, bpc); + ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", (int)units, + lb, ub, unit_bits, bpc); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { - /* Encode as is */ - lb = 0; - } else if(pc && pc->value2code) { - for(; buf < end; buf += bpc) { - int code; - uint32_t value; - switch(bpc) { - case 1: value = *buf; break; - case 2: value = (buf[0] << 8) | buf[1]; break; - case 4: value = (buf[0] << 24) | (buf[1] << 16) - | (buf[2] << 8) | buf[3]; break; - default: return -1; - } - code = pc->value2code(value); - if(code < 0) { - ASN_DEBUG("Character %d (0x%02x) is" - " not in map (%ld..%ld)", - *buf, *buf, lb, ub); - return -1; - } - if(per_put_few_bits(po, code, unit_bits)) - return -1; + if ((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) + { + /* Encode as is */ + lb = 0; + } + else if (pc && pc->value2code) + { + for (; buf < end; buf += bpc) + { + int code; + uint32_t value; + switch (bpc) + { + case 1: + value = *buf; + break; + case 2: + value = (buf[0] << 8) | buf[1]; + break; + case 4: + value = (buf[0] << 24) | (buf[1] << 16) | + (buf[2] << 8) | buf[3]; + break; + default: + return -1; + } + code = pc->value2code(value); + if (code < 0) + { + ASN_DEBUG( + "Character %d (0x%02x) is" + " not in map (%ld..%ld)", + *buf, *buf, lb, ub); + return -1; + } + if (per_put_few_bits(po, code, unit_bits)) return -1; + } } - } /* Shortcut the no-op copying to the aligned structure */ - if(lb == 0 && (unit_bits == 8 * bpc)) { - return per_put_many_bits(po, buf, unit_bits * units); - } + if (lb == 0 && (unit_bits == 8 * bpc)) + { + return per_put_many_bits(po, buf, unit_bits * units); + } - for(ub -= lb; buf < end; buf += bpc) { - int ch; - uint32_t value; - switch(bpc) { - case 1: value = *buf; break; - case 2: value = (buf[0] << 8) | buf[1]; break; - case 4: value = (buf[0] << 24) | (buf[1] << 16) - | (buf[2] << 8) | buf[3]; break; - default: return -1; + for (ub -= lb; buf < end; buf += bpc) + { + int ch; + uint32_t value; + switch (bpc) + { + case 1: + value = *buf; + break; + case 2: + value = (buf[0] << 8) | buf[1]; + break; + case 4: + value = (buf[0] << 24) | (buf[1] << 16) | + (buf[2] << 8) | buf[3]; + break; + default: + return -1; + } + ch = value - lb; + if (ch < 0 || ch > ub) + { + ASN_DEBUG( + "Character %d (0x%02x)" + " is out of range (%ld..%ld)", + *buf, *buf, lb, ub + lb); + return -1; + } + if (per_put_few_bits(po, ch, unit_bits)) return -1; } - ch = value - lb; - if(ch < 0 || ch > ub) { - ASN_DEBUG("Character %d (0x%02x)" - " is out of range (%ld..%ld)", - *buf, *buf, lb, ub + lb); - return -1; - } - if(per_put_few_bits(po, ch, unit_bits)) - return -1; - } return 0; } -asn_dec_rval_t -OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, - void **sptr, asn_per_data_t *pd) { - - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_per_constraints_t *pc = constraints ? constraints - : td->per_constraints; +asn_dec_rval_t OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; - asn_dec_rval_t rval = { RC_OK, 0 }; + asn_dec_rval_t rval = {RC_OK, 0}; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; ssize_t consumed_myself = 0; int repeat; - enum { - OS__BPC_BIT = 0, - OS__BPC_CHAR = 1, - OS__BPC_U16 = 2, - OS__BPC_U32 = 4 - } bpc; /* Bytes per character */ + enum + { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ unsigned int unit_bits; unsigned int canonical_unit_bits; (void)opt_codec_ctx; - if(pc) { - cval = &pc->value; - csiz = &pc->size; - } else { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - } + if (pc) + { + cval = &pc->value; + csiz = &pc->size; + } + else + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + } - switch(specs->subvariant) { - default: - case ASN_OSUBV_ANY: - ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); - RETURN(RC_FAIL); - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - break; - case ASN_OSUBV_STR: - canonical_unit_bits = unit_bits = 8; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_CHAR; - break; - case ASN_OSUBV_U16: - canonical_unit_bits = unit_bits = 16; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U16; - break; - case ASN_OSUBV_U32: - canonical_unit_bits = unit_bits = 32; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U32; - break; - } + switch (specs->subvariant) + { + default: + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } /* * Allocate the string. */ - if(!st) { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(!st) RETURN(RC_FAIL); - } + if (!st) + { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if (!st) RETURN(RC_FAIL); + } ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", - csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", - csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); - if(csiz->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) RETURN(RC_WMORE); - if(inext) { - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - unit_bits = canonical_unit_bits; + if (csiz->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) RETURN(RC_WMORE); + if (inext) + { + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + unit_bits = canonical_unit_bits; + } } - } - if(csiz->effective_bits >= 0) { - FREEMEM(st->buf); - if(bpc) { - st->size = csiz->upper_bound * bpc; - } else { - st->size = (csiz->upper_bound + 7) >> 3; + if (csiz->effective_bits >= 0) + { + FREEMEM(st->buf); + if (bpc) + { + st->size = csiz->upper_bound * bpc; + } + else + { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if (!st->buf) + { + st->size = 0; + RETURN(RC_FAIL); + } } - st->buf = (uint8_t *)MALLOC(st->size + 1); - if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } - } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ - if(csiz->effective_bits == 0) { - int ret; - if(bpc) { - ASN_DEBUG("Encoding OCTET STRING size %ld", - csiz->upper_bound); - ret = OCTET_STRING_per_get_characters(pd, st->buf, - csiz->upper_bound, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - if(ret > 0) RETURN(RC_FAIL); - } else { - ASN_DEBUG("Encoding BIT STRING size %ld", - csiz->upper_bound); - ret = per_get_many_bits(pd, st->buf, 0, - unit_bits * csiz->upper_bound); + if (csiz->effective_bits == 0) + { + int ret; + if (bpc) + { + ASN_DEBUG("Encoding OCTET STRING size %ld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters( + pd, st->buf, csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if (ret > 0) RETURN(RC_FAIL); + } + else + { + ASN_DEBUG("Encoding BIT STRING size %ld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if (ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if (bpc == 0) + { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); } - if(ret < 0) RETURN(RC_WMORE); - consumed_myself += unit_bits * csiz->upper_bound; - st->buf[st->size] = 0; - if(bpc == 0) { - int ubs = (csiz->upper_bound & 0x7); - st->bits_unused = ubs ? 8 - ubs : 0; - } - RETURN(RC_OK); - } st->size = 0; - do { - ssize_t raw_len; - ssize_t len_bytes; - ssize_t len_bits; - void *p; - int ret; + do + { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; - /* Get the PER length */ - raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); - if(raw_len < 0) RETURN(RC_WMORE); - raw_len += csiz->lower_bound; + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); + if (raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; - ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", - (long)csiz->effective_bits, (long)raw_len, - repeat ? "repeat" : "once", td->name); - if(bpc) { - len_bytes = raw_len * bpc; - len_bits = len_bytes * unit_bits; - } else { - len_bits = raw_len; - len_bytes = (len_bits + 7) >> 3; - if(len_bits & 0x7) - st->bits_unused = 8 - (len_bits & 0x7); - /* len_bits be multiple of 16K if repeat is set */ + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + if (bpc) + { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } + else + { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if (len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if (!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if (bpc) + { + ret = OCTET_STRING_per_get_characters( + pd, &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if (ret > 0) RETURN(RC_FAIL); + } + else + { + ret = + per_get_many_bits(pd, &st->buf[st->size], 0, len_bits); + } + if (ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; } - p = REALLOC(st->buf, st->size + len_bytes + 1); - if(!p) RETURN(RC_FAIL); - st->buf = (uint8_t *)p; - - if(bpc) { - ret = OCTET_STRING_per_get_characters(pd, - &st->buf[st->size], raw_len, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - if(ret > 0) RETURN(RC_FAIL); - } else { - ret = per_get_many_bits(pd, &st->buf[st->size], - 0, len_bits); - } - if(ret < 0) RETURN(RC_WMORE); - st->size += len_bytes; - } while(repeat); - st->buf[st->size] = 0; /* nul-terminate */ + while (repeat); + st->buf[st->size] = 0; /* nul-terminate */ return rval; } -asn_enc_rval_t -OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_per_constraints_t *pc = constraints ? constraints - : td->per_constraints; +asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - asn_enc_rval_t er = { 0, 0, 0 }; - int inext = 0; /* Lies not within extension root */ + asn_enc_rval_t er = {0, 0, 0}; + int inext = 0; /* Lies not within extension root */ unsigned int unit_bits; unsigned int canonical_unit_bits; unsigned int sizeinunits; const uint8_t *buf; int ret; - enum { - OS__BPC_BIT = 0, - OS__BPC_CHAR = 1, - OS__BPC_U16 = 2, - OS__BPC_U32 = 4 - } bpc; /* Bytes per character */ + enum + { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ int ct_extensible; - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; - if(pc) { - cval = &pc->value; - csiz = &pc->size; - } else { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - } + if (pc) + { + cval = &pc->value; + csiz = &pc->size; + } + else + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + } ct_extensible = csiz->flags & APC_EXTENSIBLE; - switch(specs->subvariant) { - default: - case ASN_OSUBV_ANY: - _ASN_ENCODE_FAILED; - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - sizeinunits = st->size * 8 - (st->bits_unused & 0x07); - ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", - sizeinunits, st->bits_unused); - break; - case ASN_OSUBV_STR: - canonical_unit_bits = unit_bits = 8; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_CHAR; - sizeinunits = st->size; - break; - case ASN_OSUBV_U16: - canonical_unit_bits = unit_bits = 16; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U16; - sizeinunits = st->size / 2; - break; - case ASN_OSUBV_U32: - canonical_unit_bits = unit_bits = 32; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U32; - sizeinunits = st->size / 4; - break; - } + switch (specs->subvariant) + { + default: + case ASN_OSUBV_ANY: + _ASN_ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", sizeinunits, + st->bits_unused); + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } - ASN_DEBUG("Encoding %s into %d units of %d bits" + ASN_DEBUG( + "Encoding %s into %d units of %d bits" " (%ld..%ld, effective %d)%s", - td->name, sizeinunits, unit_bits, - csiz->lower_bound, csiz->upper_bound, + td->name, sizeinunits, unit_bits, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); /* Figure out whether size lies within PER visible constraint */ - if(csiz->effective_bits >= 0) { - if((int)sizeinunits < csiz->lower_bound - || (int)sizeinunits > csiz->upper_bound) { - if(ct_extensible) { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - unit_bits = canonical_unit_bits; - inext = 1; - } else - _ASN_ENCODE_FAILED; + if (csiz->effective_bits >= 0) + { + if ((int)sizeinunits < csiz->lower_bound || + (int)sizeinunits > csiz->upper_bound) + { + if (ct_extensible) + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + unit_bits = canonical_unit_bits; + inext = 1; + } + else + _ASN_ENCODE_FAILED; + } + } + else + { + inext = 0; } - } else { - inext = 0; - } - if(ct_extensible) { - /* Declare whether length is [not] within extension root */ - if(per_put_few_bits(po, inext, 1)) - _ASN_ENCODE_FAILED; - } + if (ct_extensible) + { + /* Declare whether length is [not] within extension root */ + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ - if(csiz->effective_bits >= 0) { - ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", - st->size, sizeinunits - csiz->lower_bound, - csiz->effective_bits); - ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, - csiz->effective_bits); - if(ret) _ASN_ENCODE_FAILED; - if(bpc) { - ret = OCTET_STRING_per_put_characters(po, st->buf, - sizeinunits, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - } else { - ret = per_put_many_bits(po, st->buf, - sizeinunits * unit_bits); + if (csiz->effective_bits >= 0) + { + ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", st->size, + sizeinunits - csiz->lower_bound, csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if (ret) _ASN_ENCODE_FAILED; + if (bpc) + { + ret = OCTET_STRING_per_put_characters( + po, st->buf, sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } + else + { + ret = + per_put_many_bits(po, st->buf, sizeinunits * unit_bits); + } + if (ret) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); } - if(ret) _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } ASN_DEBUG("Encoding %d bytes", st->size); - if(sizeinunits == 0) { - if(uper_put_length(po, 0)) - _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } + if (sizeinunits == 0) + { + if (uper_put_length(po, 0)) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } buf = st->buf; - while(sizeinunits) { - ssize_t maySave = uper_put_length(po, sizeinunits); - if(maySave < 0) _ASN_ENCODE_FAILED; + while (sizeinunits) + { + ssize_t maySave = uper_put_length(po, sizeinunits); + if (maySave < 0) _ASN_ENCODE_FAILED; - ASN_DEBUG("Encoding %ld of %ld", - (long)maySave, (long)sizeinunits); + ASN_DEBUG("Encoding %ld of %ld", (long)maySave, (long)sizeinunits); - if(bpc) { - ret = OCTET_STRING_per_put_characters(po, buf, - maySave, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - } else { - ret = per_put_many_bits(po, buf, maySave * unit_bits); + if (bpc) + { + ret = OCTET_STRING_per_put_characters( + po, buf, maySave, bpc, unit_bits, cval->lower_bound, + cval->upper_bound, pc); + } + else + { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if (ret) _ASN_ENCODE_FAILED; + + if (bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); } - if(ret) _ASN_ENCODE_FAILED; - - if(bpc) - buf += maySave * bpc; - else - buf += maySave >> 3; - sizeinunits -= maySave; - assert(!(maySave & 0x07) || !sizeinunits); - } _ASN_ENCODED_OK(er); } -int -OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; char scratch[16 * 3 + 4]; @@ -1666,9 +1969,9 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, uint8_t *end; size_t i; - (void)td; /* Unused argument */ + (void)td; /* Unused argument */ - if(!st || (!st->buf && st->size)) + if (!st || (!st->buf && st->size)) return (cb("", 8, app_key) < 0) ? -1 : 0; /* @@ -1676,113 +1979,121 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, */ buf = st->buf; end = buf + st->size; - for(i = 0; buf < end; buf++, i++) { - if(!(i % 16) && (i || st->size > 16)) { - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - _i_INDENT(1); - p = scratch; + for (i = 0; buf < end; buf++, i++) + { + if (!(i % 16) && (i || st->size > 16)) + { + if (cb(scratch, p - scratch, app_key) < 0) return -1; + _i_INDENT(1); + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - if(p > scratch) { - p--; /* Remove the tail space */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - } + if (p > scratch) + { + p--; /* Remove the tail space */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + } return 0; } -int -OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st && (st->buf || !st->size)) { - return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + if (st && (st->buf || !st->size)) + { + return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -void -OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { +void OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_struct_ctx_t *ctx = (asn_struct_ctx_t *) - ((char *)st + specs->ctx_offset); + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_struct_ctx_t *ctx = + (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); struct _stack *stck; - if(!td || !st) - return; + if (!td || !st) return; ASN_DEBUG("Freeing %s as OCTET STRING", td->name); - if(st->buf) { - FREEMEM(st->buf); - st->buf = 0; - } + if (st->buf) + { + FREEMEM(st->buf); + st->buf = 0; + } /* * Remove decode-time stack. */ stck = (struct _stack *)ctx->ptr; - if(stck) { - while(stck->tail) { - struct _stack_el *sel = stck->tail; - stck->tail = sel->prev; - FREEMEM(sel); + if (stck) + { + while (stck->tail) + { + struct _stack_el *sel = stck->tail; + stck->tail = sel->prev; + FREEMEM(sel); + } + FREEMEM(stck); } - FREEMEM(stck); - } - if(!contents_only) { - FREEMEM(st); - } + if (!contents_only) + { + FREEMEM(st); + } } /* * Conversion routines. */ -int -OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { +int OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) +{ void *buf; - if(st == 0 || (str == 0 && len)) { - errno = EINVAL; - return -1; - } + if (st == 0 || (str == 0 && len)) + { + errno = EINVAL; + return -1; + } /* * Clear the OCTET STRING. */ - if(str == NULL) { - FREEMEM(st->buf); - st->buf = 0; - st->size = 0; - return 0; - } + if (str == NULL) + { + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + return 0; + } /* Determine the original string size, if not explicitly given */ - if(len < 0) - len = strlen(str); + if (len < 0) len = strlen(str); /* Allocate and fill the memory */ buf = MALLOC(len + 1); - if(buf == NULL) - return -1; + if (buf == NULL) return -1; memcpy(buf, str, len); - ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ + ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ FREEMEM(st->buf); st->buf = (uint8_t *)buf; st->size = len; @@ -1790,18 +2101,20 @@ OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { return 0; } -OCTET_STRING_t * -OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; +OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, + const char *str, int len) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; OCTET_STRING_t *st; st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); - if(st && str && OCTET_STRING_fromBuf(st, str, len)) { - FREEMEM(st); - st = NULL; - } + if (st && str && OCTET_STRING_fromBuf(st, str, len)) + { + FREEMEM(st); + st = NULL; + } return st; } diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.h b/src/core/libs/supl/asn-rrlp/OCTET_STRING.h index 52a6a27a8..042fa5ab1 100644 --- a/src/core/libs/supl/asn-rrlp/OCTET_STRING.h +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.h @@ -36,40 +36,40 @@ extern "C" per_type_encoder_f OCTET_STRING_encode_uper; /****************************** - * Handy conversion routines. * - ******************************/ + * Handy conversion routines. * + ******************************/ /* - * This function clears the previous value of the OCTET STRING (if any) - * and then allocates a new memory with the specified content (str/size). - * If size = -1, the size of the original string will be determined - * using strlen(str). - * If str equals to NULL, the function will silently clear the - * current contents of the OCTET STRING. - * Returns 0 if it was possible to perform operation, -1 otherwise. - */ + * This function clears the previous value of the OCTET STRING (if any) + * and then allocates a new memory with the specified content (str/size). + * If size = -1, the size of the original string will be determined + * using strlen(str). + * If str equals to NULL, the function will silently clear the + * current contents of the OCTET STRING. + * Returns 0 if it was possible to perform operation, -1 otherwise. + */ int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size); /* Handy conversion from the C string into the OCTET STRING. */ #define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) /* - * Allocate and fill the new OCTET STRING and return a pointer to the newly - * allocated object. NULL is permitted in str: the function will just allocate - * empty OCTET STRING. - */ + * Allocate and fill the new OCTET STRING and return a pointer to the newly + * allocated object. NULL is permitted in str: the function will just + * allocate empty OCTET STRING. + */ OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, - const char *str, int size); + const char *str, int size); /**************************** - * Internally useful stuff. * - ****************************/ + * Internally useful stuff. * + ****************************/ typedef struct asn_OCTET_STRING_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the structure */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c index 1b4a52878..0c637e17e 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c +++ b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.c @@ -6,9 +6,10 @@ #include "OTD-FirstSetMsrs.h" -int -OTD_FirstSetMsrs_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int OTD_FirstSetMsrs_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_OTD_MeasurementWithID.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,85 +19,102 @@ OTD_FirstSetMsrs_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using OTD_MeasurementWithID, * so here we adjust the DEF accordingly. */ -static void -OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_OTD_MeasurementWithID.free_struct; - td->print_struct = asn_DEF_OTD_MeasurementWithID.print_struct; - td->ber_decoder = asn_DEF_OTD_MeasurementWithID.ber_decoder; - td->der_encoder = asn_DEF_OTD_MeasurementWithID.der_encoder; - td->xer_decoder = asn_DEF_OTD_MeasurementWithID.xer_decoder; - td->xer_encoder = asn_DEF_OTD_MeasurementWithID.xer_encoder; - td->uper_decoder = asn_DEF_OTD_MeasurementWithID.uper_decoder; - td->uper_encoder = asn_DEF_OTD_MeasurementWithID.uper_encoder; - if(!td->per_constraints) +static void OTD_FirstSetMsrs_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_OTD_MeasurementWithID.free_struct; + td->print_struct = asn_DEF_OTD_MeasurementWithID.print_struct; + td->ber_decoder = asn_DEF_OTD_MeasurementWithID.ber_decoder; + td->der_encoder = asn_DEF_OTD_MeasurementWithID.der_encoder; + td->xer_decoder = asn_DEF_OTD_MeasurementWithID.xer_decoder; + td->xer_encoder = asn_DEF_OTD_MeasurementWithID.xer_encoder; + td->uper_decoder = asn_DEF_OTD_MeasurementWithID.uper_decoder; + td->uper_encoder = asn_DEF_OTD_MeasurementWithID.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_OTD_MeasurementWithID.per_constraints; - td->elements = asn_DEF_OTD_MeasurementWithID.elements; + td->elements = asn_DEF_OTD_MeasurementWithID.elements; td->elements_count = asn_DEF_OTD_MeasurementWithID.elements_count; - td->specifics = asn_DEF_OTD_MeasurementWithID.specifics; + td->specifics = asn_DEF_OTD_MeasurementWithID.specifics; } -void -OTD_FirstSetMsrs_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void OTD_FirstSetMsrs_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -OTD_FirstSetMsrs_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int OTD_FirstSetMsrs_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -OTD_FirstSetMsrs_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t OTD_FirstSetMsrs_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -OTD_FirstSetMsrs_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTD_FirstSetMsrs_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -OTD_FirstSetMsrs_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t OTD_FirstSetMsrs_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -OTD_FirstSetMsrs_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTD_FirstSetMsrs_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -OTD_FirstSetMsrs_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t OTD_FirstSetMsrs_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -OTD_FirstSetMsrs_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t OTD_FirstSetMsrs_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ OTD_FirstSetMsrs_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_OTD_FirstSetMsrs_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; asn_TYPE_descriptor_t asn_DEF_OTD_FirstSetMsrs = { "OTD-FirstSetMsrs", "OTD-FirstSetMsrs", @@ -109,15 +127,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_FirstSetMsrs = { OTD_FirstSetMsrs_encode_xer, OTD_FirstSetMsrs_decode_uper, OTD_FirstSetMsrs_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_FirstSetMsrs_tags_1, - sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) - /sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ - asn_DEF_OTD_FirstSetMsrs_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) - /sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) / + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ + asn_DEF_OTD_FirstSetMsrs_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1) / + sizeof(asn_DEF_OTD_FirstSetMsrs_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* Defined elsewhere */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h index ba418782d..8854ed6b0 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h +++ b/src/core/libs/supl/asn-rrlp/OTD-FirstSetMsrs.h @@ -7,7 +7,6 @@ #ifndef _OTD_FirstSetMsrs_H_ #define _OTD_FirstSetMsrs_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c index e3b5d4df0..a785f145b 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.c @@ -6,115 +6,135 @@ #include "OTD-MeasureInfo-5-Ext.h" -int -OTD_MeasureInfo_5_Ext_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int OTD_MeasureInfo_5_Ext_constraint(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + /* Determine the number of elements */ size = _A_CSEQUENCE_FROM_VOID(sptr)->count; - - if((size >= 1 && size <= 2)) { - /* Perform validation of the inner elements */ - return td->check_constraints(td, sptr, ctfailcb, app_key); - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 2)) + { + /* Perform validation of the inner elements */ + return td->check_constraints(td, sptr, ctfailcb, app_key); + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using SeqOfOTD_MsrElementRest, * so here we adjust the DEF accordingly. */ -static void -OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_SeqOfOTD_MsrElementRest.free_struct; - td->print_struct = asn_DEF_SeqOfOTD_MsrElementRest.print_struct; - td->ber_decoder = asn_DEF_SeqOfOTD_MsrElementRest.ber_decoder; - td->der_encoder = asn_DEF_SeqOfOTD_MsrElementRest.der_encoder; - td->xer_decoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_decoder; - td->xer_encoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_encoder; - td->uper_decoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_decoder; - td->uper_encoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_encoder; - if(!td->per_constraints) +static void OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_SeqOfOTD_MsrElementRest.free_struct; + td->print_struct = asn_DEF_SeqOfOTD_MsrElementRest.print_struct; + td->ber_decoder = asn_DEF_SeqOfOTD_MsrElementRest.ber_decoder; + td->der_encoder = asn_DEF_SeqOfOTD_MsrElementRest.der_encoder; + td->xer_decoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_decoder; + td->xer_encoder = asn_DEF_SeqOfOTD_MsrElementRest.xer_encoder; + td->uper_decoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_decoder; + td->uper_encoder = asn_DEF_SeqOfOTD_MsrElementRest.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_SeqOfOTD_MsrElementRest.per_constraints; - td->elements = asn_DEF_SeqOfOTD_MsrElementRest.elements; + td->elements = asn_DEF_SeqOfOTD_MsrElementRest.elements; td->elements_count = asn_DEF_SeqOfOTD_MsrElementRest.elements_count; - td->specifics = asn_DEF_SeqOfOTD_MsrElementRest.specifics; + td->specifics = asn_DEF_SeqOfOTD_MsrElementRest.specifics; } -void -OTD_MeasureInfo_5_Ext_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void OTD_MeasureInfo_5_Ext_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -OTD_MeasureInfo_5_Ext_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int OTD_MeasureInfo_5_Ext_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -OTD_MeasureInfo_5_Ext_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t OTD_MeasureInfo_5_Ext_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -OTD_MeasureInfo_5_Ext_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTD_MeasureInfo_5_Ext_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -OTD_MeasureInfo_5_Ext_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t OTD_MeasureInfo_5_Ext_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -OTD_MeasureInfo_5_Ext_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTD_MeasureInfo_5_Ext_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -OTD_MeasureInfo_5_Ext_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t OTD_MeasureInfo_5_Ext_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -OTD_MeasureInfo_5_Ext_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t OTD_MeasureInfo_5_Ext_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ OTD_MeasureInfo_5_Ext_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_5_Ext = { "OTD-MeasureInfo-5-Ext", "OTD-MeasureInfo-5-Ext", @@ -127,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_5_Ext = { OTD_MeasureInfo_5_Ext_encode_xer, OTD_MeasureInfo_5_Ext_decode_uper, OTD_MeasureInfo_5_Ext_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MeasureInfo_5_Ext_tags_1, - sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ - asn_DEF_OTD_MeasureInfo_5_Ext_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_5_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_5_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* Defined elsewhere */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h index 267277ab1..90a2bb56d 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-5-Ext.h @@ -7,7 +7,6 @@ #ifndef _OTD_MeasureInfo_5_Ext_H_ #define _OTD_MeasureInfo_5_Ext_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c index c6481bfca..70ac29bdc 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.c @@ -7,30 +7,30 @@ #include "OTD-MeasureInfo-R98-Ext.h" static asn_TYPE_member_t asn_MBR_OTD_MeasureInfo_R98_Ext_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasureInfo_R98_Ext, otdMsrFirstSets_R98_Ext), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MsrElementFirst_R98_Ext, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otdMsrFirstSets-R98-Ext" - }, + {ATF_NOFLAGS, 0, + offsetof(struct OTD_MeasureInfo_R98_Ext, otdMsrFirstSets_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MsrElementFirst_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otdMsrFirstSets-R98-Ext"}, }; static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MeasureInfo_R98_Ext_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otdMsrFirstSets-R98-Ext at 974 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* otdMsrFirstSets-R98-Ext at 974 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasureInfo_R98_Ext_specs_1 = { sizeof(struct OTD_MeasureInfo_R98_Ext), offsetof(struct OTD_MeasureInfo_R98_Ext, _asn_ctx), asn_MAP_OTD_MeasureInfo_R98_Ext_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_R98_Ext = { "OTD-MeasureInfo-R98-Ext", @@ -44,16 +44,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo_R98_Ext = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1, - sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ - asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_R98_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MeasureInfo_R98_Ext_1, - 1, /* Elements count */ - &asn_SPC_OTD_MeasureInfo_R98_Ext_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_OTD_MeasureInfo_R98_Ext_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h index 3e3e6a5b7..c08c35a6d 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo-R98-Ext.h @@ -7,7 +7,6 @@ #ifndef _OTD_MeasureInfo_R98_Ext_H_ #define _OTD_MeasureInfo_R98_Ext_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c index 858894641..fd92230f4 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.c @@ -7,42 +7,36 @@ #include "OTD-MeasureInfo.h" static asn_TYPE_member_t asn_MBR_OTD_MeasureInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasureInfo, otdMsrFirstSets), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MsrElementFirst, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otdMsrFirstSets" - }, - { ATF_POINTER, 1, offsetof(struct OTD_MeasureInfo, otdMsrRestSets), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfOTD_MsrElementRest, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otdMsrRestSets" - }, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MeasureInfo, otdMsrFirstSets), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MsrElementFirst, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otdMsrFirstSets"}, + {ATF_POINTER, 1, offsetof(struct OTD_MeasureInfo, otdMsrRestSets), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_MsrElementRest, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otdMsrRestSets"}, }; -static int asn_MAP_OTD_MeasureInfo_oms_1[] = { 1 }; +static int asn_MAP_OTD_MeasureInfo_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_OTD_MeasureInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MeasureInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* otdMsrFirstSets at 323 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* otdMsrRestSets at 327 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* otdMsrFirstSets at 323 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* otdMsrRestSets at 327 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasureInfo_specs_1 = { sizeof(struct OTD_MeasureInfo), offsetof(struct OTD_MeasureInfo, _asn_ctx), asn_MAP_OTD_MeasureInfo_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_OTD_MeasureInfo_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_OTD_MeasureInfo_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo = { "OTD-MeasureInfo", @@ -56,16 +50,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MeasureInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MeasureInfo_tags_1, - sizeof(asn_DEF_OTD_MeasureInfo_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ - asn_DEF_OTD_MeasureInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MeasureInfo_tags_1) - /sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MeasureInfo_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasureInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasureInfo_tags_1) / + sizeof(asn_DEF_OTD_MeasureInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MeasureInfo_1, - 2, /* Elements count */ - &asn_SPC_OTD_MeasureInfo_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_OTD_MeasureInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h index b4779b50a..b40215549 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasureInfo.h @@ -7,7 +7,6 @@ #ifndef _OTD_MeasureInfo_H_ #define _OTD_MeasureInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-Measurement.c b/src/core/libs/supl/asn-rrlp/OTD-Measurement.c index 64eddb206..642f12138 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-Measurement.c +++ b/src/core/libs/supl/asn-rrlp/OTD-Measurement.c @@ -7,50 +7,41 @@ #include "OTD-Measurement.h" static asn_TYPE_member_t asn_MBR_OTD_Measurement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, nborTimeSlot), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ModuloTimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "nborTimeSlot" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, eotdQuality), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_EOTDQuality, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "eotdQuality" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, otdValue), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTDValue, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otdValue" - }, + {ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, nborTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "nborTimeSlot"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, eotdQuality), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_EOTDQuality, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "eotdQuality"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_Measurement, otdValue), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTDValue, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otdValue"}, }; static ber_tlv_tag_t asn_DEF_OTD_Measurement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_Measurement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nborTimeSlot at 379 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* eotdQuality at 380 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* otdValue at 382 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* nborTimeSlot at 379 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* eotdQuality at 380 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* otdValue at 382 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_Measurement_specs_1 = { sizeof(struct OTD_Measurement), offsetof(struct OTD_Measurement, _asn_ctx), asn_MAP_OTD_Measurement_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_Measurement = { "OTD-Measurement", @@ -64,16 +55,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_Measurement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_Measurement_tags_1, - sizeof(asn_DEF_OTD_Measurement_tags_1) - /sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ - asn_DEF_OTD_Measurement_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_Measurement_tags_1) - /sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_Measurement_tags_1) / + sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ + asn_DEF_OTD_Measurement_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_Measurement_tags_1) / + sizeof(asn_DEF_OTD_Measurement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_Measurement_1, - 3, /* Elements count */ - &asn_SPC_OTD_Measurement_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_OTD_Measurement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-Measurement.h b/src/core/libs/supl/asn-rrlp/OTD-Measurement.h index 7218ea49f..f2f0492ad 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-Measurement.h +++ b/src/core/libs/supl/asn-rrlp/OTD-Measurement.h @@ -7,7 +7,6 @@ #ifndef _OTD_Measurement_H_ #define _OTD_Measurement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c index c2a72d090..4da4bbef2 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.c @@ -7,60 +7,48 @@ #include "OTD-MeasurementWithID.h" static asn_TYPE_member_t asn_MBR_OTD_MeasurementWithID_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, neighborIdentity), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_NeighborIdentity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "neighborIdentity" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, nborTimeSlot), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ModuloTimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "nborTimeSlot" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, eotdQuality), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_EOTDQuality, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "eotdQuality" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, otdValue), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTDValue, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otdValue" - }, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, neighborIdentity), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_NeighborIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "neighborIdentity"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, nborTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "nborTimeSlot"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, eotdQuality), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_EOTDQuality, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "eotdQuality"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MeasurementWithID, otdValue), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTDValue, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otdValue"}, }; static ber_tlv_tag_t asn_DEF_OTD_MeasurementWithID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MeasurementWithID_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* neighborIdentity at 386 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nborTimeSlot at 387 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* eotdQuality at 388 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* otdValue at 390 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* neighborIdentity at 386 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* nborTimeSlot at 387 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* eotdQuality at 388 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* otdValue at 390 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MeasurementWithID_specs_1 = { sizeof(struct OTD_MeasurementWithID), offsetof(struct OTD_MeasurementWithID, _asn_ctx), asn_MAP_OTD_MeasurementWithID_tag2el_1, - 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MeasurementWithID = { "OTD-MeasurementWithID", @@ -74,16 +62,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MeasurementWithID = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MeasurementWithID_tags_1, - sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) - /sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ - asn_DEF_OTD_MeasurementWithID_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) - /sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) / + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ + asn_DEF_OTD_MeasurementWithID_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1) / + sizeof(asn_DEF_OTD_MeasurementWithID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MeasurementWithID_1, - 4, /* Elements count */ - &asn_SPC_OTD_MeasurementWithID_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_OTD_MeasurementWithID_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h index f23a21542..6d57f1fef 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MeasurementWithID.h @@ -7,7 +7,6 @@ #ifndef _OTD_MeasurementWithID_H_ #define _OTD_MeasurementWithID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c index e3b0d269b..026d37a7f 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.c @@ -7,32 +7,31 @@ #include "OTD-MsrElementFirst-R98-Ext.h" static asn_TYPE_member_t asn_MBR_OTD_MsrElementFirst_R98_Ext_1[] = { - { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst_R98_Ext, otd_FirstSetMsrs_R98_Ext), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-FirstSetMsrs-R98-Ext" - }, + {ATF_POINTER, 1, + offsetof(struct OTD_MsrElementFirst_R98_Ext, otd_FirstSetMsrs_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-FirstSetMsrs-R98-Ext"}, }; -static int asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1[] = { 0 }; +static int asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementFirst_R98_Ext_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otd-FirstSetMsrs-R98-Ext at 979 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* otd-FirstSetMsrs-R98-Ext at 979 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementFirst_R98_Ext_specs_1 = { sizeof(struct OTD_MsrElementFirst_R98_Ext), offsetof(struct OTD_MsrElementFirst_R98_Ext, _asn_ctx), asn_MAP_OTD_MsrElementFirst_R98_Ext_tag2el_1, - 1, /* Count of tags in the map */ - asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementFirst_R98_Ext_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst_R98_Ext = { "OTD-MsrElementFirst-R98-Ext", @@ -46,16 +45,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst_R98_Ext = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1, - sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) - /sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ - asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) - /sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) / + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1) / + sizeof(asn_DEF_OTD_MsrElementFirst_R98_Ext_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MsrElementFirst_R98_Ext_1, - 1, /* Elements count */ - &asn_SPC_OTD_MsrElementFirst_R98_Ext_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_OTD_MsrElementFirst_R98_Ext_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h index 16ac69958..644c8758c 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst-R98-Ext.h @@ -7,7 +7,6 @@ #ifndef _OTD_MsrElementFirst_R98_Ext_H_ #define _OTD_MsrElementFirst_R98_Ext_H_ - #include /* Including external dependencies */ @@ -24,7 +23,8 @@ extern "C" /* OTD-MsrElementFirst-R98-Ext */ typedef struct OTD_MsrElementFirst_R98_Ext { - struct SeqOfOTD_FirstSetMsrs_R98_Ext *otd_FirstSetMsrs_R98_Ext /* OPTIONAL */; + struct SeqOfOTD_FirstSetMsrs_R98_Ext + *otd_FirstSetMsrs_R98_Ext /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c index 7a21660a9..9a2c1902e 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.c @@ -6,143 +6,132 @@ #include "OTD-MsrElementFirst.h" -static int -memb_refFrameNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refFrameNumber_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 42431)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 42431)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 960)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 960)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 42431 } /* (0..42431) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 42431} /* (0..42431) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TA_CORRECTION_CONSTR_6 = { - { APC_CONSTRAINED, 10, 10, 0, 960 } /* (0..960) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 960} /* (0..960) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_OTD_MsrElementFirst_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, refFrameNumber), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refFrameNumber_constraint_1, - &ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2, - 0, - "refFrameNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, referenceTimeSlot), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ModuloTimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceTimeSlot" - }, - { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, toaMeasurementsOfRef), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TOA_MeasurementsOfRef, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "toaMeasurementsOfRef" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, stdResolution), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_StdResolution, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "stdResolution" - }, - { ATF_POINTER, 2, offsetof(struct OTD_MsrElementFirst, taCorrection), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_taCorrection_constraint_1, - &ASN_PER_MEMB_TA_CORRECTION_CONSTR_6, - 0, - "taCorrection" - }, - { ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, otd_FirstSetMsrs), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfOTD_FirstSetMsrs, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-FirstSetMsrs" - }, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, refFrameNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refFrameNumber_constraint_1, + &ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2, 0, "refFrameNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, referenceTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceTimeSlot"}, + {ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, toaMeasurementsOfRef), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TOA_MeasurementsOfRef, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "toaMeasurementsOfRef"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementFirst, stdResolution), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_StdResolution, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "stdResolution"}, + {ATF_POINTER, 2, offsetof(struct OTD_MsrElementFirst, taCorrection), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_taCorrection_constraint_1, + &ASN_PER_MEMB_TA_CORRECTION_CONSTR_6, 0, "taCorrection"}, + {ATF_POINTER, 1, offsetof(struct OTD_MsrElementFirst, otd_FirstSetMsrs), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-FirstSetMsrs"}, }; -static int asn_MAP_OTD_MsrElementFirst_oms_1[] = { 2, 4, 5 }; +static int asn_MAP_OTD_MsrElementFirst_oms_1[] = {2, 4, 5}; static ber_tlv_tag_t asn_DEF_OTD_MsrElementFirst_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementFirst_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrameNumber at 334 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceTimeSlot at 335 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toaMeasurementsOfRef at 336 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stdResolution at 337 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* taCorrection at 338 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* otd-FirstSetMsrs at 341 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refFrameNumber at 334 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* referenceTimeSlot at 335 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* toaMeasurementsOfRef at 336 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* stdResolution at 337 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* taCorrection at 338 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* otd-FirstSetMsrs at 341 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementFirst_specs_1 = { sizeof(struct OTD_MsrElementFirst), offsetof(struct OTD_MsrElementFirst, _asn_ctx), asn_MAP_OTD_MsrElementFirst_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_OTD_MsrElementFirst_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementFirst_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst = { "OTD-MsrElementFirst", @@ -156,16 +145,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementFirst = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MsrElementFirst_tags_1, - sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) - /sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ - asn_DEF_OTD_MsrElementFirst_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) - /sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) / + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementFirst_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1) / + sizeof(asn_DEF_OTD_MsrElementFirst_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MsrElementFirst_1, - 6, /* Elements count */ - &asn_SPC_OTD_MsrElementFirst_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_OTD_MsrElementFirst_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h index 2b51025ff..39afa7bd5 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementFirst.h @@ -7,7 +7,6 @@ #ifndef _OTD_MsrElementFirst_H_ #define _OTD_MsrElementFirst_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c index 179362fe1..7f6f47685 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.c @@ -6,143 +6,133 @@ #include "OTD-MsrElementRest.h" -static int -memb_refFrameNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refFrameNumber_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 42431)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 42431)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_taCorrection_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 960)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 960)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 42431 } /* (0..42431) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 42431} /* (0..42431) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TA_CORRECTION_CONSTR_6 = { - { APC_CONSTRAINED, 10, 10, 0, 960 } /* (0..960) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 960} /* (0..960) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_OTD_MsrElementRest_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, refFrameNumber), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refFrameNumber_constraint_1, - &ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2, - 0, - "refFrameNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, referenceTimeSlot), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ModuloTimeSlot, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceTimeSlot" - }, - { ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, toaMeasurementsOfRef), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TOA_MeasurementsOfRef, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "toaMeasurementsOfRef" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, stdResolution), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_StdResolution, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "stdResolution" - }, - { ATF_POINTER, 2, offsetof(struct OTD_MsrElementRest, taCorrection), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_taCorrection_constraint_1, - &ASN_PER_MEMB_TA_CORRECTION_CONSTR_6, - 0, - "taCorrection" - }, - { ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, otd_MsrsOfOtherSets), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfOTD_MsrsOfOtherSets, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-MsrsOfOtherSets" - }, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, refFrameNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refFrameNumber_constraint_1, + &ASN_PER_MEMB_REF_FRAME_NUMBER_CONSTR_2, 0, "refFrameNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, referenceTimeSlot), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ModuloTimeSlot, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceTimeSlot"}, + {ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, toaMeasurementsOfRef), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TOA_MeasurementsOfRef, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "toaMeasurementsOfRef"}, + {ATF_NOFLAGS, 0, offsetof(struct OTD_MsrElementRest, stdResolution), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_StdResolution, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "stdResolution"}, + {ATF_POINTER, 2, offsetof(struct OTD_MsrElementRest, taCorrection), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_taCorrection_constraint_1, + &ASN_PER_MEMB_TA_CORRECTION_CONSTR_6, 0, "taCorrection"}, + {ATF_POINTER, 1, offsetof(struct OTD_MsrElementRest, otd_MsrsOfOtherSets), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfOTD_MsrsOfOtherSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-MsrsOfOtherSets"}, }; -static int asn_MAP_OTD_MsrElementRest_oms_1[] = { 2, 4, 5 }; +static int asn_MAP_OTD_MsrElementRest_oms_1[] = {2, 4, 5}; static ber_tlv_tag_t asn_DEF_OTD_MsrElementRest_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_OTD_MsrElementRest_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refFrameNumber at 347 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* referenceTimeSlot at 348 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* toaMeasurementsOfRef at 349 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stdResolution at 350 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* taCorrection at 351 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* otd-MsrsOfOtherSets at 354 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refFrameNumber at 347 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* referenceTimeSlot at 348 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* toaMeasurementsOfRef at 349 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* stdResolution at 350 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* taCorrection at 351 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0} /* otd-MsrsOfOtherSets at 354 */ }; static asn_SEQUENCE_specifics_t asn_SPC_OTD_MsrElementRest_specs_1 = { sizeof(struct OTD_MsrElementRest), offsetof(struct OTD_MsrElementRest, _asn_ctx), asn_MAP_OTD_MsrElementRest_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_OTD_MsrElementRest_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_OTD_MsrElementRest_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementRest = { "OTD-MsrElementRest", @@ -156,16 +146,15 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MsrElementRest = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTD_MsrElementRest_tags_1, - sizeof(asn_DEF_OTD_MsrElementRest_tags_1) - /sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ - asn_DEF_OTD_MsrElementRest_tags_1, /* Same as above */ - sizeof(asn_DEF_OTD_MsrElementRest_tags_1) - /sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_OTD_MsrElementRest_tags_1) / + sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ + asn_DEF_OTD_MsrElementRest_tags_1, /* Same as above */ + sizeof(asn_DEF_OTD_MsrElementRest_tags_1) / + sizeof(asn_DEF_OTD_MsrElementRest_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_OTD_MsrElementRest_1, - 6, /* Elements count */ - &asn_SPC_OTD_MsrElementRest_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_OTD_MsrElementRest_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h index c4d110021..3287ccf96 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrElementRest.h @@ -7,7 +7,6 @@ #ifndef _OTD_MsrElementRest_H_ #define _OTD_MsrElementRest_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c index 5c48cc0b4..9f3d01df9 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.c @@ -7,33 +7,31 @@ #include "OTD-MsrsOfOtherSets.h" static asn_per_constraints_t ASN_PER_TYPE_OTD_MSRS_OF_OTHER_SETS_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_OTD_MsrsOfOtherSets_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrsOfOtherSets, choice.identityNotPresent), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_Measurement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "identityNotPresent" - }, - { ATF_NOFLAGS, 0, offsetof(struct OTD_MsrsOfOtherSets, choice.identityPresent), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MeasurementWithID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "identityPresent" - }, + {ATF_NOFLAGS, 0, + offsetof(struct OTD_MsrsOfOtherSets, choice.identityNotPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_Measurement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "identityNotPresent"}, + {ATF_NOFLAGS, 0, + offsetof(struct OTD_MsrsOfOtherSets, choice.identityPresent), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasurementWithID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "identityPresent"}, }; static asn_TYPE_tag2member_t asn_MAP_OTD_MsrsOfOtherSets_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* identityNotPresent at 372 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* identityPresent at 374 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* identityNotPresent at 372 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* identityPresent at 374 */ }; static asn_CHOICE_specifics_t asn_SPC_OTD_MsrsOfOtherSets_specs_1 = { sizeof(struct OTD_MsrsOfOtherSets), @@ -41,9 +39,9 @@ static asn_CHOICE_specifics_t asn_SPC_OTD_MsrsOfOtherSets_specs_1 = { offsetof(struct OTD_MsrsOfOtherSets, present), sizeof(((struct OTD_MsrsOfOtherSets *)0)->present), asn_MAP_OTD_MsrsOfOtherSets_tag2el_1, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_OTD_MsrsOfOtherSets = { "OTD-MsrsOfOtherSets", @@ -58,13 +56,12 @@ asn_TYPE_descriptor_t asn_DEF_OTD_MsrsOfOtherSets = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_OTD_MSRS_OF_OTHER_SETS_CONSTR_1, asn_MBR_OTD_MsrsOfOtherSets_1, - 2, /* Elements count */ - &asn_SPC_OTD_MsrsOfOtherSets_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_OTD_MsrsOfOtherSets_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h index 415a5fe1a..169dc2de9 100644 --- a/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h +++ b/src/core/libs/supl/asn-rrlp/OTD-MsrsOfOtherSets.h @@ -7,7 +7,6 @@ #ifndef _OTD_MsrsOfOtherSets_H_ #define _OTD_MsrsOfOtherSets_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/OTDValue.c b/src/core/libs/supl/asn-rrlp/OTDValue.c index d3d173ba1..0a51c64a6 100644 --- a/src/core/libs/supl/asn-rrlp/OTDValue.c +++ b/src/core/libs/supl/asn-rrlp/OTDValue.c @@ -6,119 +6,130 @@ #include "OTDValue.h" -int -OTDValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int OTDValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 39999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 39999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -OTDValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void OTDValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -OTDValue_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void OTDValue_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ OTDValue_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -OTDValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int OTDValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ OTDValue_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -OTDValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t OTDValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ OTDValue_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -OTDValue_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTDValue_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ OTDValue_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -OTDValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t OTDValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ OTDValue_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -OTDValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OTDValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ OTDValue_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -OTDValue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t OTDValue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ OTDValue_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -OTDValue_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t OTDValue_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ OTDValue_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_OTD_VALUE_CONSTR_1 = { - { APC_CONSTRAINED, 16, 16, 0, 39999 } /* (0..39999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 39999} /* (0..39999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_OTDValue_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_OTDValue = { "OTDValue", "OTDValue", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_OTDValue = { OTDValue_encode_xer, OTDValue_decode_uper, OTDValue_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OTDValue_tags_1, - sizeof(asn_DEF_OTDValue_tags_1) - /sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ - asn_DEF_OTDValue_tags_1, /* Same as above */ - sizeof(asn_DEF_OTDValue_tags_1) - /sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ + sizeof(asn_DEF_OTDValue_tags_1) / + sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ + asn_DEF_OTDValue_tags_1, /* Same as above */ + sizeof(asn_DEF_OTDValue_tags_1) / + sizeof(asn_DEF_OTDValue_tags_1[0]), /* 1 */ &ASN_PER_TYPE_OTD_VALUE_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/OTDValue.h b/src/core/libs/supl/asn-rrlp/OTDValue.h index be9c18016..77c85c558 100644 --- a/src/core/libs/supl/asn-rrlp/OTDValue.h +++ b/src/core/libs/supl/asn-rrlp/OTDValue.h @@ -7,7 +7,6 @@ #ifndef _OTDValue_H_ #define _OTDValue_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/PDU.c b/src/core/libs/supl/asn-rrlp/PDU.c index 7d712719d..71249ab0c 100644 --- a/src/core/libs/supl/asn-rrlp/PDU.c +++ b/src/core/libs/supl/asn-rrlp/PDU.c @@ -6,71 +6,68 @@ #include "PDU.h" -static int -memb_referenceNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_referenceNumber_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REFERENCE_NUMBER_CONSTR_2 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_PDU_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PDU, referenceNumber), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_referenceNumber_constraint_1, - &ASN_PER_MEMB_REFERENCE_NUMBER_CONSTR_2, - 0, - "referenceNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct PDU, component), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_RRLP_Component, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "component" - }, + {ATF_NOFLAGS, 0, offsetof(struct PDU, referenceNumber), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_referenceNumber_constraint_1, + &ASN_PER_MEMB_REFERENCE_NUMBER_CONSTR_2, 0, "referenceNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct PDU, component), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_RRLP_Component, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "component"}, }; static ber_tlv_tag_t asn_DEF_PDU_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceNumber at 16 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* component at 18 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceNumber at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* component at 18 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = { sizeof(struct PDU), offsetof(struct PDU, _asn_ctx), asn_MAP_PDU_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PDU = { "PDU", @@ -84,16 +81,13 @@ asn_TYPE_descriptor_t asn_DEF_PDU = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PDU_tags_1, - sizeof(asn_DEF_PDU_tags_1) - /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ - asn_DEF_PDU_tags_1, /* Same as above */ - sizeof(asn_DEF_PDU_tags_1) - /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PDU_tags_1) / sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + asn_DEF_PDU_tags_1, /* Same as above */ + sizeof(asn_DEF_PDU_tags_1) / sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PDU_1, - 2, /* Elements count */ - &asn_SPC_PDU_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_PDU_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/PDU.h b/src/core/libs/supl/asn-rrlp/PDU.h index 4e14b927e..ba9a3085d 100644 --- a/src/core/libs/supl/asn-rrlp/PDU.h +++ b/src/core/libs/supl/asn-rrlp/PDU.h @@ -7,7 +7,6 @@ #ifndef _PDU_H_ #define _PDU_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/PositionData.c b/src/core/libs/supl/asn-rrlp/PositionData.c index 2fa3559a6..cbfe07429 100644 --- a/src/core/libs/supl/asn-rrlp/PositionData.c +++ b/src/core/libs/supl/asn-rrlp/PositionData.c @@ -6,125 +6,146 @@ #include "PositionData.h" -int -PositionData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int PositionData_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if(st->size > 0) { - /* Size in bits */ - size = 8 * st->size - (st->bits_unused & 0x07); - } else { - size = 0; - } - - if((size >= 3 && size <= 16)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if (st->size > 0) + { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } + else + { + size = 0; + } + + if ((size >= 3 && size <= 16)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -PositionData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_BIT_STRING.free_struct; - td->print_struct = asn_DEF_BIT_STRING.print_struct; - td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; - td->der_encoder = asn_DEF_BIT_STRING.der_encoder; - td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; - td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; - td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; - td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; - if(!td->per_constraints) +static void PositionData_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; - td->elements = asn_DEF_BIT_STRING.elements; + td->elements = asn_DEF_BIT_STRING.elements; td->elements_count = asn_DEF_BIT_STRING.elements_count; - td->specifics = asn_DEF_BIT_STRING.specifics; + td->specifics = asn_DEF_BIT_STRING.specifics; } -void -PositionData_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void PositionData_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ PositionData_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -PositionData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int PositionData_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ PositionData_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -PositionData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t PositionData_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ PositionData_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -PositionData_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PositionData_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PositionData_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -PositionData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t PositionData_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ PositionData_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -PositionData_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PositionData_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PositionData_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -PositionData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t PositionData_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ PositionData_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -PositionData_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t PositionData_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ PositionData_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_POSITION_DATA_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 3, 16 } /* (SIZE(3..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 3, 16} /* (SIZE(3..16)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_PositionData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; asn_TYPE_descriptor_t asn_DEF_PositionData = { "PositionData", "PositionData", @@ -137,15 +158,15 @@ asn_TYPE_descriptor_t asn_DEF_PositionData = { PositionData_encode_xer, PositionData_decode_uper, PositionData_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PositionData_tags_1, - sizeof(asn_DEF_PositionData_tags_1) - /sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ - asn_DEF_PositionData_tags_1, /* Same as above */ - sizeof(asn_DEF_PositionData_tags_1) - /sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ + sizeof(asn_DEF_PositionData_tags_1) / + sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ + asn_DEF_PositionData_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionData_tags_1) / + sizeof(asn_DEF_PositionData_tags_1[0]), /* 1 */ &ASN_PER_TYPE_POSITION_DATA_CONSTR_1, - 0, 0, /* Defined elsewhere */ - 0 /* No specifics */ + 0, + 0, /* Defined elsewhere */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/PositionData.h b/src/core/libs/supl/asn-rrlp/PositionData.h index f4c188d1e..d94e32f49 100644 --- a/src/core/libs/supl/asn-rrlp/PositionData.h +++ b/src/core/libs/supl/asn-rrlp/PositionData.h @@ -7,7 +7,6 @@ #ifndef _PositionData_H_ #define _PositionData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/PositionInstruct.c b/src/core/libs/supl/asn-rrlp/PositionInstruct.c index 7f6632294..58a0205f1 100644 --- a/src/core/libs/supl/asn-rrlp/PositionInstruct.c +++ b/src/core/libs/supl/asn-rrlp/PositionInstruct.c @@ -7,72 +7,58 @@ #include "PositionInstruct.h" static asn_TYPE_member_t asn_MBR_PositionInstruct_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, methodType), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_MethodType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "methodType" - }, - { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, positionMethod), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PositionMethod, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "positionMethod" - }, - { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, measureResponseTime), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MeasureResponseTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "measureResponseTime" - }, - { ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, useMultipleSets), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UseMultipleSets, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "useMultipleSets" - }, - { ATF_POINTER, 1, offsetof(struct PositionInstruct, environmentCharacter), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_EnvironmentCharacter, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "environmentCharacter" - }, + {ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, methodType), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_MethodType, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "methodType"}, + {ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, positionMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "positionMethod"}, + {ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, measureResponseTime), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MeasureResponseTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "measureResponseTime"}, + {ATF_NOFLAGS, 0, offsetof(struct PositionInstruct, useMultipleSets), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UseMultipleSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "useMultipleSets"}, + {ATF_POINTER, 1, offsetof(struct PositionInstruct, environmentCharacter), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_EnvironmentCharacter, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "environmentCharacter"}, }; -static int asn_MAP_PositionInstruct_oms_1[] = { 4 }; +static int asn_MAP_PositionInstruct_oms_1[] = {4}; static ber_tlv_tag_t asn_DEF_PositionInstruct_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PositionInstruct_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* methodType at 108 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* positionMethod at 109 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* measureResponseTime at 110 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* useMultipleSets at 111 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* environmentCharacter at 112 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* methodType at 108 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* positionMethod at 109 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* measureResponseTime at 110 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* useMultipleSets at 111 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0} /* environmentCharacter at 112 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PositionInstruct_specs_1 = { sizeof(struct PositionInstruct), offsetof(struct PositionInstruct, _asn_ctx), asn_MAP_PositionInstruct_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_PositionInstruct_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_PositionInstruct_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PositionInstruct = { "PositionInstruct", @@ -86,16 +72,15 @@ asn_TYPE_descriptor_t asn_DEF_PositionInstruct = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PositionInstruct_tags_1, - sizeof(asn_DEF_PositionInstruct_tags_1) - /sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ - asn_DEF_PositionInstruct_tags_1, /* Same as above */ - sizeof(asn_DEF_PositionInstruct_tags_1) - /sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PositionInstruct_tags_1) / + sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ + asn_DEF_PositionInstruct_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionInstruct_tags_1) / + sizeof(asn_DEF_PositionInstruct_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PositionInstruct_1, - 5, /* Elements count */ - &asn_SPC_PositionInstruct_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_PositionInstruct_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/PositionInstruct.h b/src/core/libs/supl/asn-rrlp/PositionInstruct.h index 287d2b623..1043f1fe6 100644 --- a/src/core/libs/supl/asn-rrlp/PositionInstruct.h +++ b/src/core/libs/supl/asn-rrlp/PositionInstruct.h @@ -7,7 +7,6 @@ #ifndef _PositionInstruct_H_ #define _PositionInstruct_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/PositionMethod.c b/src/core/libs/supl/asn-rrlp/PositionMethod.c index ad425bfb1..537d2f801 100644 --- a/src/core/libs/supl/asn-rrlp/PositionMethod.c +++ b/src/core/libs/supl/asn-rrlp/PositionMethod.c @@ -6,9 +6,10 @@ #include "PositionMethod.h" -int -PositionMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int PositionMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,109 +19,123 @@ PositionMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -PositionMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void PositionMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -PositionMethod_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void PositionMethod_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ PositionMethod_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -PositionMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int PositionMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ PositionMethod_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -PositionMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t PositionMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ PositionMethod_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -PositionMethod_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PositionMethod_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PositionMethod_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -PositionMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t PositionMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ PositionMethod_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -PositionMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PositionMethod_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PositionMethod_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -PositionMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t PositionMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ PositionMethod_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -PositionMethod_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t PositionMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ PositionMethod_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_POSITION_METHOD_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 2} /* (0..2) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_PositionMethod_value2enum_1[] = { - { 0, 4, "eotd" }, - { 1, 3, "gps" }, - { 2, 9, "gpsOrEOTD" } -}; + {0, 4, "eotd"}, {1, 3, "gps"}, {2, 9, "gpsOrEOTD"}}; static unsigned int asn_MAP_PositionMethod_enum2value_1[] = { - 0, /* eotd(0) */ - 1, /* gps(1) */ - 2 /* gpsOrEOTD(2) */ + 0, /* eotd(0) */ + 1, /* gps(1) */ + 2 /* gpsOrEOTD(2) */ }; static asn_INTEGER_specifics_t asn_SPC_PositionMethod_specs_1 = { - asn_MAP_PositionMethod_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_PositionMethod_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_PositionMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PositionMethod_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_PositionMethod_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_PositionMethod = { "PositionMethod", "PositionMethod", @@ -133,15 +148,15 @@ asn_TYPE_descriptor_t asn_DEF_PositionMethod = { PositionMethod_encode_xer, PositionMethod_decode_uper, PositionMethod_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PositionMethod_tags_1, - sizeof(asn_DEF_PositionMethod_tags_1) - /sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ - asn_DEF_PositionMethod_tags_1, /* Same as above */ - sizeof(asn_DEF_PositionMethod_tags_1) - /sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ + sizeof(asn_DEF_PositionMethod_tags_1) / + sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ + asn_DEF_PositionMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionMethod_tags_1) / + sizeof(asn_DEF_PositionMethod_tags_1[0]), /* 1 */ &ASN_PER_TYPE_POSITION_METHOD_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_PositionMethod_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_PositionMethod_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/PositionMethod.h b/src/core/libs/supl/asn-rrlp/PositionMethod.h index 0b39dd256..2d790bfd5 100644 --- a/src/core/libs/supl/asn-rrlp/PositionMethod.h +++ b/src/core/libs/supl/asn-rrlp/PositionMethod.h @@ -7,7 +7,6 @@ #ifndef _PositionMethod_H_ #define _PositionMethod_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ProtocolError.c b/src/core/libs/supl/asn-rrlp/ProtocolError.c index d1fe0c681..5516db6fc 100644 --- a/src/core/libs/supl/asn-rrlp/ProtocolError.c +++ b/src/core/libs/supl/asn-rrlp/ProtocolError.c @@ -7,52 +7,45 @@ #include "ProtocolError.h" static asn_TYPE_member_t asn_MBR_ProtocolError_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ProtocolError, errorCause), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ErrorCodes, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "errorCause" - }, - { ATF_POINTER, 2, offsetof(struct ProtocolError, extensionContainer), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ExtensionContainer, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extensionContainer" - }, - { ATF_POINTER, 1, offsetof(struct ProtocolError, rel_5_ProtocolError_Extension), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel_5_ProtocolError_Extension, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel-5-ProtocolError-Extension" - }, + {ATF_NOFLAGS, 0, offsetof(struct ProtocolError, errorCause), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ErrorCodes, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "errorCause"}, + {ATF_POINTER, 2, offsetof(struct ProtocolError, extensionContainer), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ExtensionContainer, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extensionContainer"}, + {ATF_POINTER, 1, + offsetof(struct ProtocolError, rel_5_ProtocolError_Extension), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel_5_ProtocolError_Extension, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel-5-ProtocolError-Extension"}, }; -static int asn_MAP_ProtocolError_oms_1[] = { 1, 2 }; +static int asn_MAP_ProtocolError_oms_1[] = {1, 2}; static ber_tlv_tag_t asn_DEF_ProtocolError_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ProtocolError_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* errorCause at 96 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* extensionContainer at 97 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rel-5-ProtocolError-Extension at 100 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* errorCause at 96 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* extensionContainer at 97 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* rel-5-ProtocolError-Extension at 100 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ProtocolError_specs_1 = { sizeof(struct ProtocolError), offsetof(struct ProtocolError, _asn_ctx), asn_MAP_ProtocolError_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_ProtocolError_oms_1, /* Optional members */ - 1, 1, /* Root/Additions */ - 1, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_ProtocolError_oms_1, /* Optional members */ + 1, + 1, /* Root/Additions */ + 1, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ProtocolError = { "ProtocolError", @@ -66,16 +59,15 @@ asn_TYPE_descriptor_t asn_DEF_ProtocolError = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ProtocolError_tags_1, - sizeof(asn_DEF_ProtocolError_tags_1) - /sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ - asn_DEF_ProtocolError_tags_1, /* Same as above */ - sizeof(asn_DEF_ProtocolError_tags_1) - /sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ProtocolError_tags_1) / + sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ + asn_DEF_ProtocolError_tags_1, /* Same as above */ + sizeof(asn_DEF_ProtocolError_tags_1) / + sizeof(asn_DEF_ProtocolError_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ProtocolError_1, - 3, /* Elements count */ - &asn_SPC_ProtocolError_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_ProtocolError_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ProtocolError.h b/src/core/libs/supl/asn-rrlp/ProtocolError.h index 67813412d..cc5dde184 100644 --- a/src/core/libs/supl/asn-rrlp/ProtocolError.h +++ b/src/core/libs/supl/asn-rrlp/ProtocolError.h @@ -7,7 +7,6 @@ #ifndef _ProtocolError_H_ #define _ProtocolError_H_ - #include /* Including external dependencies */ @@ -29,10 +28,11 @@ extern "C" ErrorCodes_t errorCause; ExtensionContainer_t *extensionContainer /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ - struct Rel_5_ProtocolError_Extension *rel_5_ProtocolError_Extension /* OPTIONAL */; + * This type is extensible, + * possible extensions are below. + */ + struct Rel_5_ProtocolError_Extension + *rel_5_ProtocolError_Extension /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/RRLP-Component.c b/src/core/libs/supl/asn-rrlp/RRLP-Component.c index 2515d82a8..93cd43550 100644 --- a/src/core/libs/supl/asn-rrlp/RRLP-Component.c +++ b/src/core/libs/supl/asn-rrlp/RRLP-Component.c @@ -7,63 +7,48 @@ #include "RRLP-Component.h" static asn_per_constraints_t ASN_PER_TYPE_RRLP_COMPONENT_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4 } /* (0..4,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4} /* (0..4,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_RRLP_Component_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionReq), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MsrPosition_Req, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrPositionReq" - }, - { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionRsp), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MsrPosition_Rsp, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrPositionRsp" - }, - { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceData), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AssistanceData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "assistanceData" - }, - { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceDataAck), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "assistanceDataAck" - }, - { ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.protocolError), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ProtocolError, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "protocolError" - }, + {ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionReq), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrPosition_Req, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrPositionReq"}, + {ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.msrPositionRsp), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrPosition_Rsp, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrPositionRsp"}, + {ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistanceData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "assistanceData"}, + {ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.assistanceDataAck), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "assistanceDataAck"}, + {ATF_NOFLAGS, 0, offsetof(struct RRLP_Component, choice.protocolError), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_ProtocolError, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "protocolError"}, }; static asn_TYPE_tag2member_t asn_MAP_RRLP_Component_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msrPositionReq at 21 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msrPositionRsp at 22 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* assistanceData at 23 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* assistanceDataAck at 24 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* protocolError at 25 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msrPositionReq at 21 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* msrPositionRsp at 22 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* assistanceData at 23 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* assistanceDataAck at 24 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* protocolError at 25 */ }; static asn_CHOICE_specifics_t asn_SPC_RRLP_Component_specs_1 = { sizeof(struct RRLP_Component), @@ -71,9 +56,9 @@ static asn_CHOICE_specifics_t asn_SPC_RRLP_Component_specs_1 = { offsetof(struct RRLP_Component, present), sizeof(((struct RRLP_Component *)0)->present), asn_MAP_RRLP_Component_tag2el_1, - 5, /* Count of tags in the map */ + 5, /* Count of tags in the map */ 0, - 5 /* Extensions start */ + 5 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_RRLP_Component = { "RRLP-Component", @@ -88,13 +73,12 @@ asn_TYPE_descriptor_t asn_DEF_RRLP_Component = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_RRLP_COMPONENT_CONSTR_1, asn_MBR_RRLP_Component_1, - 5, /* Elements count */ - &asn_SPC_RRLP_Component_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_RRLP_Component_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RRLP-Component.h b/src/core/libs/supl/asn-rrlp/RRLP-Component.h index a5e175fa8..48d2e0f51 100644 --- a/src/core/libs/supl/asn-rrlp/RRLP-Component.h +++ b/src/core/libs/supl/asn-rrlp/RRLP-Component.h @@ -7,7 +7,6 @@ #ifndef _RRLP_Component_H_ #define _RRLP_Component_H_ - #include /* Including external dependencies */ @@ -47,9 +46,9 @@ extern "C" NULL_t assistanceDataAck; ProtocolError_t protocolError; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/RefLocation.c b/src/core/libs/supl/asn-rrlp/RefLocation.c index 08080fae0..efc9c4ca0 100644 --- a/src/core/libs/supl/asn-rrlp/RefLocation.c +++ b/src/core/libs/supl/asn-rrlp/RefLocation.c @@ -7,30 +7,28 @@ #include "RefLocation.h" static asn_TYPE_member_t asn_MBR_RefLocation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct RefLocation, threeDLocation), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ext_GeographicalInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "threeDLocation" - }, + {ATF_NOFLAGS, 0, offsetof(struct RefLocation, threeDLocation), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ext_GeographicalInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "threeDLocation"}, }; static ber_tlv_tag_t asn_DEF_RefLocation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_RefLocation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* threeDLocation at 650 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* threeDLocation at 650 */ }; static asn_SEQUENCE_specifics_t asn_SPC_RefLocation_specs_1 = { sizeof(struct RefLocation), offsetof(struct RefLocation, _asn_ctx), asn_MAP_RefLocation_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_RefLocation = { "RefLocation", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_RefLocation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RefLocation_tags_1, - sizeof(asn_DEF_RefLocation_tags_1) - /sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ - asn_DEF_RefLocation_tags_1, /* Same as above */ - sizeof(asn_DEF_RefLocation_tags_1) - /sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_RefLocation_tags_1) / + sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ + asn_DEF_RefLocation_tags_1, /* Same as above */ + sizeof(asn_DEF_RefLocation_tags_1) / + sizeof(asn_DEF_RefLocation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_RefLocation_1, - 1, /* Elements count */ - &asn_SPC_RefLocation_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_RefLocation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RefLocation.h b/src/core/libs/supl/asn-rrlp/RefLocation.h index 18e851122..b584fae32 100644 --- a/src/core/libs/supl/asn-rrlp/RefLocation.h +++ b/src/core/libs/supl/asn-rrlp/RefLocation.h @@ -7,7 +7,6 @@ #ifndef _RefLocation_H_ #define _RefLocation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/RefQuality.c b/src/core/libs/supl/asn-rrlp/RefQuality.c index ea669ab24..e2e7c62b0 100644 --- a/src/core/libs/supl/asn-rrlp/RefQuality.c +++ b/src/core/libs/supl/asn-rrlp/RefQuality.c @@ -6,119 +6,131 @@ #include "RefQuality.h" -int -RefQuality_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RefQuality_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RefQuality_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RefQuality_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RefQuality_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RefQuality_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RefQuality_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RefQuality_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RefQuality_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ RefQuality_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RefQuality_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RefQuality_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ RefQuality_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RefQuality_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RefQuality_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ RefQuality_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RefQuality_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RefQuality_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ RefQuality_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RefQuality_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RefQuality_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ RefQuality_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RefQuality_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RefQuality_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ RefQuality_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RefQuality_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RefQuality_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ RefQuality_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_REF_QUALITY_CONSTR_1 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RefQuality_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RefQuality = { "RefQuality", "RefQuality", @@ -131,15 +143,15 @@ asn_TYPE_descriptor_t asn_DEF_RefQuality = { RefQuality_encode_xer, RefQuality_decode_uper, RefQuality_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RefQuality_tags_1, - sizeof(asn_DEF_RefQuality_tags_1) - /sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ - asn_DEF_RefQuality_tags_1, /* Same as above */ - sizeof(asn_DEF_RefQuality_tags_1) - /sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RefQuality_tags_1) / + sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ + asn_DEF_RefQuality_tags_1, /* Same as above */ + sizeof(asn_DEF_RefQuality_tags_1) / + sizeof(asn_DEF_RefQuality_tags_1[0]), /* 1 */ &ASN_PER_TYPE_REF_QUALITY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RefQuality.h b/src/core/libs/supl/asn-rrlp/RefQuality.h index 20d4f0080..4e64e0a1d 100644 --- a/src/core/libs/supl/asn-rrlp/RefQuality.h +++ b/src/core/libs/supl/asn-rrlp/RefQuality.h @@ -7,7 +7,6 @@ #ifndef _RefQuality_H_ #define _RefQuality_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c index 089b36b70..ec800df72 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.c @@ -7,62 +7,49 @@ #include "ReferenceAssistData.h" static asn_TYPE_member_t asn_MBR_ReferenceAssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bcchCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BCCHCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bcchCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bsic), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSIC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsic" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, timeSlotScheme), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeSlotScheme, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeSlotScheme" - }, - { ATF_POINTER, 1, offsetof(struct ReferenceAssistData, btsPosition), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BTSPosition, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "btsPosition" - }, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bcchCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BCCHCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bcchCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, bsic), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSIC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsic"}, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceAssistData, timeSlotScheme), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeSlotScheme, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeSlotScheme"}, + {ATF_POINTER, 1, offsetof(struct ReferenceAssistData, btsPosition), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BTSPosition, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "btsPosition"}, }; -static int asn_MAP_ReferenceAssistData_oms_1[] = { 3 }; +static int asn_MAP_ReferenceAssistData_oms_1[] = {3}; static ber_tlv_tag_t asn_DEF_ReferenceAssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ReferenceAssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bcchCarrier at 157 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bsic at 158 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* timeSlotScheme at 159 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* btsPosition at 160 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bcchCarrier at 157 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bsic at 158 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* timeSlotScheme at 159 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* btsPosition at 160 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ReferenceAssistData_specs_1 = { sizeof(struct ReferenceAssistData), offsetof(struct ReferenceAssistData, _asn_ctx), asn_MAP_ReferenceAssistData_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_ReferenceAssistData_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_ReferenceAssistData_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceAssistData = { "ReferenceAssistData", @@ -76,16 +63,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceAssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceAssistData_tags_1, - sizeof(asn_DEF_ReferenceAssistData_tags_1) - /sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ - asn_DEF_ReferenceAssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceAssistData_tags_1) - /sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ReferenceAssistData_tags_1) / + sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ + asn_DEF_ReferenceAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceAssistData_tags_1) / + sizeof(asn_DEF_ReferenceAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ReferenceAssistData_1, - 4, /* Elements count */ - &asn_SPC_ReferenceAssistData_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_ReferenceAssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h index eb1fabd60..0ae8e55e1 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceAssistData.h @@ -7,7 +7,6 @@ #ifndef _ReferenceAssistData_H_ #define _ReferenceAssistData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceFrame.c b/src/core/libs/supl/asn-rrlp/ReferenceFrame.c index 427a76a8c..c87e89dd0 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceFrame.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceFrame.c @@ -6,103 +6,102 @@ #include "ReferenceFrame.h" -static int -memb_referenceFN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_referenceFN_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_referenceFNMSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_referenceFNMSB_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REFERENCE_FN_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REFERENCE_FNMSB_CONSTR_3 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_ReferenceFrame_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceFrame, referenceFN), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_referenceFN_constraint_1, - &ASN_PER_MEMB_REFERENCE_FN_CONSTR_2, - 0, - "referenceFN" - }, - { ATF_POINTER, 1, offsetof(struct ReferenceFrame, referenceFNMSB), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_referenceFNMSB_constraint_1, - &ASN_PER_MEMB_REFERENCE_FNMSB_CONSTR_3, - 0, - "referenceFNMSB" - }, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceFrame, referenceFN), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_referenceFN_constraint_1, + &ASN_PER_MEMB_REFERENCE_FN_CONSTR_2, 0, "referenceFN"}, + {ATF_POINTER, 1, offsetof(struct ReferenceFrame, referenceFNMSB), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_referenceFNMSB_constraint_1, + &ASN_PER_MEMB_REFERENCE_FNMSB_CONSTR_3, 0, "referenceFNMSB"}, }; -static int asn_MAP_ReferenceFrame_oms_1[] = { 1 }; +static int asn_MAP_ReferenceFrame_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_ReferenceFrame_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ReferenceFrame_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* referenceFN at 1438 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* referenceFNMSB at 1440 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* referenceFN at 1438 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* referenceFNMSB at 1440 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ReferenceFrame_specs_1 = { sizeof(struct ReferenceFrame), offsetof(struct ReferenceFrame, _asn_ctx), asn_MAP_ReferenceFrame_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_ReferenceFrame_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_ReferenceFrame_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceFrame = { "ReferenceFrame", @@ -116,16 +115,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceFrame = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceFrame_tags_1, - sizeof(asn_DEF_ReferenceFrame_tags_1) - /sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ - asn_DEF_ReferenceFrame_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceFrame_tags_1) - /sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ReferenceFrame_tags_1) / + sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ + asn_DEF_ReferenceFrame_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceFrame_tags_1) / + sizeof(asn_DEF_ReferenceFrame_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ReferenceFrame_1, - 2, /* Elements count */ - &asn_SPC_ReferenceFrame_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_ReferenceFrame_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceFrame.h b/src/core/libs/supl/asn-rrlp/ReferenceFrame.h index 50516a166..ae7fde19b 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceFrame.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceFrame.h @@ -7,7 +7,6 @@ #ifndef _ReferenceFrame_H_ #define _ReferenceFrame_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c index dfd305ad7..1f5c212ff 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.c @@ -7,30 +7,28 @@ #include "ReferenceIdentity.h" static asn_TYPE_member_t asn_MBR_ReferenceIdentity_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentity, refBTSList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfReferenceIdentityType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "refBTSList" - }, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentity, refBTSList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfReferenceIdentityType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "refBTSList"}, }; static ber_tlv_tag_t asn_DEF_ReferenceIdentity_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ReferenceIdentity_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* refBTSList at 289 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* refBTSList at 289 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ReferenceIdentity_specs_1 = { sizeof(struct ReferenceIdentity), offsetof(struct ReferenceIdentity, _asn_ctx), asn_MAP_ReferenceIdentity_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceIdentity = { "ReferenceIdentity", @@ -44,16 +42,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceIdentity = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceIdentity_tags_1, - sizeof(asn_DEF_ReferenceIdentity_tags_1) - /sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ - asn_DEF_ReferenceIdentity_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceIdentity_tags_1) - /sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ReferenceIdentity_tags_1) / + sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ + asn_DEF_ReferenceIdentity_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceIdentity_tags_1) / + sizeof(asn_DEF_ReferenceIdentity_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ReferenceIdentity_1, - 1, /* Elements count */ - &asn_SPC_ReferenceIdentity_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_ReferenceIdentity_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h index 266dcdf33..38498145e 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentity.h @@ -7,7 +7,6 @@ #ifndef _ReferenceIdentity_H_ #define _ReferenceIdentity_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c index 4a0300232..c749f97d5 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.c @@ -7,63 +7,51 @@ #include "ReferenceIdentityType.h" static asn_per_constraints_t ASN_PER_TYPE_REFERENCE_IDENTITY_TYPE_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 4 } /* (0..4) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 4} /* (0..4) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_ReferenceIdentityType_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.bsicAndCarrier), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BSICAndCarrier, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "bsicAndCarrier" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ci), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ci" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.requestIndex), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RequestIndex, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "requestIndex" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.systemInfoIndex), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SystemInfoIndex, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoIndex" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ciAndLAC), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellIDAndLAC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ciAndLAC" - }, + {ATF_NOFLAGS, 0, + offsetof(struct ReferenceIdentityType, choice.bsicAndCarrier), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BSICAndCarrier, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "bsicAndCarrier"}, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ci), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ci"}, + {ATF_NOFLAGS, 0, + offsetof(struct ReferenceIdentityType, choice.requestIndex), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "requestIndex"}, + {ATF_NOFLAGS, 0, + offsetof(struct ReferenceIdentityType, choice.systemInfoIndex), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoIndex, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoIndex"}, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceIdentityType, choice.ciAndLAC), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellIDAndLAC, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ciAndLAC"}, }; static asn_TYPE_tag2member_t asn_MAP_ReferenceIdentityType_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bsicAndCarrier at 294 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ci at 295 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* requestIndex at 296 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* systemInfoIndex at 297 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* ciAndLAC at 301 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bsicAndCarrier at 294 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ci at 295 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* requestIndex at 296 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* systemInfoIndex at 297 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* ciAndLAC at 301 */ }; static asn_CHOICE_specifics_t asn_SPC_ReferenceIdentityType_specs_1 = { sizeof(struct ReferenceIdentityType), @@ -71,9 +59,9 @@ static asn_CHOICE_specifics_t asn_SPC_ReferenceIdentityType_specs_1 = { offsetof(struct ReferenceIdentityType, present), sizeof(((struct ReferenceIdentityType *)0)->present), asn_MAP_ReferenceIdentityType_tag2el_1, - 5, /* Count of tags in the map */ + 5, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceIdentityType = { "ReferenceIdentityType", @@ -88,13 +76,12 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceIdentityType = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_REFERENCE_IDENTITY_TYPE_CONSTR_1, asn_MBR_ReferenceIdentityType_1, - 5, /* Elements count */ - &asn_SPC_ReferenceIdentityType_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_ReferenceIdentityType_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h index 0e587807b..2fd9d6ae1 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceIdentityType.h @@ -7,7 +7,6 @@ #ifndef _ReferenceIdentityType_H_ #define _ReferenceIdentityType_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceRelation.c b/src/core/libs/supl/asn-rrlp/ReferenceRelation.c index be9f8d4a6..08cca6413 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceRelation.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceRelation.c @@ -6,9 +6,10 @@ #include "ReferenceRelation.h" -int -ReferenceRelation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int ReferenceRelation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,109 +19,128 @@ ReferenceRelation_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -ReferenceRelation_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void ReferenceRelation_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -ReferenceRelation_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void ReferenceRelation_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -ReferenceRelation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int ReferenceRelation_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -ReferenceRelation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t ReferenceRelation_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -ReferenceRelation_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ReferenceRelation_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -ReferenceRelation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t ReferenceRelation_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -ReferenceRelation_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t ReferenceRelation_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -ReferenceRelation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t ReferenceRelation_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -ReferenceRelation_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t ReferenceRelation_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ ReferenceRelation_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_REFERENCE_RELATION_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 2} /* (0..2) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_ReferenceRelation_value2enum_1[] = { - { 0, 17, "secondBTSThirdSet" }, - { 1, 18, "secondBTSSecondSet" }, - { 2, 16, "firstBTSFirstSet" } -}; + {0, 17, "secondBTSThirdSet"}, + {1, 18, "secondBTSSecondSet"}, + {2, 16, "firstBTSFirstSet"}}; static unsigned int asn_MAP_ReferenceRelation_enum2value_1[] = { - 2, /* firstBTSFirstSet(2) */ - 1, /* secondBTSSecondSet(1) */ - 0 /* secondBTSThirdSet(0) */ + 2, /* firstBTSFirstSet(2) */ + 1, /* secondBTSSecondSet(1) */ + 0 /* secondBTSThirdSet(0) */ }; static asn_INTEGER_specifics_t asn_SPC_ReferenceRelation_specs_1 = { - asn_MAP_ReferenceRelation_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_ReferenceRelation_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_ReferenceRelation_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_ReferenceRelation_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_ReferenceRelation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_ReferenceRelation = { "ReferenceRelation", "ReferenceRelation", @@ -133,15 +153,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceRelation = { ReferenceRelation_encode_xer, ReferenceRelation_decode_uper, ReferenceRelation_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceRelation_tags_1, - sizeof(asn_DEF_ReferenceRelation_tags_1) - /sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ - asn_DEF_ReferenceRelation_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceRelation_tags_1) - /sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ + sizeof(asn_DEF_ReferenceRelation_tags_1) / + sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ + asn_DEF_ReferenceRelation_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceRelation_tags_1) / + sizeof(asn_DEF_ReferenceRelation_tags_1[0]), /* 1 */ &ASN_PER_TYPE_REFERENCE_RELATION_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_ReferenceRelation_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_ReferenceRelation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceRelation.h b/src/core/libs/supl/asn-rrlp/ReferenceRelation.h index ebf7ff379..0154e0397 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceRelation.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceRelation.h @@ -7,7 +7,6 @@ #ifndef _ReferenceRelation_H_ #define _ReferenceRelation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceTime.c b/src/core/libs/supl/asn-rrlp/ReferenceTime.c index 2cf82af51..f783b26a8 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceTime.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceTime.c @@ -7,52 +7,41 @@ #include "ReferenceTime.h" static asn_TYPE_member_t asn_MBR_ReferenceTime_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceTime, gpsTime), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTime" - }, - { ATF_POINTER, 2, offsetof(struct ReferenceTime, gsmTime), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GSMTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gsmTime" - }, - { ATF_POINTER, 1, offsetof(struct ReferenceTime, gpsTowAssist), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTOWAssist, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTowAssist" - }, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceTime, gpsTime), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTime, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTime"}, + {ATF_POINTER, 2, offsetof(struct ReferenceTime, gsmTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GSMTime, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gsmTime"}, + {ATF_POINTER, 1, offsetof(struct ReferenceTime, gpsTowAssist), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOWAssist, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTowAssist"}, }; -static int asn_MAP_ReferenceTime_oms_1[] = { 1, 2 }; +static int asn_MAP_ReferenceTime_oms_1[] = {1, 2}; static ber_tlv_tag_t asn_DEF_ReferenceTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ReferenceTime_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTime at 586 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gsmTime at 587 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsTowAssist at 588 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gpsTime at 586 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* gsmTime at 587 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* gpsTowAssist at 588 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ReferenceTime_specs_1 = { sizeof(struct ReferenceTime), offsetof(struct ReferenceTime, _asn_ctx), asn_MAP_ReferenceTime_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_ReferenceTime_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_ReferenceTime_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceTime = { "ReferenceTime", @@ -66,16 +55,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceTime = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceTime_tags_1, - sizeof(asn_DEF_ReferenceTime_tags_1) - /sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ - asn_DEF_ReferenceTime_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceTime_tags_1) - /sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ReferenceTime_tags_1) / + sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ + asn_DEF_ReferenceTime_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceTime_tags_1) / + sizeof(asn_DEF_ReferenceTime_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ReferenceTime_1, - 3, /* Elements count */ - &asn_SPC_ReferenceTime_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_ReferenceTime_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceTime.h b/src/core/libs/supl/asn-rrlp/ReferenceTime.h index ac0790c98..bda66b758 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceTime.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceTime.h @@ -7,7 +7,6 @@ #ifndef _ReferenceTime_H_ #define _ReferenceTime_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c index 0814dcb29..aaea13d45 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c +++ b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.c @@ -7,52 +7,43 @@ #include "ReferenceWGS84.h" static asn_TYPE_member_t asn_MBR_ReferenceWGS84_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeNorth), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RelDistance, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "relativeNorth" - }, - { ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeEast), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RelDistance, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "relativeEast" - }, - { ATF_POINTER, 1, offsetof(struct ReferenceWGS84, relativeAlt), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RelativeAlt, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "relativeAlt" - }, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeNorth), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "relativeNorth"}, + {ATF_NOFLAGS, 0, offsetof(struct ReferenceWGS84, relativeEast), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelDistance, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "relativeEast"}, + {ATF_POINTER, 1, offsetof(struct ReferenceWGS84, relativeAlt), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RelativeAlt, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "relativeAlt"}, }; -static int asn_MAP_ReferenceWGS84_oms_1[] = { 2 }; +static int asn_MAP_ReferenceWGS84_oms_1[] = {2}; static ber_tlv_tag_t asn_DEF_ReferenceWGS84_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ReferenceWGS84_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* relativeNorth at 247 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* relativeEast at 248 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* relativeAlt at 250 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* relativeNorth at 247 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* relativeEast at 248 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* relativeAlt at 250 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ReferenceWGS84_specs_1 = { sizeof(struct ReferenceWGS84), offsetof(struct ReferenceWGS84, _asn_ctx), asn_MAP_ReferenceWGS84_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_ReferenceWGS84_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_ReferenceWGS84_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ReferenceWGS84 = { "ReferenceWGS84", @@ -66,16 +57,15 @@ asn_TYPE_descriptor_t asn_DEF_ReferenceWGS84 = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ReferenceWGS84_tags_1, - sizeof(asn_DEF_ReferenceWGS84_tags_1) - /sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ - asn_DEF_ReferenceWGS84_tags_1, /* Same as above */ - sizeof(asn_DEF_ReferenceWGS84_tags_1) - /sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ReferenceWGS84_tags_1) / + sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ + asn_DEF_ReferenceWGS84_tags_1, /* Same as above */ + sizeof(asn_DEF_ReferenceWGS84_tags_1) / + sizeof(asn_DEF_ReferenceWGS84_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ReferenceWGS84_1, - 3, /* Elements count */ - &asn_SPC_ReferenceWGS84_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_ReferenceWGS84_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h index b750309bd..61a95f5ba 100644 --- a/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h +++ b/src/core/libs/supl/asn-rrlp/ReferenceWGS84.h @@ -7,7 +7,6 @@ #ifndef _ReferenceWGS84_H_ #define _ReferenceWGS84_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c index ae89fc083..89dcd0796 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.c @@ -7,52 +7,51 @@ #include "Rel-5-MsrPosition-Rsp-Extension.h" static asn_TYPE_member_t asn_MBR_Rel_5_MsrPosition_Rsp_Extension_1[] = { - { ATF_POINTER, 3, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, extended_reference), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Extended_reference, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extended-reference" - }, - { ATF_POINTER, 2, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, otd_MeasureInfo_5_Ext), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MeasureInfo_5_Ext, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-MeasureInfo-5-Ext" - }, - { ATF_POINTER, 1, offsetof(struct Rel_5_MsrPosition_Rsp_Extension, ulPseudoSegInd), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UlPseudoSegInd, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ulPseudoSegInd" - }, + {ATF_POINTER, 3, + offsetof(struct Rel_5_MsrPosition_Rsp_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extended-reference"}, + {ATF_POINTER, 2, + offsetof(struct Rel_5_MsrPosition_Rsp_Extension, otd_MeasureInfo_5_Ext), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo_5_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-MeasureInfo-5-Ext"}, + {ATF_POINTER, 1, + offsetof(struct Rel_5_MsrPosition_Rsp_Extension, ulPseudoSegInd), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UlPseudoSegInd, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ulPseudoSegInd"}, }; -static int asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t + asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1[] = { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* extended-reference at 985 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* otd-MeasureInfo-5-Ext at 991 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* ulPseudoSegInd at 992 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* extended-reference at 985 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* otd-MeasureInfo-5-Ext at 991 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ulPseudoSegInd at 992 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 = { - sizeof(struct Rel_5_MsrPosition_Rsp_Extension), - offsetof(struct Rel_5_MsrPosition_Rsp_Extension, _asn_ctx), - asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ +static asn_SEQUENCE_specifics_t + asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_5_MsrPosition_Rsp_Extension), + offsetof(struct Rel_5_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_5_MsrPosition_Rsp_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel_5_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension = { "Rel-5-MsrPosition-Rsp-Extension", @@ -66,16 +65,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel_5_MsrPosition_Rsp_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1, - sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_5_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel_5_MsrPosition_Rsp_Extension_1, - 3, /* Elements count */ - &asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Rel_5_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h index a16d40da4..73a16d74a 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel-5-MsrPosition-Rsp-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel_5_MsrPosition_Rsp_Extension_H_ #define _Rel_5_MsrPosition_Rsp_Extension_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" struct SeqOfOTD_MsrElementRest *otd_MeasureInfo_5_Ext /* OPTIONAL */; UlPseudoSegInd_t *ulPseudoSegInd /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c index 95b4074e8..e76a67c0c 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.c @@ -7,32 +7,33 @@ #include "Rel-5-ProtocolError-Extension.h" static asn_TYPE_member_t asn_MBR_Rel_5_ProtocolError_Extension_1[] = { - { ATF_POINTER, 1, offsetof(struct Rel_5_ProtocolError_Extension, extended_reference), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Extended_reference, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extended-reference" - }, + {ATF_POINTER, 1, + offsetof(struct Rel_5_ProtocolError_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extended-reference"}, }; -static int asn_MAP_Rel_5_ProtocolError_Extension_oms_1[] = { 0 }; +static int asn_MAP_Rel_5_ProtocolError_Extension_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_Rel_5_ProtocolError_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* extended-reference at 1030 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1030 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel_5_ProtocolError_Extension_specs_1 = { - sizeof(struct Rel_5_ProtocolError_Extension), - offsetof(struct Rel_5_ProtocolError_Extension, _asn_ctx), - asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1, - 1, /* Count of tags in the map */ - asn_MAP_Rel_5_ProtocolError_Extension_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 0, /* Start extensions */ - 2 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel_5_ProtocolError_Extension_specs_1 = + { + sizeof(struct Rel_5_ProtocolError_Extension), + offsetof(struct Rel_5_ProtocolError_Extension, _asn_ctx), + asn_MAP_Rel_5_ProtocolError_Extension_tag2el_1, + 1, /* Count of tags in the map */ + asn_MAP_Rel_5_ProtocolError_Extension_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 0, /* Start extensions */ + 2 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel_5_ProtocolError_Extension = { "Rel-5-ProtocolError-Extension", @@ -46,16 +47,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel_5_ProtocolError_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel_5_ProtocolError_Extension_tags_1, - sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) - /sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel_5_ProtocolError_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) - /sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) / + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_5_ProtocolError_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1) / + sizeof(asn_DEF_Rel_5_ProtocolError_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel_5_ProtocolError_Extension_1, - 1, /* Elements count */ - &asn_SPC_Rel_5_ProtocolError_Extension_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_Rel_5_ProtocolError_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h index 8e6e0975e..1a5ad8771 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel-5-ProtocolError-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel_5_ProtocolError_Extension_H_ #define _Rel_5_ProtocolError_Extension_H_ - #include /* Including external dependencies */ @@ -26,9 +25,9 @@ extern "C" { struct Extended_reference *extended_reference /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c index 0468d21f1..c4f31654c 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.c @@ -7,52 +7,50 @@ #include "Rel-7-MsrPosition-Rsp-Extension.h" static asn_TYPE_member_t asn_MBR_Rel_7_MsrPosition_Rsp_Extension_1[] = { - { ATF_POINTER, 3, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, velEstimate), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_VelocityEstimate, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "velEstimate" - }, - { ATF_POINTER, 2, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssLocationInfo), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSLocationInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssLocationInfo" - }, - { ATF_POINTER, 1, offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssMeasureInfo), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSMeasureInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssMeasureInfo" - }, + {ATF_POINTER, 3, + offsetof(struct Rel_7_MsrPosition_Rsp_Extension, velEstimate), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_VelocityEstimate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "velEstimate"}, + {ATF_POINTER, 2, + offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssLocationInfo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSLocationInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssLocationInfo"}, + {ATF_POINTER, 1, + offsetof(struct Rel_7_MsrPosition_Rsp_Extension, ganssMeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSMeasureInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssMeasureInfo"}, }; -static int asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t + asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1[] = { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* velEstimate at 1397 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssLocationInfo at 1402 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* ganssMeasureInfo at 1403 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* velEstimate at 1397 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssLocationInfo at 1402 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssMeasureInfo at 1403 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 = { - sizeof(struct Rel_7_MsrPosition_Rsp_Extension), - offsetof(struct Rel_7_MsrPosition_Rsp_Extension, _asn_ctx), - asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ +static asn_SEQUENCE_specifics_t + asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_7_MsrPosition_Rsp_Extension), + offsetof(struct Rel_7_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_7_MsrPosition_Rsp_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel_7_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension = { "Rel-7-MsrPosition-Rsp-Extension", @@ -66,16 +64,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel_7_MsrPosition_Rsp_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1, - sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_7_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel_7_MsrPosition_Rsp_Extension_1, - 3, /* Elements count */ - &asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Rel_7_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h index c636f7942..eb7cf0fcd 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel-7-MsrPosition-Rsp-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel_7_MsrPosition_Rsp_Extension_H_ #define _Rel_7_MsrPosition_Rsp_Extension_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" struct GANSSLocationInfo *ganssLocationInfo /* OPTIONAL */; struct GANSSMeasureInfo *ganssMeasureInfo /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c index f69c11991..fac4e015c 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.c @@ -7,97 +7,96 @@ #include "Rel-98-MsrPosition-Rsp-Extension.h" static asn_TYPE_member_t asn_MBR_rel_98_Ext_MeasureInfo_2[] = { - { ATF_POINTER, 1, offsetof(struct rel_98_Ext_MeasureInfo, otd_MeasureInfo_R98_Ext), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OTD_MeasureInfo_R98_Ext, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "otd-MeasureInfo-R98-Ext" - }, + {ATF_POINTER, 1, + offsetof(struct rel_98_Ext_MeasureInfo, otd_MeasureInfo_R98_Ext), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OTD_MeasureInfo_R98_Ext, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "otd-MeasureInfo-R98-Ext"}, }; -static int asn_MAP_rel_98_Ext_MeasureInfo_oms_2[] = { 0 }; +static int asn_MAP_rel_98_Ext_MeasureInfo_oms_2[] = {0}; static ber_tlv_tag_t asn_DEF_rel_98_Ext_MeasureInfo_tags_2[] = { - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_rel_98_Ext_MeasureInfo_tag2el_2[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* otd-MeasureInfo-R98-Ext at 960 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* otd-MeasureInfo-R98-Ext at 960 */ }; static asn_SEQUENCE_specifics_t asn_SPC_rel_98_Ext_MeasureInfo_specs_2 = { sizeof(struct rel_98_Ext_MeasureInfo), offsetof(struct rel_98_Ext_MeasureInfo, _asn_ctx), asn_MAP_rel_98_Ext_MeasureInfo_tag2el_2, - 1, /* Count of tags in the map */ - asn_MAP_rel_98_Ext_MeasureInfo_oms_2, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + asn_MAP_rel_98_Ext_MeasureInfo_oms_2, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_rel_98_Ext_MeasureInfo_2 = { - "rel-98-Ext-MeasureInfo", - "rel-98-Ext-MeasureInfo", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - SEQUENCE_decode_uper, - SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_rel_98_Ext_MeasureInfo_tags_2, - sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) - /sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]) - 1, /* 1 */ - asn_DEF_rel_98_Ext_MeasureInfo_tags_2, /* Same as above */ - sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) - /sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]), /* 2 */ - 0, /* No PER visible constraints */ - asn_MBR_rel_98_Ext_MeasureInfo_2, - 1, /* Elements count */ - &asn_SPC_rel_98_Ext_MeasureInfo_specs_2 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_rel_98_Ext_MeasureInfo_2 = { + "rel-98-Ext-MeasureInfo", + "rel-98-Ext-MeasureInfo", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_rel_98_Ext_MeasureInfo_tags_2, + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) / + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]) - + 1, /* 1 */ + asn_DEF_rel_98_Ext_MeasureInfo_tags_2, /* Same as above */ + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2) / + sizeof(asn_DEF_rel_98_Ext_MeasureInfo_tags_2[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_rel_98_Ext_MeasureInfo_2, + 1, /* Elements count */ + &asn_SPC_rel_98_Ext_MeasureInfo_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Rel_98_MsrPosition_Rsp_Extension_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Rel_98_MsrPosition_Rsp_Extension, rel_98_Ext_MeasureInfo), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - 0, - &asn_DEF_rel_98_Ext_MeasureInfo_2, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel-98-Ext-MeasureInfo" - }, - { ATF_POINTER, 1, offsetof(struct Rel_98_MsrPosition_Rsp_Extension, timeAssistanceMeasurements), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTimeAssistanceMeasurements, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeAssistanceMeasurements" - }, + {ATF_NOFLAGS, 0, + offsetof(struct Rel_98_MsrPosition_Rsp_Extension, rel_98_Ext_MeasureInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, &asn_DEF_rel_98_Ext_MeasureInfo_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel-98-Ext-MeasureInfo"}, + {ATF_POINTER, 1, + offsetof(struct Rel_98_MsrPosition_Rsp_Extension, + timeAssistanceMeasurements), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTimeAssistanceMeasurements, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeAssistanceMeasurements"}, }; -static int asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1[] = { 1 }; +static int asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t + asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1[] = { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* rel-98-Ext-MeasureInfo at 960 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* timeAssistanceMeasurements at 963 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel-98-Ext-MeasureInfo at 960 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* timeAssistanceMeasurements at 963 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 = { - sizeof(struct Rel_98_MsrPosition_Rsp_Extension), - offsetof(struct Rel_98_MsrPosition_Rsp_Extension, _asn_ctx), - asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ - 0, 1, /* Root/Additions */ - 0, /* Start extensions */ - 3 /* Stop extensions */ +static asn_SEQUENCE_specifics_t + asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 = { + sizeof(struct Rel_98_MsrPosition_Rsp_Extension), + offsetof(struct Rel_98_MsrPosition_Rsp_Extension, _asn_ctx), + asn_MAP_Rel_98_MsrPosition_Rsp_Extension_tag2el_1, + 2, /* Count of tags in the map */ + asn_MAP_Rel_98_MsrPosition_Rsp_Extension_oms_1, /* Optional members */ + 0, + 1, /* Root/Additions */ + 0, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension = { "Rel-98-MsrPosition-Rsp-Extension", @@ -111,16 +110,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel_98_MsrPosition_Rsp_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1, - sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) - /sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1) / + sizeof(asn_DEF_Rel_98_MsrPosition_Rsp_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel_98_MsrPosition_Rsp_Extension_1, - 2, /* Elements count */ - &asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_Rel_98_MsrPosition_Rsp_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h index 293eae9dc..00757641a 100644 --- a/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel-98-MsrPosition-Rsp-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel_98_MsrPosition_Rsp_Extension_H_ #define _Rel_98_MsrPosition_Rsp_Extension_H_ - #include /* Including external dependencies */ @@ -27,16 +26,18 @@ extern "C" { struct rel_98_Ext_MeasureInfo { - struct OTD_MeasureInfo_R98_Ext *otd_MeasureInfo_R98_Ext /* OPTIONAL */; + struct OTD_MeasureInfo_R98_Ext + *otd_MeasureInfo_R98_Ext /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } rel_98_Ext_MeasureInfo; /* - * This type is extensible, - * possible extensions are below. - */ - struct GPSTimeAssistanceMeasurements *timeAssistanceMeasurements /* OPTIONAL */; + * This type is extensible, + * possible extensions are below. + */ + struct GPSTimeAssistanceMeasurements + *timeAssistanceMeasurements /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c index b30041ae3..31398433d 100644 --- a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.c @@ -7,30 +7,32 @@ #include "Rel5-AssistanceData-Extension.h" static asn_TYPE_member_t asn_MBR_Rel5_AssistanceData_Extension_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Rel5_AssistanceData_Extension, extended_reference), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Extended_reference, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extended-reference" - }, + {ATF_NOFLAGS, 0, + offsetof(struct Rel5_AssistanceData_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extended-reference"}, }; static ber_tlv_tag_t asn_DEF_Rel5_AssistanceData_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel5_AssistanceData_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* extended-reference at 1023 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel5_AssistanceData_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1023 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel5_AssistanceData_Extension_specs_1 = { - sizeof(struct Rel5_AssistanceData_Extension), - offsetof(struct Rel5_AssistanceData_Extension, _asn_ctx), - asn_MAP_Rel5_AssistanceData_Extension_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 0, /* Start extensions */ - 2 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel5_AssistanceData_Extension_specs_1 = + { + sizeof(struct Rel5_AssistanceData_Extension), + offsetof(struct Rel5_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel5_AssistanceData_Extension_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel5_AssistanceData_Extension = { "Rel5-AssistanceData-Extension", @@ -44,16 +46,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel5_AssistanceData_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel5_AssistanceData_Extension_tags_1, - sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel5_AssistanceData_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel5_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel5_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel5_AssistanceData_Extension_1, - 1, /* Elements count */ - &asn_SPC_Rel5_AssistanceData_Extension_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_Rel5_AssistanceData_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h index 71c58ae40..9cbad4114 100644 --- a/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel5-AssistanceData-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel5_AssistanceData_Extension_H_ #define _Rel5_AssistanceData_Extension_H_ - #include /* Including external dependencies */ @@ -24,9 +23,9 @@ extern "C" { Extended_reference_t extended_reference; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c index 3eda1548b..0f67e8000 100644 --- a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.c @@ -7,30 +7,32 @@ #include "Rel5-MsrPosition-Req-Extension.h" static asn_TYPE_member_t asn_MBR_Rel5_MsrPosition_Req_Extension_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Rel5_MsrPosition_Req_Extension, extended_reference), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Extended_reference, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "extended-reference" - }, + {ATF_NOFLAGS, 0, + offsetof(struct Rel5_MsrPosition_Req_Extension, extended_reference), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Extended_reference, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "extended-reference"}, }; static ber_tlv_tag_t asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* extended-reference at 1017 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* extended-reference at 1017 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 = { - sizeof(struct Rel5_MsrPosition_Req_Extension), - offsetof(struct Rel5_MsrPosition_Req_Extension, _asn_ctx), - asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 0, /* Start extensions */ - 2 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 = + { + sizeof(struct Rel5_MsrPosition_Req_Extension), + offsetof(struct Rel5_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel5_MsrPosition_Req_Extension_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel5_MsrPosition_Req_Extension = { "Rel5-MsrPosition-Req-Extension", @@ -44,16 +46,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel5_MsrPosition_Req_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1, - sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel5_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel5_MsrPosition_Req_Extension_1, - 1, /* Elements count */ - &asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_Rel5_MsrPosition_Req_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h index ce912f048..ae30f51eb 100644 --- a/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel5-MsrPosition-Req-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel5_MsrPosition_Req_Extension_H_ #define _Rel5_MsrPosition_Req_Extension_H_ - #include /* Including external dependencies */ @@ -24,9 +23,9 @@ extern "C" { Extended_reference_t extended_reference; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c index 385dbc776..9a1ad5c2c 100644 --- a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.c @@ -7,52 +7,51 @@ #include "Rel7-AssistanceData-Extension.h" static asn_TYPE_member_t asn_MBR_Rel7_AssistanceData_Extension_1[] = { - { ATF_POINTER, 3, offsetof(struct Rel7_AssistanceData_Extension, ganss_AssistData), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSS_AssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganss-AssistData" - }, - { ATF_POINTER, 2, offsetof(struct Rel7_AssistanceData_Extension, ganssCarrierPhaseMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssCarrierPhaseMeasurementRequest" - }, - { ATF_POINTER, 1, offsetof(struct Rel7_AssistanceData_Extension, ganssTODGSMTimeAssociationMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODGSMTimeAssociationMeasurementRequest" - }, + {ATF_POINTER, 3, + offsetof(struct Rel7_AssistanceData_Extension, ganss_AssistData), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganss-AssistData"}, + {ATF_POINTER, 2, + offsetof(struct Rel7_AssistanceData_Extension, + ganssCarrierPhaseMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssCarrierPhaseMeasurementRequest"}, + {ATF_POINTER, 1, + offsetof(struct Rel7_AssistanceData_Extension, + ganssTODGSMTimeAssociationMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODGSMTimeAssociationMeasurementRequest"}, }; -static int asn_MAP_Rel7_AssistanceData_Extension_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_Rel7_AssistanceData_Extension_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_Rel7_AssistanceData_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel7_AssistanceData_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* ganss-AssistData at 1491 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssCarrierPhaseMeasurementRequest at 1492 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* ganssTODGSMTimeAssociationMeasurementRequest at 1493 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel7_AssistanceData_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganss-AssistData at 1491 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssCarrierPhaseMeasurementRequest at 1492 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ganssTODGSMTimeAssociationMeasurementRequest at 1493 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel7_AssistanceData_Extension_specs_1 = { - sizeof(struct Rel7_AssistanceData_Extension), - offsetof(struct Rel7_AssistanceData_Extension, _asn_ctx), - asn_MAP_Rel7_AssistanceData_Extension_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Rel7_AssistanceData_Extension_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel7_AssistanceData_Extension_specs_1 = + { + sizeof(struct Rel7_AssistanceData_Extension), + offsetof(struct Rel7_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel7_AssistanceData_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel7_AssistanceData_Extension_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel7_AssistanceData_Extension = { "Rel7-AssistanceData-Extension", @@ -66,16 +65,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel7_AssistanceData_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel7_AssistanceData_Extension_tags_1, - sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel7_AssistanceData_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel7_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel7_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel7_AssistanceData_Extension_1, - 3, /* Elements count */ - &asn_SPC_Rel7_AssistanceData_Extension_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Rel7_AssistanceData_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h index 019d63d90..5d2fb4023 100644 --- a/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel7-AssistanceData-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel7_AssistanceData_Extension_H_ #define _Rel7_AssistanceData_Extension_H_ - #include /* Including external dependencies */ @@ -29,9 +28,9 @@ extern "C" NULL_t *ganssCarrierPhaseMeasurementRequest /* OPTIONAL */; NULL_t *ganssTODGSMTimeAssociationMeasurementRequest /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c index 2eda78a4d..c78a04553 100644 --- a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.c @@ -7,82 +7,77 @@ #include "Rel7-MsrPosition-Req-Extension.h" static asn_TYPE_member_t asn_MBR_Rel7_MsrPosition_Req_Extension_1[] = { - { ATF_POINTER, 6, offsetof(struct Rel7_MsrPosition_Req_Extension, velocityRequested), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "velocityRequested" - }, - { ATF_POINTER, 5, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssPositionMethod), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSPositioningMethod, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssPositionMethod" - }, - { ATF_POINTER, 4, offsetof(struct Rel7_MsrPosition_Req_Extension, ganss_AssistData), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSS_AssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganss-AssistData" - }, - { ATF_POINTER, 3, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssCarrierPhaseMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssCarrierPhaseMeasurementRequest" - }, - { ATF_POINTER, 2, offsetof(struct Rel7_MsrPosition_Req_Extension, ganssTODGSMTimeAssociationMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssTODGSMTimeAssociationMeasurementRequest" - }, - { ATF_POINTER, 1, offsetof(struct Rel7_MsrPosition_Req_Extension, requiredResponseTime), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RequiredResponseTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "requiredResponseTime" - }, + {ATF_POINTER, 6, + offsetof(struct Rel7_MsrPosition_Req_Extension, velocityRequested), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "velocityRequested"}, + {ATF_POINTER, 5, + offsetof(struct Rel7_MsrPosition_Req_Extension, ganssPositionMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSPositioningMethod, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssPositionMethod"}, + {ATF_POINTER, 4, + offsetof(struct Rel7_MsrPosition_Req_Extension, ganss_AssistData), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSS_AssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganss-AssistData"}, + {ATF_POINTER, 3, + offsetof(struct Rel7_MsrPosition_Req_Extension, + ganssCarrierPhaseMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssCarrierPhaseMeasurementRequest"}, + {ATF_POINTER, 2, + offsetof(struct Rel7_MsrPosition_Req_Extension, + ganssTODGSMTimeAssociationMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssTODGSMTimeAssociationMeasurementRequest"}, + {ATF_POINTER, 1, + offsetof(struct Rel7_MsrPosition_Req_Extension, requiredResponseTime), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequiredResponseTime, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "requiredResponseTime"}, }; -static int asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1[] = { 0, 1, 2, 3, 4, 5 }; +static int asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1[] = {0, 1, 2, 3, 4, 5}; static ber_tlv_tag_t asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* velocityRequested at 1045 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssPositionMethod at 1046 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* ganss-AssistData at 1047 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* ganssCarrierPhaseMeasurementRequest at 1048 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* ganssTODGSMTimeAssociationMeasurementRequest at 1049 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0} /* requiredResponseTime at 1050 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* velocityRequested at 1045 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssPositionMethod at 1046 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ganss-AssistData at 1047 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ganssCarrierPhaseMeasurementRequest at 1048 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ganssTODGSMTimeAssociationMeasurementRequest at 1049 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* requiredResponseTime at 1050 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 = { - sizeof(struct Rel7_MsrPosition_Req_Extension), - offsetof(struct Rel7_MsrPosition_Req_Extension, _asn_ctx), - asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1, /* Optional members */ - 6, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 = + { + sizeof(struct Rel7_MsrPosition_Req_Extension), + offsetof(struct Rel7_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel7_MsrPosition_Req_Extension_tag2el_1, + 6, /* Count of tags in the map */ + asn_MAP_Rel7_MsrPosition_Req_Extension_oms_1, /* Optional members */ + 6, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel7_MsrPosition_Req_Extension = { "Rel7-MsrPosition-Req-Extension", @@ -96,16 +91,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel7_MsrPosition_Req_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1, - sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel7_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel7_MsrPosition_Req_Extension_1, - 6, /* Elements count */ - &asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_Rel7_MsrPosition_Req_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h index 353235f62..424e919a8 100644 --- a/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel7-MsrPosition-Req-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel7_MsrPosition_Req_Extension_H_ #define _Rel7_MsrPosition_Req_Extension_H_ - #include /* Including external dependencies */ @@ -34,9 +33,9 @@ extern "C" NULL_t *ganssTODGSMTimeAssociationMeasurementRequest /* OPTIONAL */; RequiredResponseTime_t *requiredResponseTime /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c index 08a6d6323..a83981a21 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.c @@ -7,52 +7,52 @@ #include "Rel98-AssistanceData-Extension.h" static asn_TYPE_member_t asn_MBR_Rel98_AssistanceData_Extension_1[] = { - { ATF_POINTER, 3, offsetof(struct Rel98_AssistanceData_Extension, rel98_Ext_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel98_Ext_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel98-Ext-ExpOTD" - }, - { ATF_POINTER, 2, offsetof(struct Rel98_AssistanceData_Extension, gpsTimeAssistanceMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTimeAssistanceMeasurementRequest" - }, - { ATF_POINTER, 1, offsetof(struct Rel98_AssistanceData_Extension, gpsReferenceTimeUncertainty), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSReferenceTimeUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsReferenceTimeUncertainty" - }, + {ATF_POINTER, 3, + offsetof(struct Rel98_AssistanceData_Extension, rel98_Ext_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_Ext_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel98-Ext-ExpOTD"}, + {ATF_POINTER, 2, + offsetof(struct Rel98_AssistanceData_Extension, + gpsTimeAssistanceMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTimeAssistanceMeasurementRequest"}, + {ATF_POINTER, 1, + offsetof(struct Rel98_AssistanceData_Extension, + gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsReferenceTimeUncertainty"}, }; -static int asn_MAP_Rel98_AssistanceData_Extension_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_Rel98_AssistanceData_Extension_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_Rel98_AssistanceData_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t asn_MAP_Rel98_AssistanceData_Extension_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* rel98-Ext-ExpOTD at 879 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* gpsTimeAssistanceMeasurementRequest at 881 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* gpsReferenceTimeUncertainty at 882 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel98_AssistanceData_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel98-Ext-ExpOTD at 879 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTimeAssistanceMeasurementRequest at 881 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsReferenceTimeUncertainty at 882 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel98_AssistanceData_Extension_specs_1 = { - sizeof(struct Rel98_AssistanceData_Extension), - offsetof(struct Rel98_AssistanceData_Extension, _asn_ctx), - asn_MAP_Rel98_AssistanceData_Extension_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Rel98_AssistanceData_Extension_oms_1, /* Optional members */ - 1, 2, /* Root/Additions */ - 0, /* Start extensions */ - 4 /* Stop extensions */ +static asn_SEQUENCE_specifics_t asn_SPC_Rel98_AssistanceData_Extension_specs_1 = + { + sizeof(struct Rel98_AssistanceData_Extension), + offsetof(struct Rel98_AssistanceData_Extension, _asn_ctx), + asn_MAP_Rel98_AssistanceData_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel98_AssistanceData_Extension_oms_1, /* Optional members */ + 1, + 2, /* Root/Additions */ + 0, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel98_AssistanceData_Extension = { "Rel98-AssistanceData-Extension", @@ -66,16 +66,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel98_AssistanceData_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel98_AssistanceData_Extension_tags_1, - sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel98_AssistanceData_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) - /sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel98_AssistanceData_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1) / + sizeof(asn_DEF_Rel98_AssistanceData_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel98_AssistanceData_Extension_1, - 3, /* Elements count */ - &asn_SPC_Rel98_AssistanceData_Extension_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Rel98_AssistanceData_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h index db91add4c..9238ccbf3 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel98-AssistanceData-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel98_AssistanceData_Extension_H_ #define _Rel98_AssistanceData_Extension_H_ - #include /* Including external dependencies */ @@ -28,11 +27,12 @@ extern "C" { struct Rel98_Ext_ExpOTD *rel98_Ext_ExpOTD /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ NULL_t *gpsTimeAssistanceMeasurementRequest /* OPTIONAL */; - GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + GPSReferenceTimeUncertainty_t + *gpsReferenceTimeUncertainty /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c index 97af9bc30..500ee581f 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.c @@ -7,42 +7,40 @@ #include "Rel98-Ext-ExpOTD.h" static asn_TYPE_member_t asn_MBR_Rel98_Ext_ExpOTD_1[] = { - { ATF_POINTER, 2, offsetof(struct Rel98_Ext_ExpOTD, msrAssistData_R98_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MsrAssistData_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msrAssistData-R98-ExpOTD" - }, - { ATF_POINTER, 1, offsetof(struct Rel98_Ext_ExpOTD, systemInfoAssistData_R98_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SystemInfoAssistData_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoAssistData-R98-ExpOTD" - }, + {ATF_POINTER, 2, + offsetof(struct Rel98_Ext_ExpOTD, msrAssistData_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MsrAssistData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msrAssistData-R98-ExpOTD"}, + {ATF_POINTER, 1, + offsetof(struct Rel98_Ext_ExpOTD, systemInfoAssistData_R98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SystemInfoAssistData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoAssistData-R98-ExpOTD"}, }; -static int asn_MAP_Rel98_Ext_ExpOTD_oms_1[] = { 0, 1 }; +static int asn_MAP_Rel98_Ext_ExpOTD_oms_1[] = {0, 1}; static ber_tlv_tag_t asn_DEF_Rel98_Ext_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Rel98_Ext_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msrAssistData-R98-ExpOTD at 890 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* systemInfoAssistData-R98-ExpOTD at 894 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* msrAssistData-R98-ExpOTD at 890 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0} /* systemInfoAssistData-R98-ExpOTD at 894 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Rel98_Ext_ExpOTD_specs_1 = { sizeof(struct Rel98_Ext_ExpOTD), offsetof(struct Rel98_Ext_ExpOTD, _asn_ctx), asn_MAP_Rel98_Ext_ExpOTD_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_Rel98_Ext_ExpOTD_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_Rel98_Ext_ExpOTD_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel98_Ext_ExpOTD = { "Rel98-Ext-ExpOTD", @@ -56,16 +54,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel98_Ext_ExpOTD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel98_Ext_ExpOTD_tags_1, - sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) - /sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_Rel98_Ext_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) - /sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) / + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_Rel98_Ext_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1) / + sizeof(asn_DEF_Rel98_Ext_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel98_Ext_ExpOTD_1, - 2, /* Elements count */ - &asn_SPC_Rel98_Ext_ExpOTD_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_Rel98_Ext_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h index e57a8e4b9..eb30325f7 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/Rel98-Ext-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _Rel98_Ext_ExpOTD_H_ #define _Rel98_Ext_ExpOTD_H_ - #include /* Including external dependencies */ @@ -25,8 +24,10 @@ extern "C" /* Rel98-Ext-ExpOTD */ typedef struct Rel98_Ext_ExpOTD { - struct MsrAssistData_R98_ExpOTD *msrAssistData_R98_ExpOTD /* OPTIONAL */; - struct SystemInfoAssistData_R98_ExpOTD *systemInfoAssistData_R98_ExpOTD /* OPTIONAL */; + struct MsrAssistData_R98_ExpOTD + *msrAssistData_R98_ExpOTD /* OPTIONAL */; + struct SystemInfoAssistData_R98_ExpOTD + *systemInfoAssistData_R98_ExpOTD /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c index 535eb38d3..5b28f808f 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c +++ b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.c @@ -7,52 +7,52 @@ #include "Rel98-MsrPosition-Req-Extension.h" static asn_TYPE_member_t asn_MBR_Rel98_MsrPosition_Req_Extension_1[] = { - { ATF_POINTER, 3, offsetof(struct Rel98_MsrPosition_Req_Extension, rel98_Ext_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Rel98_Ext_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rel98-Ext-ExpOTD" - }, - { ATF_POINTER, 2, offsetof(struct Rel98_MsrPosition_Req_Extension, gpsTimeAssistanceMeasurementRequest), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTimeAssistanceMeasurementRequest" - }, - { ATF_POINTER, 1, offsetof(struct Rel98_MsrPosition_Req_Extension, gpsReferenceTimeUncertainty), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSReferenceTimeUncertainty, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsReferenceTimeUncertainty" - }, + {ATF_POINTER, 3, + offsetof(struct Rel98_MsrPosition_Req_Extension, rel98_Ext_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Rel98_Ext_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rel98-Ext-ExpOTD"}, + {ATF_POINTER, 2, + offsetof(struct Rel98_MsrPosition_Req_Extension, + gpsTimeAssistanceMeasurementRequest), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTimeAssistanceMeasurementRequest"}, + {ATF_POINTER, 1, + offsetof(struct Rel98_MsrPosition_Req_Extension, + gpsReferenceTimeUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSReferenceTimeUncertainty, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsReferenceTimeUncertainty"}, }; -static int asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t + asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1[] = { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* rel98-Ext-ExpOTD at 871 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* gpsTimeAssistanceMeasurementRequest at 873 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* gpsReferenceTimeUncertainty at 874 */ }; -static asn_TYPE_tag2member_t asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* rel98-Ext-ExpOTD at 871 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsTimeAssistanceMeasurementRequest at 873 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gpsReferenceTimeUncertainty at 874 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 = { - sizeof(struct Rel98_MsrPosition_Req_Extension), - offsetof(struct Rel98_MsrPosition_Req_Extension, _asn_ctx), - asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1, /* Optional members */ - 1, 2, /* Root/Additions */ - 0, /* Start extensions */ - 4 /* Stop extensions */ +static asn_SEQUENCE_specifics_t + asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 = { + sizeof(struct Rel98_MsrPosition_Req_Extension), + offsetof(struct Rel98_MsrPosition_Req_Extension, _asn_ctx), + asn_MAP_Rel98_MsrPosition_Req_Extension_tag2el_1, + 3, /* Count of tags in the map */ + asn_MAP_Rel98_MsrPosition_Req_Extension_oms_1, /* Optional members */ + 1, + 2, /* Root/Additions */ + 0, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Rel98_MsrPosition_Req_Extension = { "Rel98-MsrPosition-Req-Extension", @@ -66,16 +66,15 @@ asn_TYPE_descriptor_t asn_DEF_Rel98_MsrPosition_Req_Extension = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1, - sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1, /* Same as above */ - sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) - /sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1, /* Same as above */ + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1) / + sizeof(asn_DEF_Rel98_MsrPosition_Req_Extension_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Rel98_MsrPosition_Req_Extension_1, - 3, /* Elements count */ - &asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Rel98_MsrPosition_Req_Extension_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h index 0498ae9be..1d785c7ba 100644 --- a/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h +++ b/src/core/libs/supl/asn-rrlp/Rel98-MsrPosition-Req-Extension.h @@ -7,7 +7,6 @@ #ifndef _Rel98_MsrPosition_Req_Extension_H_ #define _Rel98_MsrPosition_Req_Extension_H_ - #include /* Including external dependencies */ @@ -28,11 +27,12 @@ extern "C" { struct Rel98_Ext_ExpOTD *rel98_Ext_ExpOTD /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ NULL_t *gpsTimeAssistanceMeasurementRequest /* OPTIONAL */; - GPSReferenceTimeUncertainty_t *gpsReferenceTimeUncertainty /* OPTIONAL */; + GPSReferenceTimeUncertainty_t + *gpsReferenceTimeUncertainty /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/RelDistance.c b/src/core/libs/supl/asn-rrlp/RelDistance.c index 27774f87b..e2624f0df 100644 --- a/src/core/libs/supl/asn-rrlp/RelDistance.c +++ b/src/core/libs/supl/asn-rrlp/RelDistance.c @@ -6,119 +6,135 @@ #include "RelDistance.h" -int -RelDistance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RelDistance_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -200000 && value <= 200000)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -200000 && value <= 200000)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RelDistance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RelDistance_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RelDistance_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RelDistance_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RelDistance_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RelDistance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RelDistance_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ RelDistance_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RelDistance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RelDistance_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ RelDistance_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RelDistance_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RelDistance_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RelDistance_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RelDistance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RelDistance_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ RelDistance_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RelDistance_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RelDistance_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RelDistance_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RelDistance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RelDistance_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ RelDistance_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RelDistance_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RelDistance_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ RelDistance_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_REL_DISTANCE_CONSTR_1 = { - { APC_CONSTRAINED, 19, -1, -200000, 200000 } /* (-200000..200000) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 19, -1, -200000, 200000} /* (-200000..200000) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RelDistance_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RelDistance = { "RelDistance", "RelDistance", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_RelDistance = { RelDistance_encode_xer, RelDistance_decode_uper, RelDistance_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RelDistance_tags_1, - sizeof(asn_DEF_RelDistance_tags_1) - /sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ - asn_DEF_RelDistance_tags_1, /* Same as above */ - sizeof(asn_DEF_RelDistance_tags_1) - /sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RelDistance_tags_1) / + sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ + asn_DEF_RelDistance_tags_1, /* Same as above */ + sizeof(asn_DEF_RelDistance_tags_1) / + sizeof(asn_DEF_RelDistance_tags_1[0]), /* 1 */ &ASN_PER_TYPE_REL_DISTANCE_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RelDistance.h b/src/core/libs/supl/asn-rrlp/RelDistance.h index 8578beb63..c53c6cc66 100644 --- a/src/core/libs/supl/asn-rrlp/RelDistance.h +++ b/src/core/libs/supl/asn-rrlp/RelDistance.h @@ -7,7 +7,6 @@ #ifndef _RelDistance_H_ #define _RelDistance_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/RelativeAlt.c b/src/core/libs/supl/asn-rrlp/RelativeAlt.c index c0524bbba..f92227b37 100644 --- a/src/core/libs/supl/asn-rrlp/RelativeAlt.c +++ b/src/core/libs/supl/asn-rrlp/RelativeAlt.c @@ -6,119 +6,135 @@ #include "RelativeAlt.h" -int -RelativeAlt_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RelativeAlt_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -4000 && value <= 4000)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -4000 && value <= 4000)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RelativeAlt_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RelativeAlt_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RelativeAlt_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RelativeAlt_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RelativeAlt_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RelativeAlt_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RelativeAlt_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RelativeAlt_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RelativeAlt_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RelativeAlt_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RelativeAlt_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RelativeAlt_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RelativeAlt_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RelativeAlt_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RelativeAlt_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RelativeAlt_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RelativeAlt_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RelativeAlt_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ RelativeAlt_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_RELATIVE_ALT_CONSTR_1 = { - { APC_CONSTRAINED, 13, 13, -4000, 4000 } /* (-4000..4000) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 13, 13, -4000, 4000} /* (-4000..4000) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RelativeAlt_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RelativeAlt = { "RelativeAlt", "RelativeAlt", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_RelativeAlt = { RelativeAlt_encode_xer, RelativeAlt_decode_uper, RelativeAlt_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RelativeAlt_tags_1, - sizeof(asn_DEF_RelativeAlt_tags_1) - /sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ - asn_DEF_RelativeAlt_tags_1, /* Same as above */ - sizeof(asn_DEF_RelativeAlt_tags_1) - /sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RelativeAlt_tags_1) / + sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ + asn_DEF_RelativeAlt_tags_1, /* Same as above */ + sizeof(asn_DEF_RelativeAlt_tags_1) / + sizeof(asn_DEF_RelativeAlt_tags_1[0]), /* 1 */ &ASN_PER_TYPE_RELATIVE_ALT_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RelativeAlt.h b/src/core/libs/supl/asn-rrlp/RelativeAlt.h index 38b045c65..5a9a56d4f 100644 --- a/src/core/libs/supl/asn-rrlp/RelativeAlt.h +++ b/src/core/libs/supl/asn-rrlp/RelativeAlt.h @@ -7,7 +7,6 @@ #ifndef _RelativeAlt_H_ #define _RelativeAlt_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/RequestIndex.c b/src/core/libs/supl/asn-rrlp/RequestIndex.c index 174fdf84e..7c9441dde 100644 --- a/src/core/libs/supl/asn-rrlp/RequestIndex.c +++ b/src/core/libs/supl/asn-rrlp/RequestIndex.c @@ -6,119 +6,137 @@ #include "RequestIndex.h" -int -RequestIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RequestIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 1 && value <= 16)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 1 && value <= 16)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RequestIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RequestIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RequestIndex_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RequestIndex_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RequestIndex_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RequestIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RequestIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ RequestIndex_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RequestIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RequestIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ RequestIndex_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RequestIndex_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RequestIndex_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RequestIndex_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RequestIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RequestIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ RequestIndex_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RequestIndex_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RequestIndex_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RequestIndex_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RequestIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RequestIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ RequestIndex_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RequestIndex_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RequestIndex_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ RequestIndex_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_REQUEST_INDEX_CONSTR_1 = { - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (1..16) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 1, 16} /* (1..16) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RequestIndex_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RequestIndex = { "RequestIndex", "RequestIndex", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_RequestIndex = { RequestIndex_encode_xer, RequestIndex_decode_uper, RequestIndex_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RequestIndex_tags_1, - sizeof(asn_DEF_RequestIndex_tags_1) - /sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ - asn_DEF_RequestIndex_tags_1, /* Same as above */ - sizeof(asn_DEF_RequestIndex_tags_1) - /sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RequestIndex_tags_1) / + sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ + asn_DEF_RequestIndex_tags_1, /* Same as above */ + sizeof(asn_DEF_RequestIndex_tags_1) / + sizeof(asn_DEF_RequestIndex_tags_1[0]), /* 1 */ &ASN_PER_TYPE_REQUEST_INDEX_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RequestIndex.h b/src/core/libs/supl/asn-rrlp/RequestIndex.h index 104ec2124..5320c12cc 100644 --- a/src/core/libs/supl/asn-rrlp/RequestIndex.h +++ b/src/core/libs/supl/asn-rrlp/RequestIndex.h @@ -7,7 +7,6 @@ #ifndef _RequestIndex_H_ #define _RequestIndex_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c index bf44c971a..f167d8354 100644 --- a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c +++ b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.c @@ -6,119 +6,139 @@ #include "RequiredResponseTime.h" -int -RequiredResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RequiredResponseTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 1 && value <= 128)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 1 && value <= 128)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RequiredResponseTime_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RequiredResponseTime_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RequiredResponseTime_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RequiredResponseTime_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RequiredResponseTime_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RequiredResponseTime_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RequiredResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RequiredResponseTime_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RequiredResponseTime_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RequiredResponseTime_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RequiredResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RequiredResponseTime_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RequiredResponseTime_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RequiredResponseTime_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RequiredResponseTime_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RequiredResponseTime_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RequiredResponseTime_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RequiredResponseTime_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ RequiredResponseTime_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_REQUIRED_RESPONSE_TIME_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 1, 128 } /* (1..128) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 1, 128} /* (1..128) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RequiredResponseTime_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RequiredResponseTime = { "RequiredResponseTime", "RequiredResponseTime", @@ -131,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_RequiredResponseTime = { RequiredResponseTime_encode_xer, RequiredResponseTime_decode_uper, RequiredResponseTime_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RequiredResponseTime_tags_1, - sizeof(asn_DEF_RequiredResponseTime_tags_1) - /sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ - asn_DEF_RequiredResponseTime_tags_1, /* Same as above */ - sizeof(asn_DEF_RequiredResponseTime_tags_1) - /sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RequiredResponseTime_tags_1) / + sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ + asn_DEF_RequiredResponseTime_tags_1, /* Same as above */ + sizeof(asn_DEF_RequiredResponseTime_tags_1) / + sizeof(asn_DEF_RequiredResponseTime_tags_1[0]), /* 1 */ &ASN_PER_TYPE_REQUIRED_RESPONSE_TIME_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h index e9deb5a35..ee26a1114 100644 --- a/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h +++ b/src/core/libs/supl/asn-rrlp/RequiredResponseTime.h @@ -7,7 +7,6 @@ #ifndef _RequiredResponseTime_H_ #define _RequiredResponseTime_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/RoughRTD.c b/src/core/libs/supl/asn-rrlp/RoughRTD.c index a3806a16d..8e773c3f5 100644 --- a/src/core/libs/supl/asn-rrlp/RoughRTD.c +++ b/src/core/libs/supl/asn-rrlp/RoughRTD.c @@ -6,119 +6,130 @@ #include "RoughRTD.h" -int -RoughRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int RoughRTD_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1250)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1250)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -RoughRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void RoughRTD_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -RoughRTD_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void RoughRTD_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ RoughRTD_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -RoughRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int RoughRTD_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ RoughRTD_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -RoughRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t RoughRTD_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ RoughRTD_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -RoughRTD_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RoughRTD_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ RoughRTD_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -RoughRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t RoughRTD_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ RoughRTD_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -RoughRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t RoughRTD_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ RoughRTD_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -RoughRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t RoughRTD_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ RoughRTD_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -RoughRTD_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t RoughRTD_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ RoughRTD_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ROUGH_RTD_CONSTR_1 = { - { APC_CONSTRAINED, 11, 11, 0, 1250 } /* (0..1250) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 11, 11, 0, 1250} /* (0..1250) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_RoughRTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_RoughRTD = { "RoughRTD", "RoughRTD", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_RoughRTD = { RoughRTD_encode_xer, RoughRTD_decode_uper, RoughRTD_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RoughRTD_tags_1, - sizeof(asn_DEF_RoughRTD_tags_1) - /sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ - asn_DEF_RoughRTD_tags_1, /* Same as above */ - sizeof(asn_DEF_RoughRTD_tags_1) - /sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_RoughRTD_tags_1) / + sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ + asn_DEF_RoughRTD_tags_1, /* Same as above */ + sizeof(asn_DEF_RoughRTD_tags_1) / + sizeof(asn_DEF_RoughRTD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ROUGH_RTD_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/RoughRTD.h b/src/core/libs/supl/asn-rrlp/RoughRTD.h index 79f9244cc..82bfa3fb5 100644 --- a/src/core/libs/supl/asn-rrlp/RoughRTD.h +++ b/src/core/libs/supl/asn-rrlp/RoughRTD.h @@ -7,7 +7,6 @@ #ifndef _RoughRTD_H_ #define _RoughRTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SVID.c b/src/core/libs/supl/asn-rrlp/SVID.c index 7b31e6d3e..207f5fd99 100644 --- a/src/core/libs/supl/asn-rrlp/SVID.c +++ b/src/core/libs/supl/asn-rrlp/SVID.c @@ -6,119 +6,128 @@ #include "SVID.h" -int -SVID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SVID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -SVID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void SVID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -SVID_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void SVID_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ SVID_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -SVID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int SVID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ SVID_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -SVID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t SVID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ SVID_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -SVID_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SVID_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ SVID_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -SVID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t SVID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ SVID_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -SVID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SVID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ SVID_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -SVID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t SVID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ SVID_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -SVID_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t SVID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ SVID_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_SVID_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_SVID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_SVID = { "SVID", "SVID", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_SVID = { SVID_encode_xer, SVID_decode_uper, SVID_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SVID_tags_1, - sizeof(asn_DEF_SVID_tags_1) - /sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ - asn_DEF_SVID_tags_1, /* Same as above */ - sizeof(asn_DEF_SVID_tags_1) - /sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SVID_tags_1) / sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ + asn_DEF_SVID_tags_1, /* Same as above */ + sizeof(asn_DEF_SVID_tags_1) / sizeof(asn_DEF_SVID_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SVID_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SVID.h b/src/core/libs/supl/asn-rrlp/SVID.h index 645da5a9d..9330322ad 100644 --- a/src/core/libs/supl/asn-rrlp/SVID.h +++ b/src/core/libs/supl/asn-rrlp/SVID.h @@ -7,7 +7,6 @@ #ifndef _SVID_H_ #define _SVID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SVIDMASK.c b/src/core/libs/supl/asn-rrlp/SVIDMASK.c index dcd96880e..cd553ccfc 100644 --- a/src/core/libs/supl/asn-rrlp/SVIDMASK.c +++ b/src/core/libs/supl/asn-rrlp/SVIDMASK.c @@ -6,125 +6,139 @@ #include "SVIDMASK.h" -int -SVIDMASK_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SVIDMASK_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - - if(st->size > 0) { - /* Size in bits */ - size = 8 * st->size - (st->bits_unused & 0x07); - } else { - size = 0; - } - - if((size >= 1 && size <= 36)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + + if (st->size > 0) + { + /* Size in bits */ + size = 8 * st->size - (st->bits_unused & 0x07); + } + else + { + size = 0; + } + + if ((size >= 1 && size <= 36)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -SVIDMASK_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_BIT_STRING.free_struct; - td->print_struct = asn_DEF_BIT_STRING.print_struct; - td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; - td->der_encoder = asn_DEF_BIT_STRING.der_encoder; - td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; - td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; - td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; - td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; - if(!td->per_constraints) +static void SVIDMASK_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_BIT_STRING.free_struct; + td->print_struct = asn_DEF_BIT_STRING.print_struct; + td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; + td->der_encoder = asn_DEF_BIT_STRING.der_encoder; + td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; + td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; + td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; + td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; - td->elements = asn_DEF_BIT_STRING.elements; + td->elements = asn_DEF_BIT_STRING.elements; td->elements_count = asn_DEF_BIT_STRING.elements_count; - td->specifics = asn_DEF_BIT_STRING.specifics; + td->specifics = asn_DEF_BIT_STRING.specifics; } -void -SVIDMASK_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void SVIDMASK_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -SVIDMASK_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int SVIDMASK_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -SVIDMASK_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t SVIDMASK_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -SVIDMASK_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SVIDMASK_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -SVIDMASK_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t SVIDMASK_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -SVIDMASK_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SVIDMASK_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -SVIDMASK_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t SVIDMASK_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -SVIDMASK_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t SVIDMASK_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ SVIDMASK_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_SVIDMASK_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 36 } /* (SIZE(1..36)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 36} /* (SIZE(1..36)) */, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_SVIDMASK_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; asn_TYPE_descriptor_t asn_DEF_SVIDMASK = { "SVIDMASK", "SVIDMASK", @@ -137,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_SVIDMASK = { SVIDMASK_encode_xer, SVIDMASK_decode_uper, SVIDMASK_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SVIDMASK_tags_1, - sizeof(asn_DEF_SVIDMASK_tags_1) - /sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ - asn_DEF_SVIDMASK_tags_1, /* Same as above */ - sizeof(asn_DEF_SVIDMASK_tags_1) - /sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SVIDMASK_tags_1) / + sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ + asn_DEF_SVIDMASK_tags_1, /* Same as above */ + sizeof(asn_DEF_SVIDMASK_tags_1) / + sizeof(asn_DEF_SVIDMASK_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SVIDMASK_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SVIDMASK.h b/src/core/libs/supl/asn-rrlp/SVIDMASK.h index 3801fbf4e..7ead136e7 100644 --- a/src/core/libs/supl/asn-rrlp/SVIDMASK.h +++ b/src/core/libs/supl/asn-rrlp/SVIDMASK.h @@ -7,7 +7,6 @@ #ifndef _SVIDMASK_H_ #define _SVIDMASK_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SatElement.c b/src/core/libs/supl/asn-rrlp/SatElement.c index 20561f7db..cf9a25061 100644 --- a/src/core/libs/supl/asn-rrlp/SatElement.c +++ b/src/core/libs/supl/asn-rrlp/SatElement.c @@ -6,351 +6,346 @@ #include "SatElement.h" -static int -memb_iode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_iode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 239)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 239)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_udre_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_pseudoRangeCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_pseudoRangeCor_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2047 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2047 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_rangeRateCor_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -127 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -127 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_deltaPseudoRangeCor2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaPseudoRangeCor2_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -127 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -127 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_deltaRangeRateCor2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaRangeRateCor2_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -7 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -7 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_deltaPseudoRangeCor3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaPseudoRangeCor3_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -127 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -127 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_deltaRangeRateCor3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_deltaRangeRateCor3_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -7 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -7 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_IODE_CONSTR_3 = { - { APC_CONSTRAINED, 8, 8, 0, 239 } /* (0..239) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 239} /* (0..239) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UDRE_CONSTR_4 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5 = { - { APC_CONSTRAINED, 12, 12, -2047, 2047 } /* (-2047..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, -2047, 2047} /* (-2047..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6 = { - { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -127, 127} /* (-127..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR2_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -127, 127} /* (-127..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELTA_RANGE_RATE_COR2_CONSTR_8 = { - { APC_CONSTRAINED, 4, 4, -7, 7 } /* (-7..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, -7, 7} /* (-7..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR3_CONSTR_9 = { - { APC_CONSTRAINED, 8, 8, -127, 127 } /* (-127..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -127, 127} /* (-127..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELTA_RANGE_RATE_COR3_CONSTR_10 = { - { APC_CONSTRAINED, 4, 4, -7, 7 } /* (-7..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, -7, 7} /* (-7..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SatElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SatElement, satelliteID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satelliteID" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, iode), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_iode_constraint_1, - &ASN_PER_MEMB_IODE_CONSTR_3, - 0, - "iode" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, udre), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_udre_constraint_1, - &ASN_PER_MEMB_UDRE_CONSTR_4, - 0, - "udre" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, pseudoRangeCor), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_pseudoRangeCor_constraint_1, - &ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5, - 0, - "pseudoRangeCor" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, rangeRateCor), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_rangeRateCor_constraint_1, - &ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6, - 0, - "rangeRateCor" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor2), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaPseudoRangeCor2_constraint_1, - &ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR2_CONSTR_7, - 0, - "deltaPseudoRangeCor2" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor2), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaRangeRateCor2_constraint_1, - &ASN_PER_MEMB_DELTA_RANGE_RATE_COR2_CONSTR_8, - 0, - "deltaRangeRateCor2" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor3), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaPseudoRangeCor3_constraint_1, - &ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR3_CONSTR_9, - 0, - "deltaPseudoRangeCor3" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor3), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_deltaRangeRateCor3_constraint_1, - &ASN_PER_MEMB_DELTA_RANGE_RATE_COR3_CONSTR_10, - 0, - "deltaRangeRateCor3" - }, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, satelliteID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satelliteID"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, iode), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_iode_constraint_1, + &ASN_PER_MEMB_IODE_CONSTR_3, 0, "iode"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, udre), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_udre_constraint_1, + &ASN_PER_MEMB_UDRE_CONSTR_4, 0, "udre"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, pseudoRangeCor), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_pseudoRangeCor_constraint_1, + &ASN_PER_MEMB_PSEUDO_RANGE_COR_CONSTR_5, 0, "pseudoRangeCor"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, rangeRateCor), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_rangeRateCor_constraint_1, + &ASN_PER_MEMB_RANGE_RATE_COR_CONSTR_6, 0, "rangeRateCor"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor2), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaPseudoRangeCor2_constraint_1, + &ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR2_CONSTR_7, 0, "deltaPseudoRangeCor2"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaRangeRateCor2_constraint_1, + &ASN_PER_MEMB_DELTA_RANGE_RATE_COR2_CONSTR_8, 0, "deltaRangeRateCor2"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaPseudoRangeCor3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaPseudoRangeCor3_constraint_1, + &ASN_PER_MEMB_DELTA_PSEUDO_RANGE_COR3_CONSTR_9, 0, "deltaPseudoRangeCor3"}, + {ATF_NOFLAGS, 0, offsetof(struct SatElement, deltaRangeRateCor3), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_deltaRangeRateCor3_constraint_1, + &ASN_PER_MEMB_DELTA_RANGE_RATE_COR3_CONSTR_10, 0, "deltaRangeRateCor3"}, }; static ber_tlv_tag_t asn_DEF_SatElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SatElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satelliteID at 664 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* iode at 667 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* udre at 669 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pseudoRangeCor at 673 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* rangeRateCor at 677 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* deltaPseudoRangeCor2 at 680 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* deltaRangeRateCor2 at 683 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* deltaPseudoRangeCor3 at 686 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 } /* deltaRangeRateCor3 at 689 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satelliteID at 664 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* iode at 667 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* udre at 669 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* pseudoRangeCor at 673 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* rangeRateCor at 677 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* deltaPseudoRangeCor2 at 680 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* deltaRangeRateCor2 at 683 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* deltaPseudoRangeCor3 at 686 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, + 0} /* deltaRangeRateCor3 at 689 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SatElement_specs_1 = { sizeof(struct SatElement), offsetof(struct SatElement, _asn_ctx), asn_MAP_SatElement_tag2el_1, - 9, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 9, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SatElement = { "SatElement", @@ -364,16 +359,15 @@ asn_TYPE_descriptor_t asn_DEF_SatElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SatElement_tags_1, - sizeof(asn_DEF_SatElement_tags_1) - /sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ - asn_DEF_SatElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SatElement_tags_1) - /sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SatElement_tags_1) / + sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ + asn_DEF_SatElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SatElement_tags_1) / + sizeof(asn_DEF_SatElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SatElement_1, - 9, /* Elements count */ - &asn_SPC_SatElement_specs_1 /* Additional specs */ + 9, /* Elements count */ + &asn_SPC_SatElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SatElement.h b/src/core/libs/supl/asn-rrlp/SatElement.h index f51fee7d1..3f6a3860a 100644 --- a/src/core/libs/supl/asn-rrlp/SatElement.h +++ b/src/core/libs/supl/asn-rrlp/SatElement.h @@ -7,7 +7,6 @@ #ifndef _SatElement_H_ #define _SatElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SatStatus.c b/src/core/libs/supl/asn-rrlp/SatStatus.c index 3561d5489..7fc1d03a8 100644 --- a/src/core/libs/supl/asn-rrlp/SatStatus.c +++ b/src/core/libs/supl/asn-rrlp/SatStatus.c @@ -7,43 +7,36 @@ #include "SatStatus.h" static asn_per_constraints_t ASN_PER_TYPE_SAT_STATUS_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SatStatus_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newSatelliteAndModelUC), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UncompressedEphemeris, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "newSatelliteAndModelUC" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.oldSatelliteAndModel), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "oldSatelliteAndModel" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newNaviModelUC), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UncompressedEphemeris, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "newNaviModelUC" - }, + {ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newSatelliteAndModelUC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UncompressedEphemeris, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "newSatelliteAndModelUC"}, + {ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.oldSatelliteAndModel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "oldSatelliteAndModel"}, + {ATF_NOFLAGS, 0, offsetof(struct SatStatus, choice.newNaviModelUC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UncompressedEphemeris, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "newNaviModelUC"}, }; static asn_TYPE_tag2member_t asn_MAP_SatStatus_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* newSatelliteAndModelUC at 710 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* oldSatelliteAndModel at 713 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* newNaviModelUC at 716 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* newSatelliteAndModelUC at 710 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* oldSatelliteAndModel at 713 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* newNaviModelUC at 716 */ }; static asn_CHOICE_specifics_t asn_SPC_SatStatus_specs_1 = { sizeof(struct SatStatus), @@ -51,9 +44,9 @@ static asn_CHOICE_specifics_t asn_SPC_SatStatus_specs_1 = { offsetof(struct SatStatus, present), sizeof(((struct SatStatus *)0)->present), asn_MAP_SatStatus_tag2el_1, - 3, /* Count of tags in the map */ + 3, /* Count of tags in the map */ 0, - 3 /* Extensions start */ + 3 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_SatStatus = { "SatStatus", @@ -68,13 +61,12 @@ asn_TYPE_descriptor_t asn_DEF_SatStatus = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_SAT_STATUS_CONSTR_1, asn_MBR_SatStatus_1, - 3, /* Elements count */ - &asn_SPC_SatStatus_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_SatStatus_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SatStatus.h b/src/core/libs/supl/asn-rrlp/SatStatus.h index 0026608ba..4396376fd 100644 --- a/src/core/libs/supl/asn-rrlp/SatStatus.h +++ b/src/core/libs/supl/asn-rrlp/SatStatus.h @@ -7,7 +7,6 @@ #ifndef _SatStatus_H_ #define _SatStatus_H_ - #include /* Including external dependencies */ @@ -40,9 +39,9 @@ extern "C" NULL_t oldSatelliteAndModel; UncompressedEphemeris_t newNaviModelUC; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-rrlp/SatelliteID.c b/src/core/libs/supl/asn-rrlp/SatelliteID.c index c5797fb4c..30d66d529 100644 --- a/src/core/libs/supl/asn-rrlp/SatelliteID.c +++ b/src/core/libs/supl/asn-rrlp/SatelliteID.c @@ -6,119 +6,135 @@ #include "SatelliteID.h" -int -SatelliteID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SatelliteID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -SatelliteID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void SatelliteID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -SatelliteID_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void SatelliteID_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ SatelliteID_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -SatelliteID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int SatelliteID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ SatelliteID_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -SatelliteID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t SatelliteID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ SatelliteID_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -SatelliteID_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SatelliteID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ SatelliteID_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -SatelliteID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t SatelliteID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ SatelliteID_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -SatelliteID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SatelliteID_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ SatelliteID_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -SatelliteID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t SatelliteID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ SatelliteID_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -SatelliteID_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t SatelliteID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ SatelliteID_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_SATELLITE_ID_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_SatelliteID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_SatelliteID = { "SatelliteID", "SatelliteID", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_SatelliteID = { SatelliteID_encode_xer, SatelliteID_decode_uper, SatelliteID_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SatelliteID_tags_1, - sizeof(asn_DEF_SatelliteID_tags_1) - /sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ - asn_DEF_SatelliteID_tags_1, /* Same as above */ - sizeof(asn_DEF_SatelliteID_tags_1) - /sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SatelliteID_tags_1) / + sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ + asn_DEF_SatelliteID_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteID_tags_1) / + sizeof(asn_DEF_SatelliteID_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SATELLITE_ID_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SatelliteID.h b/src/core/libs/supl/asn-rrlp/SatelliteID.h index b2c71266b..05372d530 100644 --- a/src/core/libs/supl/asn-rrlp/SatelliteID.h +++ b/src/core/libs/supl/asn-rrlp/SatelliteID.h @@ -7,7 +7,6 @@ #ifndef _SatelliteID_H_ #define _SatelliteID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c index dc2b3525f..ab1c4ee2f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c +++ b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.c @@ -7,28 +7,24 @@ #include "SeqOf-BadSatelliteSet.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_BAD_SATELLITE_SET_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOf_BadSatelliteSet_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), - 0, - &asn_DEF_SatelliteID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, + &asn_DEF_SatelliteID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOf_BadSatelliteSet_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOf_BadSatelliteSet_specs_1 = { sizeof(struct SeqOf_BadSatelliteSet), offsetof(struct SeqOf_BadSatelliteSet, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOf_BadSatelliteSet = { "SeqOf-BadSatelliteSet", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOf_BadSatelliteSet = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOf_BadSatelliteSet_tags_1, - sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) - /sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ - asn_DEF_SeqOf_BadSatelliteSet_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) - /sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) / + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ + asn_DEF_SeqOf_BadSatelliteSet_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1) / + sizeof(asn_DEF_SeqOf_BadSatelliteSet_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_BAD_SATELLITE_SET_CONSTR_1, asn_MBR_SeqOf_BadSatelliteSet_1, - 1, /* Single element */ - &asn_SPC_SeqOf_BadSatelliteSet_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOf_BadSatelliteSet_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h index 01c66e77b..62d739b9c 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h +++ b/src/core/libs/supl/asn-rrlp/SeqOf-BadSatelliteSet.h @@ -7,7 +7,6 @@ #ifndef _SeqOf_BadSatelliteSet_H_ #define _SeqOf_BadSatelliteSet_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c index 8d0aa92af..172e65172 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c +++ b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.c @@ -7,28 +7,24 @@ #include "SeqOf-GANSSDataBits.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_DATA_BITS_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 10, 10, 1, 1024} /* (SIZE(1..1024)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOf_GANSSDataBits_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), - 0, - &asn_DEF_GANSSDataBit, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, + &asn_DEF_GANSSDataBit, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOf_GANSSDataBits_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOf_GANSSDataBits_specs_1 = { sizeof(struct SeqOf_GANSSDataBits), offsetof(struct SeqOf_GANSSDataBits, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOf_GANSSDataBits = { "SeqOf-GANSSDataBits", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOf_GANSSDataBits = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOf_GANSSDataBits_tags_1, - sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) - /sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ - asn_DEF_SeqOf_GANSSDataBits_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) - /sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) / + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ + asn_DEF_SeqOf_GANSSDataBits_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1) / + sizeof(asn_DEF_SeqOf_GANSSDataBits_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_DATA_BITS_CONSTR_1, asn_MBR_SeqOf_GANSSDataBits_1, - 1, /* Single element */ - &asn_SPC_SeqOf_GANSSDataBits_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOf_GANSSDataBits_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h index 9c60fe69c..5f1280740 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h +++ b/src/core/libs/supl/asn-rrlp/SeqOf-GANSSDataBits.h @@ -7,7 +7,6 @@ #ifndef _SeqOf_GANSSDataBits_H_ #define _SeqOf_GANSSDataBits_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c index 6091e0176..1aeff9d77 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.c @@ -7,28 +7,24 @@ #include "SeqOfAcquisElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_ACQUIS_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfAcquisElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_AcquisElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_AcquisElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfAcquisElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfAcquisElement_specs_1 = { sizeof(struct SeqOfAcquisElement), offsetof(struct SeqOfAcquisElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfAcquisElement = { "SeqOfAcquisElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfAcquisElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfAcquisElement_tags_1, - sizeof(asn_DEF_SeqOfAcquisElement_tags_1) - /sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfAcquisElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfAcquisElement_tags_1) - /sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfAcquisElement_tags_1) / + sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfAcquisElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfAcquisElement_tags_1) / + sizeof(asn_DEF_SeqOfAcquisElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_ACQUIS_ELEMENT_CONSTR_1, asn_MBR_SeqOfAcquisElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfAcquisElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfAcquisElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h index 3662de5e8..b0b1854c4 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfAcquisElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfAcquisElement_H_ #define _SeqOfAcquisElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c index b2e57555e..35f590953 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.c @@ -7,28 +7,24 @@ #include "SeqOfAlmanacElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_ALMANAC_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 64} /* (SIZE(1..64)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfAlmanacElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_AlmanacElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_AlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfAlmanacElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfAlmanacElement_specs_1 = { sizeof(struct SeqOfAlmanacElement), offsetof(struct SeqOfAlmanacElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfAlmanacElement = { "SeqOfAlmanacElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfAlmanacElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfAlmanacElement_tags_1, - sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) - /sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfAlmanacElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) - /sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) / + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfAlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1) / + sizeof(asn_DEF_SeqOfAlmanacElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_ALMANAC_ELEMENT_CONSTR_1, asn_MBR_SeqOfAlmanacElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfAlmanacElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfAlmanacElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h index e93655b1e..a73a7ff9a 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfAlmanacElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfAlmanacElement_H_ #define _SeqOfAlmanacElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c index 1adf5cd7f..225da2729 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.c @@ -7,28 +7,24 @@ #include "SeqOfBadSignalElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_BAD_SIGNAL_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfBadSignalElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_BadSignalElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_BadSignalElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfBadSignalElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfBadSignalElement_specs_1 = { sizeof(struct SeqOfBadSignalElement), offsetof(struct SeqOfBadSignalElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfBadSignalElement = { "SeqOfBadSignalElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfBadSignalElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfBadSignalElement_tags_1, - sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) - /sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfBadSignalElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) - /sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) / + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfBadSignalElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1) / + sizeof(asn_DEF_SeqOfBadSignalElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_BAD_SIGNAL_ELEMENT_CONSTR_1, asn_MBR_SeqOfBadSignalElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfBadSignalElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfBadSignalElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h index 00eabea99..c4c9c3533 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfBadSignalElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfBadSignalElement_H_ #define _SeqOfBadSignalElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c index 50d51345c..b07e09a50 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.c @@ -7,28 +7,24 @@ #include "SeqOfDGANSSSgnElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_DGANSS_SGN_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfDGANSSSgnElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_DGANSSSgnElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_DGANSSSgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfDGANSSSgnElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfDGANSSSgnElement_specs_1 = { sizeof(struct SeqOfDGANSSSgnElement), offsetof(struct SeqOfDGANSSSgnElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfDGANSSSgnElement = { "SeqOfDGANSSSgnElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfDGANSSSgnElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfDGANSSSgnElement_tags_1, - sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) - /sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfDGANSSSgnElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) - /sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) / + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfDGANSSSgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1) / + sizeof(asn_DEF_SeqOfDGANSSSgnElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_DGANSS_SGN_ELEMENT_CONSTR_1, asn_MBR_SeqOfDGANSSSgnElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfDGANSSSgnElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfDGANSSSgnElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h index 1cb174c4f..848427e35 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfDGANSSSgnElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfDGANSSSgnElement_H_ #define _SeqOfDGANSSSgnElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c index c11e8a23f..454ced504 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.c @@ -6,29 +6,26 @@ #include "SeqOfGANSS-MsrSetElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_MSR_SET_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_MSR_SET_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 2, 2, 1, 3} /* (SIZE(1..3)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSS_MsrSetElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSS_MsrSetElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_MsrSetElement_specs_1 = { sizeof(struct SeqOfGANSS_MsrSetElement), offsetof(struct SeqOfGANSS_MsrSetElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_MsrSetElement = { "SeqOfGANSS-MsrSetElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_MsrSetElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSS_MsrSetElement_tags_1, - sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSS_MsrSetElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_MsrSetElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_MSR_SET_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSS_MsrSetElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSS_MsrSetElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_MsrSetElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h index fe27ababb..93378a11f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-MsrSetElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSS_MsrSetElement_H_ #define _SeqOfGANSS_MsrSetElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c index f2caf804f..efe0b08fa 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.c @@ -7,28 +7,24 @@ #include "SeqOfGANSS-SgnElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_SGN_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSS_SgnElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSS_SgnElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSS_SgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSS_SgnElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_SgnElement_specs_1 = { sizeof(struct SeqOfGANSS_SgnElement), offsetof(struct SeqOfGANSS_SgnElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnElement = { "SeqOfGANSS-SgnElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSS_SgnElement_tags_1, - sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSS_SgnElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_SgnElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_SgnElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_SGN_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSS_SgnElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSS_SgnElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_SgnElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h index 8fa4bab33..aaa6d409f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSS_SgnElement_H_ #define _SeqOfGANSS_SgnElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c index 066a92672..e2013b8d4 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.c @@ -6,29 +6,26 @@ #include "SeqOfGANSS-SgnTypeElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_SGN_TYPE_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 3, 3, 1, 6 } /* (SIZE(1..6)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_SGN_TYPE_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 3, 3, 1, 6} /* (SIZE(1..6)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSS_SgnTypeElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSS_SgnTypeElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSS_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSS_SgnTypeElement_specs_1 = { sizeof(struct SeqOfGANSS_SgnTypeElement), offsetof(struct SeqOfGANSS_SgnTypeElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnTypeElement = { "SeqOfGANSS-SgnTypeElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSS_SgnTypeElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1, - sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSS_SgnTypeElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_SGN_TYPE_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSS_SgnTypeElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSS_SgnTypeElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSS_SgnTypeElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h index 5ff372bb0..f1a7dcb1c 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSS-SgnTypeElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSS_SgnTypeElement_H_ #define _SeqOfGANSS_SgnTypeElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c index d9aa8d88e..fdaae1587 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.c @@ -6,29 +6,26 @@ #include "SeqOfGANSSAlmanacElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_ALMANAC_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 36 } /* (SIZE(1..36)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_ALMANAC_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 36} /* (SIZE(1..36)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSSAlmanacElement_1[] = { - { ATF_POINTER, 0, 0, - -1 /* Ambiguous tag (CHOICE?) */, - 0, - &asn_DEF_GANSSAlmanacElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, -1 /* Ambiguous tag (CHOICE?) */, 0, + &asn_DEF_GANSSAlmanacElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSSAlmanacElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSAlmanacElement_specs_1 = { sizeof(struct SeqOfGANSSAlmanacElement), offsetof(struct SeqOfGANSSAlmanacElement, _asn_ctx), - 2, /* XER encoding is XMLValueList */ + 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSAlmanacElement = { "SeqOfGANSSAlmanacElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSAlmanacElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSSAlmanacElement_tags_1, - sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSSAlmanacElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSAlmanacElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSAlmanacElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_ALMANAC_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSSAlmanacElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSSAlmanacElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSSAlmanacElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h index 10326c91b..1dcfdae87 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSAlmanacElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSSAlmanacElement_H_ #define _SeqOfGANSSAlmanacElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c index 5587ece6b..3e6aae21e 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.c @@ -6,29 +6,27 @@ #include "SeqOfGANSSGenericAssistDataElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_GENERIC_ASSIST_DATA_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_GENERIC_ASSIST_DATA_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 3, 3, 1, 8} /* (SIZE(1..8)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSSGenericAssistDataElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSSGenericAssistDataElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSSGenericAssistDataElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 = { - sizeof(struct SeqOfGANSSGenericAssistDataElement), - offsetof(struct SeqOfGANSSGenericAssistDataElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_SET_OF_specifics_t + asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 = { + sizeof(struct SeqOfGANSSGenericAssistDataElement), + offsetof(struct SeqOfGANSSGenericAssistDataElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSGenericAssistDataElement = { "SeqOfGANSSGenericAssistDataElement", @@ -42,16 +40,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSGenericAssistDataElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1, - sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSGenericAssistDataElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_GENERIC_ASSIST_DATA_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSSGenericAssistDataElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSSGenericAssistDataElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h index 2ee04210f..fe4b14618 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSGenericAssistDataElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSSGenericAssistDataElement_H_ #define _SeqOfGANSSGenericAssistDataElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c index e84f5a1a2..53d8469a3 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.c @@ -6,29 +6,27 @@ #include "SeqOfGANSSRefMeasurementElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_REF_MEASUREMENT_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_REF_MEASUREMENT_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSSRefMeasurementElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSSRefMeasurementElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSSRefMeasurementElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 = { - sizeof(struct SeqOfGANSSRefMeasurementElement), - offsetof(struct SeqOfGANSSRefMeasurementElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 = + { + sizeof(struct SeqOfGANSSRefMeasurementElement), + offsetof(struct SeqOfGANSSRefMeasurementElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSRefMeasurementElement = { "SeqOfGANSSRefMeasurementElement", @@ -42,16 +40,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSRefMeasurementElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1, - sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSRefMeasurementElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_REF_MEASUREMENT_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSSRefMeasurementElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSSRefMeasurementElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h index 63ea25e22..2f70207aa 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSRefMeasurementElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSSRefMeasurementElement_H_ #define _SeqOfGANSSRefMeasurementElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c index 0118b4994..9788e28c3 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.c @@ -6,29 +6,26 @@ #include "SeqOfGANSSSatelliteElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_SATELLITE_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_GANSS_SATELLITE_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 32} /* (SIZE(1..32)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSSSatelliteElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSSSatelliteElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSSSatelliteElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSSSatelliteElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSSatelliteElement_specs_1 = { sizeof(struct SeqOfGANSSSatelliteElement), offsetof(struct SeqOfGANSSSatelliteElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSSatelliteElement = { "SeqOfGANSSSatelliteElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSSatelliteElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSSSatelliteElement_tags_1, - sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSSSatelliteElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) - /sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSSatelliteElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1) / + sizeof(asn_DEF_SeqOfGANSSSatelliteElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_SATELLITE_ELEMENT_CONSTR_1, asn_MBR_SeqOfGANSSSatelliteElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSSSatelliteElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSSSatelliteElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h index 09e5f3c34..e43f9a69d 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSSatelliteElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSSSatelliteElement_H_ #define _SeqOfGANSSSatelliteElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c index 991293bc8..6861e5b3f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.c @@ -7,28 +7,24 @@ #include "SeqOfGANSSTimeModel.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GANSS_TIME_MODEL_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 3, 3, 1, 7 } /* (SIZE(1..7)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 3, 3, 1, 7} /* (SIZE(1..7)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGANSSTimeModel_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GANSSTimeModelElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GANSSTimeModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGANSSTimeModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGANSSTimeModel_specs_1 = { sizeof(struct SeqOfGANSSTimeModel), offsetof(struct SeqOfGANSSTimeModel, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSTimeModel = { "SeqOfGANSSTimeModel", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGANSSTimeModel = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGANSSTimeModel_tags_1, - sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) - /sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGANSSTimeModel_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) - /sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) / + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGANSSTimeModel_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1) / + sizeof(asn_DEF_SeqOfGANSSTimeModel_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GANSS_TIME_MODEL_CONSTR_1, asn_MBR_SeqOfGANSSTimeModel_1, - 1, /* Single element */ - &asn_SPC_SeqOfGANSSTimeModel_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGANSSTimeModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h index ac40862a6..56af35507 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGANSSTimeModel.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGANSSTimeModel_H_ #define _SeqOfGANSSTimeModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c index 99ccffd23..99d3ebb67 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.c @@ -7,28 +7,24 @@ #include "SeqOfGPS-MsrElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GPS_MSR_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGPS_MsrElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GPS_MsrElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GPS_MsrElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGPS_MsrElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGPS_MsrElement_specs_1 = { sizeof(struct SeqOfGPS_MsrElement), offsetof(struct SeqOfGPS_MsrElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrElement = { "SeqOfGPS-MsrElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGPS_MsrElement_tags_1, - sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) - /sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGPS_MsrElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) - /sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) / + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGPS_MsrElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1) / + sizeof(asn_DEF_SeqOfGPS_MsrElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GPS_MSR_ELEMENT_CONSTR_1, asn_MBR_SeqOfGPS_MsrElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGPS_MsrElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGPS_MsrElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h index e7a4e23ac..bc2af2409 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGPS_MsrElement_H_ #define _SeqOfGPS_MsrElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c index 95f300ef6..a990f4f38 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.c @@ -6,29 +6,26 @@ #include "SeqOfGPS-MsrSetElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GPS_MSR_SET_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_GPS_MSR_SET_ELEMENT_CONSTR_1 = + { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 2, 2, 1, 3} /* (SIZE(1..3)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfGPS_MsrSetElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_GPS_MsrSetElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_GPS_MsrSetElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfGPS_MsrSetElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfGPS_MsrSetElement_specs_1 = { sizeof(struct SeqOfGPS_MsrSetElement), offsetof(struct SeqOfGPS_MsrSetElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrSetElement = { "SeqOfGPS-MsrSetElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfGPS_MsrSetElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfGPS_MsrSetElement_tags_1, - sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) - /sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfGPS_MsrSetElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) - /sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) / + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfGPS_MsrSetElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1) / + sizeof(asn_DEF_SeqOfGPS_MsrSetElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_GPS_MSR_SET_ELEMENT_CONSTR_1, asn_MBR_SeqOfGPS_MsrSetElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfGPS_MsrSetElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfGPS_MsrSetElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h index 7ab7ae8a6..f1484567d 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfGPS-MsrSetElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfGPS_MsrSetElement_H_ #define _SeqOfGPS_MsrSetElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c index 3437b5a49..3ee788715 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.c @@ -6,29 +6,26 @@ #include "SeqOfMsrAssistBTS-R98-ExpOTD.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_MSR_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_MSR_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 15} /* (SIZE(1..15)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfMsrAssistBTS_R98_ExpOTD_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_MsrAssistBTS_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_MsrAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfMsrAssistBTS_R98_ExpOTD_specs_1 = { sizeof(struct SeqOfMsrAssistBTS_R98_ExpOTD), offsetof(struct SeqOfMsrAssistBTS_R98_ExpOTD, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD = { "SeqOfMsrAssistBTS-R98-ExpOTD", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1, - sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SeqOfMsrAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_MSR_ASSIST_BTS_R98_EXP_OTD_CONSTR_1, asn_MBR_SeqOfMsrAssistBTS_R98_ExpOTD_1, - 1, /* Single element */ - &asn_SPC_SeqOfMsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfMsrAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h index 4c97f1296..c6fb067b4 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _SeqOfMsrAssistBTS_R98_ExpOTD_H_ #define _SeqOfMsrAssistBTS_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c index de87a7b56..54238ae86 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.c @@ -7,28 +7,24 @@ #include "SeqOfMsrAssistBTS.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_MSR_ASSIST_BTS_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 15} /* (SIZE(1..15)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfMsrAssistBTS_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_MsrAssistBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_MsrAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfMsrAssistBTS_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfMsrAssistBTS_specs_1 = { sizeof(struct SeqOfMsrAssistBTS), offsetof(struct SeqOfMsrAssistBTS, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS = { "SeqOfMsrAssistBTS", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfMsrAssistBTS = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfMsrAssistBTS_tags_1, - sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) - /sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ - asn_DEF_SeqOfMsrAssistBTS_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) - /sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) / + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_SeqOfMsrAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1) / + sizeof(asn_DEF_SeqOfMsrAssistBTS_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_MSR_ASSIST_BTS_CONSTR_1, asn_MBR_SeqOfMsrAssistBTS_1, - 1, /* Single element */ - &asn_SPC_SeqOfMsrAssistBTS_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfMsrAssistBTS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h index 77d93c713..a87fe0b33 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfMsrAssistBTS.h @@ -7,7 +7,6 @@ #ifndef _SeqOfMsrAssistBTS_H_ #define _SeqOfMsrAssistBTS_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c index f7f39997b..ecf87d4c8 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.c @@ -7,28 +7,24 @@ #include "SeqOfNavModelElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_NAV_MODEL_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfNavModelElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_NavModelElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_NavModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfNavModelElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfNavModelElement_specs_1 = { sizeof(struct SeqOfNavModelElement), offsetof(struct SeqOfNavModelElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfNavModelElement = { "SeqOfNavModelElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfNavModelElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfNavModelElement_tags_1, - sizeof(asn_DEF_SeqOfNavModelElement_tags_1) - /sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfNavModelElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfNavModelElement_tags_1) - /sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfNavModelElement_tags_1) / + sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfNavModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfNavModelElement_tags_1) / + sizeof(asn_DEF_SeqOfNavModelElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_NAV_MODEL_ELEMENT_CONSTR_1, asn_MBR_SeqOfNavModelElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfNavModelElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfNavModelElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h index 4c7ba1c94..4ad6ea00d 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfNavModelElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfNavModelElement_H_ #define _SeqOfNavModelElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c index f2ef0664d..c84e758a1 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.c @@ -6,29 +6,26 @@ #include "SeqOfOTD-FirstSetMsrs-R98-Ext.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_OTD_FIRST_SET_MSRS_R98_EXT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 3, 3, 1, 5 } /* (SIZE(1..5)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_OTD_FIRST_SET_MSRS_R98_EXT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 3, 3, 1, 5} /* (SIZE(1..5)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfOTD_FirstSetMsrs_R98_Ext_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_OTD_FirstSetMsrs, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_OTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_FirstSetMsrs_R98_Ext_specs_1 = { sizeof(struct SeqOfOTD_FirstSetMsrs_R98_Ext), offsetof(struct SeqOfOTD_FirstSetMsrs_R98_Ext, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext = { "SeqOfOTD-FirstSetMsrs-R98-Ext", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1, - sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) - /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ - asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) - /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) / + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1) / + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_R98_Ext_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_OTD_FIRST_SET_MSRS_R98_EXT_CONSTR_1, asn_MBR_SeqOfOTD_FirstSetMsrs_R98_Ext_1, - 1, /* Single element */ - &asn_SPC_SeqOfOTD_FirstSetMsrs_R98_Ext_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfOTD_FirstSetMsrs_R98_Ext_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h index 3fd1b3d51..56fd5116c 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs-R98-Ext.h @@ -7,7 +7,6 @@ #ifndef _SeqOfOTD_FirstSetMsrs_R98_Ext_H_ #define _SeqOfOTD_FirstSetMsrs_R98_Ext_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c index 5ade9053c..3fd18b74f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.c @@ -7,28 +7,24 @@ #include "SeqOfOTD-FirstSetMsrs.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_OTD_FIRST_SET_MSRS_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 10 } /* (SIZE(1..10)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 10} /* (SIZE(1..10)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfOTD_FirstSetMsrs_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_OTD_FirstSetMsrs, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_OTD_FirstSetMsrs, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_FirstSetMsrs_specs_1 = { sizeof(struct SeqOfOTD_FirstSetMsrs), offsetof(struct SeqOfOTD_FirstSetMsrs, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs = { "SeqOfOTD-FirstSetMsrs", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_FirstSetMsrs = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1, - sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) - /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ - asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) - /sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) / + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1) / + sizeof(asn_DEF_SeqOfOTD_FirstSetMsrs_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_OTD_FIRST_SET_MSRS_CONSTR_1, asn_MBR_SeqOfOTD_FirstSetMsrs_1, - 1, /* Single element */ - &asn_SPC_SeqOfOTD_FirstSetMsrs_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfOTD_FirstSetMsrs_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h index c655e3399..f0e58d16f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-FirstSetMsrs.h @@ -7,7 +7,6 @@ #ifndef _SeqOfOTD_FirstSetMsrs_H_ #define _SeqOfOTD_FirstSetMsrs_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c index 1821b78f9..d93a8834e 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.c @@ -6,29 +6,26 @@ #include "SeqOfOTD-MsrElementRest.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_OTD_MSR_ELEMENT_REST_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_OTD_MSR_ELEMENT_REST_CONSTR_1 = + { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 1, 1, 1, 2} /* (SIZE(1..2)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfOTD_MsrElementRest_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_OTD_MsrElementRest, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_OTD_MsrElementRest, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfOTD_MsrElementRest_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_MsrElementRest_specs_1 = { sizeof(struct SeqOfOTD_MsrElementRest), offsetof(struct SeqOfOTD_MsrElementRest, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrElementRest = { "SeqOfOTD-MsrElementRest", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrElementRest = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfOTD_MsrElementRest_tags_1, - sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) - /sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ - asn_DEF_SeqOfOTD_MsrElementRest_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) - /sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) / + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_MsrElementRest_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1) / + sizeof(asn_DEF_SeqOfOTD_MsrElementRest_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_OTD_MSR_ELEMENT_REST_CONSTR_1, asn_MBR_SeqOfOTD_MsrElementRest_1, - 1, /* Single element */ - &asn_SPC_SeqOfOTD_MsrElementRest_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfOTD_MsrElementRest_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h index 050c37936..73dda4159 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrElementRest.h @@ -7,7 +7,6 @@ #ifndef _SeqOfOTD_MsrElementRest_H_ #define _SeqOfOTD_MsrElementRest_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c index d8a1fa518..030e737eb 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.c @@ -6,29 +6,26 @@ #include "SeqOfOTD-MsrsOfOtherSets.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_OTD_MSRS_OF_OTHER_SETS_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 10 } /* (SIZE(1..10)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_OTD_MSRS_OF_OTHER_SETS_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 10} /* (SIZE(1..10)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfOTD_MsrsOfOtherSets_1[] = { - { ATF_POINTER, 0, 0, - -1 /* Ambiguous tag (CHOICE?) */, - 0, - &asn_DEF_OTD_MsrsOfOtherSets, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, -1 /* Ambiguous tag (CHOICE?) */, 0, + &asn_DEF_OTD_MsrsOfOtherSets, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfOTD_MsrsOfOtherSets_specs_1 = { sizeof(struct SeqOfOTD_MsrsOfOtherSets), offsetof(struct SeqOfOTD_MsrsOfOtherSets, _asn_ctx), - 2, /* XER encoding is XMLValueList */ + 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrsOfOtherSets = { "SeqOfOTD-MsrsOfOtherSets", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfOTD_MsrsOfOtherSets = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1, - sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) - /sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ - asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) - /sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) / + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ + asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1) / + sizeof(asn_DEF_SeqOfOTD_MsrsOfOtherSets_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_OTD_MSRS_OF_OTHER_SETS_CONSTR_1, asn_MBR_SeqOfOTD_MsrsOfOtherSets_1, - 1, /* Single element */ - &asn_SPC_SeqOfOTD_MsrsOfOtherSets_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfOTD_MsrsOfOtherSets_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h index ed50d4e61..e0dbc155f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfOTD-MsrsOfOtherSets.h @@ -7,7 +7,6 @@ #ifndef _SeqOfOTD_MsrsOfOtherSets_H_ #define _SeqOfOTD_MsrsOfOtherSets_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c index 67e58745b..e8c91385f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.c @@ -6,29 +6,26 @@ #include "SeqOfReferenceIdentityType.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_REFERENCE_IDENTITY_TYPE_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_REFERENCE_IDENTITY_TYPE_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 2, 2, 1, 3} /* (SIZE(1..3)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfReferenceIdentityType_1[] = { - { ATF_POINTER, 0, 0, - -1 /* Ambiguous tag (CHOICE?) */, - 0, - &asn_DEF_ReferenceIdentityType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, -1 /* Ambiguous tag (CHOICE?) */, 0, + &asn_DEF_ReferenceIdentityType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfReferenceIdentityType_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfReferenceIdentityType_specs_1 = { sizeof(struct SeqOfReferenceIdentityType), offsetof(struct SeqOfReferenceIdentityType, _asn_ctx), - 2, /* XER encoding is XMLValueList */ + 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfReferenceIdentityType = { "SeqOfReferenceIdentityType", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfReferenceIdentityType = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfReferenceIdentityType_tags_1, - sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) - /sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ - asn_DEF_SeqOfReferenceIdentityType_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) - /sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) / + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ + asn_DEF_SeqOfReferenceIdentityType_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1) / + sizeof(asn_DEF_SeqOfReferenceIdentityType_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_REFERENCE_IDENTITY_TYPE_CONSTR_1, asn_MBR_SeqOfReferenceIdentityType_1, - 1, /* Single element */ - &asn_SPC_SeqOfReferenceIdentityType_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfReferenceIdentityType_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h index 5d1d5cf31..505629503 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfReferenceIdentityType.h @@ -7,7 +7,6 @@ #ifndef _SeqOfReferenceIdentityType_H_ #define _SeqOfReferenceIdentityType_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c index a6ecafbb3..e824a864d 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.c @@ -7,28 +7,22 @@ #include "SeqOfSatElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_SAT_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 16 } /* (SIZE(1..16)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 16} /* (SIZE(1..16)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfSatElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_SatElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_SatElement, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfSatElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfSatElement_specs_1 = { - sizeof(struct SeqOfSatElement), - offsetof(struct SeqOfSatElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + sizeof(struct SeqOfSatElement), offsetof(struct SeqOfSatElement, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfSatElement = { "SeqOfSatElement", @@ -42,16 +36,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfSatElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfSatElement_tags_1, - sizeof(asn_DEF_SeqOfSatElement_tags_1) - /sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfSatElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfSatElement_tags_1) - /sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfSatElement_tags_1) / + sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSatElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSatElement_tags_1) / + sizeof(asn_DEF_SeqOfSatElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_SAT_ELEMENT_CONSTR_1, asn_MBR_SeqOfSatElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfSatElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfSatElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h index b7dd640cc..29a2adf63 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfSatElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfSatElement_H_ #define _SeqOfSatElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c index 08f620b87..527dc2487 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.c @@ -7,28 +7,24 @@ #include "SeqOfSgnTypeElement.h" static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_SGN_TYPE_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 2, 2, 1, 3} /* (SIZE(1..3)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfSgnTypeElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_SgnTypeElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_SgnTypeElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfSgnTypeElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfSgnTypeElement_specs_1 = { sizeof(struct SeqOfSgnTypeElement), offsetof(struct SeqOfSgnTypeElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfSgnTypeElement = { "SeqOfSgnTypeElement", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfSgnTypeElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfSgnTypeElement_tags_1, - sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) - /sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfSgnTypeElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) - /sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) / + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1) / + sizeof(asn_DEF_SeqOfSgnTypeElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_SGN_TYPE_ELEMENT_CONSTR_1, asn_MBR_SeqOfSgnTypeElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfSgnTypeElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfSgnTypeElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h index d48083702..23335a112 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfSgnTypeElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfSgnTypeElement_H_ #define _SeqOfSgnTypeElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c index a1df18794..ff3243ed2 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.c @@ -6,29 +6,26 @@ #include "SeqOfStandardClockModelElement.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_STANDARD_CLOCK_MODEL_ELEMENT_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_STANDARD_CLOCK_MODEL_ELEMENT_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 1, 1, 1, 2} /* (SIZE(1..2)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfStandardClockModelElement_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_StandardClockModelElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_StandardClockModelElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfStandardClockModelElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfStandardClockModelElement_specs_1 = { sizeof(struct SeqOfStandardClockModelElement), offsetof(struct SeqOfStandardClockModelElement, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfStandardClockModelElement = { "SeqOfStandardClockModelElement", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfStandardClockModelElement = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfStandardClockModelElement_tags_1, - sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) - /sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ - asn_DEF_SeqOfStandardClockModelElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) - /sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) / + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ + asn_DEF_SeqOfStandardClockModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1) / + sizeof(asn_DEF_SeqOfStandardClockModelElement_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_STANDARD_CLOCK_MODEL_ELEMENT_CONSTR_1, asn_MBR_SeqOfStandardClockModelElement_1, - 1, /* Single element */ - &asn_SPC_SeqOfStandardClockModelElement_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfStandardClockModelElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h index bba8ecd48..a4e97bad3 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfStandardClockModelElement.h @@ -7,7 +7,6 @@ #ifndef _SeqOfStandardClockModelElement_H_ #define _SeqOfStandardClockModelElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c index 97e7b09b9..5138c29b4 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.c @@ -6,29 +6,27 @@ #include "SeqOfSystemInfoAssistBTS-R98-ExpOTD.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 32} /* (SIZE(1..32)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfSystemInfoAssistBTS_R98_ExpOTD_1[] = { - { ATF_POINTER, 0, 0, - -1 /* Ambiguous tag (CHOICE?) */, - 0, - &asn_DEF_SystemInfoAssistBTS_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, -1 /* Ambiguous tag (CHOICE?) */, 0, + &asn_DEF_SystemInfoAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; -static asn_SET_OF_specifics_t asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 = { - sizeof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD), - offsetof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD, _asn_ctx), - 2, /* XER encoding is XMLValueList */ + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_SET_OF_specifics_t + asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 = { + sizeof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD), + offsetof(struct SeqOfSystemInfoAssistBTS_R98_ExpOTD, _asn_ctx), + 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD = { "SeqOfSystemInfoAssistBTS-R98-ExpOTD", @@ -42,16 +40,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1, - sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1, asn_MBR_SeqOfSystemInfoAssistBTS_R98_ExpOTD_1, - 1, /* Single element */ - &asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfSystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h index c11633fd3..2054c071f 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _SeqOfSystemInfoAssistBTS_R98_ExpOTD_H_ #define _SeqOfSystemInfoAssistBTS_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c index 9dce73433..673f95688 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.c @@ -6,29 +6,26 @@ #include "SeqOfSystemInfoAssistBTS.h" -static asn_per_constraints_t ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_CONSTR_1 = { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 32} /* (SIZE(1..32)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SeqOfSystemInfoAssistBTS_1[] = { - { ATF_POINTER, 0, 0, - -1 /* Ambiguous tag (CHOICE?) */, - 0, - &asn_DEF_SystemInfoAssistBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, -1 /* Ambiguous tag (CHOICE?) */, 0, + &asn_DEF_SystemInfoAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SeqOfSystemInfoAssistBTS_specs_1 = { sizeof(struct SeqOfSystemInfoAssistBTS), offsetof(struct SeqOfSystemInfoAssistBTS, _asn_ctx), - 2, /* XER encoding is XMLValueList */ + 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS = { "SeqOfSystemInfoAssistBTS", @@ -42,16 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfSystemInfoAssistBTS = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfSystemInfoAssistBTS_tags_1, - sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) - /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ - asn_DEF_SeqOfSystemInfoAssistBTS_tags_1, /* Same as above */ - sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) - /sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) / + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ + asn_DEF_SeqOfSystemInfoAssistBTS_tags_1, /* Same as above */ + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1) / + sizeof(asn_DEF_SeqOfSystemInfoAssistBTS_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SEQ_OF_SYSTEM_INFO_ASSIST_BTS_CONSTR_1, asn_MBR_SeqOfSystemInfoAssistBTS_1, - 1, /* Single element */ - &asn_SPC_SeqOfSystemInfoAssistBTS_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SeqOfSystemInfoAssistBTS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h index ee6396232..12301f50c 100644 --- a/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h +++ b/src/core/libs/supl/asn-rrlp/SeqOfSystemInfoAssistBTS.h @@ -7,7 +7,6 @@ #ifndef _SeqOfSystemInfoAssistBTS_H_ #define _SeqOfSystemInfoAssistBTS_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SgnTypeElement.c b/src/core/libs/supl/asn-rrlp/SgnTypeElement.c index bf0ab9ebd..716ca2898 100644 --- a/src/core/libs/supl/asn-rrlp/SgnTypeElement.c +++ b/src/core/libs/supl/asn-rrlp/SgnTypeElement.c @@ -6,83 +6,77 @@ #include "SgnTypeElement.h" -static int -memb_ganssStatusHealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ganssStatusHealth_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GANSS_STATUS_HEALTH_CONSTR_3 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SgnTypeElement_1[] = { - { ATF_POINTER, 1, offsetof(struct SgnTypeElement, ganssSignalID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GANSSSignalID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ganssSignalID" - }, - { ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, ganssStatusHealth), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ganssStatusHealth_constraint_1, - &ASN_PER_MEMB_GANSS_STATUS_HEALTH_CONSTR_3, - 0, - "ganssStatusHealth" - }, - { ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, dganssSgnList), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfDGANSSSgnElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "dganssSgnList" - }, + {ATF_POINTER, 1, offsetof(struct SgnTypeElement, ganssSignalID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GANSSSignalID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ganssSignalID"}, + {ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, ganssStatusHealth), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ganssStatusHealth_constraint_1, + &ASN_PER_MEMB_GANSS_STATUS_HEALTH_CONSTR_3, 0, "ganssStatusHealth"}, + {ATF_NOFLAGS, 0, offsetof(struct SgnTypeElement, dganssSgnList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfDGANSSSgnElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "dganssSgnList"}, }; -static int asn_MAP_SgnTypeElement_oms_1[] = { 0 }; +static int asn_MAP_SgnTypeElement_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_SgnTypeElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SgnTypeElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ganssSignalID at 1196 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ganssStatusHealth at 1197 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* dganssSgnList at 1200 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ganssSignalID at 1196 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* ganssStatusHealth at 1197 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* dganssSgnList at 1200 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SgnTypeElement_specs_1 = { sizeof(struct SgnTypeElement), offsetof(struct SgnTypeElement, _asn_ctx), asn_MAP_SgnTypeElement_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_SgnTypeElement_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_SgnTypeElement_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SgnTypeElement = { "SgnTypeElement", @@ -96,16 +90,15 @@ asn_TYPE_descriptor_t asn_DEF_SgnTypeElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SgnTypeElement_tags_1, - sizeof(asn_DEF_SgnTypeElement_tags_1) - /sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ - asn_DEF_SgnTypeElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SgnTypeElement_tags_1) - /sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SgnTypeElement_tags_1) / + sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ + asn_DEF_SgnTypeElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SgnTypeElement_tags_1) / + sizeof(asn_DEF_SgnTypeElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SgnTypeElement_1, - 3, /* Elements count */ - &asn_SPC_SgnTypeElement_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_SgnTypeElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SgnTypeElement.h b/src/core/libs/supl/asn-rrlp/SgnTypeElement.h index 3f6e260ff..6e4bd8a15 100644 --- a/src/core/libs/supl/asn-rrlp/SgnTypeElement.h +++ b/src/core/libs/supl/asn-rrlp/SgnTypeElement.h @@ -7,7 +7,6 @@ #ifndef _SgnTypeElement_H_ #define _SgnTypeElement_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c index 7ad01a686..82c5110bc 100644 --- a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c +++ b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.c @@ -6,263 +6,264 @@ #include "StandardClockModelElement.h" -static int -memb_stanClockTocLSB_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanClockTocLSB_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stanClockAF2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanClockAF2_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2048 && value <= 2047)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2048 && value <= 2047)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stanClockAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanClockAF1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -131072 && value <= 131071)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -131072 && value <= 131071)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stanClockAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanClockAF0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -134217728 && value <= 134217727)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -134217728 && value <= 134217727)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stanClockTgd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanClockTgd_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -512 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -512 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_stanModelID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_stanModelID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_STAN_CLOCK_TOC_LSB_CONSTR_2 = { - { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 9, 9, 0, 511} /* (0..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STAN_CLOCK_A_F2_CONSTR_3 = { - { APC_CONSTRAINED, 12, 12, -2048, 2047 } /* (-2048..2047) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 12, 12, -2048, 2047} /* (-2048..2047) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STAN_CLOCK_A_F1_CONSTR_4 = { - { APC_CONSTRAINED, 18, -1, -131072, 131071 } /* (-131072..131071) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 18, -1, -131072, 131071} /* (-131072..131071) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STAN_CLOCK_A_F0_CONSTR_5 = { - { APC_CONSTRAINED, 28, -1, -134217728, 134217727 } /* (-134217728..134217727) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 28, -1, -134217728, + 134217727} /* (-134217728..134217727) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STAN_CLOCK_TGD_CONSTR_6 = { - { APC_CONSTRAINED, 10, 10, -512, 511 } /* (-512..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, -512, 511} /* (-512..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_STAN_MODEL_ID_CONSTR_7 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_StandardClockModelElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockTocLSB), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanClockTocLSB_constraint_1, - &ASN_PER_MEMB_STAN_CLOCK_TOC_LSB_CONSTR_2, - 0, - "stanClockTocLSB" - }, - { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF2), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanClockAF2_constraint_1, - &ASN_PER_MEMB_STAN_CLOCK_A_F2_CONSTR_3, - 0, - "stanClockAF2" - }, - { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF1), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanClockAF1_constraint_1, - &ASN_PER_MEMB_STAN_CLOCK_A_F1_CONSTR_4, - 0, - "stanClockAF1" - }, - { ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF0), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanClockAF0_constraint_1, - &ASN_PER_MEMB_STAN_CLOCK_A_F0_CONSTR_5, - 0, - "stanClockAF0" - }, - { ATF_POINTER, 2, offsetof(struct StandardClockModelElement, stanClockTgd), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanClockTgd_constraint_1, - &ASN_PER_MEMB_STAN_CLOCK_TGD_CONSTR_6, - 0, - "stanClockTgd" - }, - { ATF_POINTER, 1, offsetof(struct StandardClockModelElement, stanModelID), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_stanModelID_constraint_1, - &ASN_PER_MEMB_STAN_MODEL_ID_CONSTR_7, - 0, - "stanModelID" - }, + {ATF_NOFLAGS, 0, + offsetof(struct StandardClockModelElement, stanClockTocLSB), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanClockTocLSB_constraint_1, + &ASN_PER_MEMB_STAN_CLOCK_TOC_LSB_CONSTR_2, 0, "stanClockTocLSB"}, + {ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF2), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanClockAF2_constraint_1, + &ASN_PER_MEMB_STAN_CLOCK_A_F2_CONSTR_3, 0, "stanClockAF2"}, + {ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF1), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanClockAF1_constraint_1, + &ASN_PER_MEMB_STAN_CLOCK_A_F1_CONSTR_4, 0, "stanClockAF1"}, + {ATF_NOFLAGS, 0, offsetof(struct StandardClockModelElement, stanClockAF0), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanClockAF0_constraint_1, + &ASN_PER_MEMB_STAN_CLOCK_A_F0_CONSTR_5, 0, "stanClockAF0"}, + {ATF_POINTER, 2, offsetof(struct StandardClockModelElement, stanClockTgd), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanClockTgd_constraint_1, + &ASN_PER_MEMB_STAN_CLOCK_TGD_CONSTR_6, 0, "stanClockTgd"}, + {ATF_POINTER, 1, offsetof(struct StandardClockModelElement, stanModelID), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_stanModelID_constraint_1, + &ASN_PER_MEMB_STAN_MODEL_ID_CONSTR_7, 0, "stanModelID"}, }; -static int asn_MAP_StandardClockModelElement_oms_1[] = { 4, 5 }; +static int asn_MAP_StandardClockModelElement_oms_1[] = {4, 5}; static ber_tlv_tag_t asn_DEF_StandardClockModelElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_StandardClockModelElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* stanClockTocLSB at 1281 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* stanClockAF2 at 1282 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* stanClockAF1 at 1283 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* stanClockAF0 at 1284 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* stanClockTgd at 1285 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* stanModelID at 1286 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* stanClockTocLSB at 1281 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* stanClockAF2 at 1282 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* stanClockAF1 at 1283 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* stanClockAF0 at 1284 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* stanClockTgd at 1285 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* stanModelID at 1286 */ }; static asn_SEQUENCE_specifics_t asn_SPC_StandardClockModelElement_specs_1 = { sizeof(struct StandardClockModelElement), offsetof(struct StandardClockModelElement, _asn_ctx), asn_MAP_StandardClockModelElement_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_StandardClockModelElement_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_StandardClockModelElement_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_StandardClockModelElement = { "StandardClockModelElement", @@ -276,16 +277,15 @@ asn_TYPE_descriptor_t asn_DEF_StandardClockModelElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_StandardClockModelElement_tags_1, - sizeof(asn_DEF_StandardClockModelElement_tags_1) - /sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ - asn_DEF_StandardClockModelElement_tags_1, /* Same as above */ - sizeof(asn_DEF_StandardClockModelElement_tags_1) - /sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_StandardClockModelElement_tags_1) / + sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ + asn_DEF_StandardClockModelElement_tags_1, /* Same as above */ + sizeof(asn_DEF_StandardClockModelElement_tags_1) / + sizeof(asn_DEF_StandardClockModelElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_StandardClockModelElement_1, - 6, /* Elements count */ - &asn_SPC_StandardClockModelElement_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_StandardClockModelElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h index 1a3462de1..76ef24a89 100644 --- a/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h +++ b/src/core/libs/supl/asn-rrlp/StandardClockModelElement.h @@ -7,7 +7,6 @@ #ifndef _StandardClockModelElement_H_ #define _StandardClockModelElement_H_ - #include /* Including external dependencies */ @@ -29,9 +28,9 @@ extern "C" long *stanClockTgd /* OPTIONAL */; long *stanModelID /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-rrlp/StdResolution.c b/src/core/libs/supl/asn-rrlp/StdResolution.c index 69fc558f0..739679862 100644 --- a/src/core/libs/supl/asn-rrlp/StdResolution.c +++ b/src/core/libs/supl/asn-rrlp/StdResolution.c @@ -6,119 +6,137 @@ #include "StdResolution.h" -int -StdResolution_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int StdResolution_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -StdResolution_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void StdResolution_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -StdResolution_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void StdResolution_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ StdResolution_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -StdResolution_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int StdResolution_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ StdResolution_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -StdResolution_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t StdResolution_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ StdResolution_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -StdResolution_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t StdResolution_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ StdResolution_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -StdResolution_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t StdResolution_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ StdResolution_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -StdResolution_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t StdResolution_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ StdResolution_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -StdResolution_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t StdResolution_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ StdResolution_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -StdResolution_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t StdResolution_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ StdResolution_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_STD_RESOLUTION_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_StdResolution_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_StdResolution = { "StdResolution", "StdResolution", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_StdResolution = { StdResolution_encode_xer, StdResolution_decode_uper, StdResolution_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_StdResolution_tags_1, - sizeof(asn_DEF_StdResolution_tags_1) - /sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ - asn_DEF_StdResolution_tags_1, /* Same as above */ - sizeof(asn_DEF_StdResolution_tags_1) - /sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ + sizeof(asn_DEF_StdResolution_tags_1) / + sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ + asn_DEF_StdResolution_tags_1, /* Same as above */ + sizeof(asn_DEF_StdResolution_tags_1) / + sizeof(asn_DEF_StdResolution_tags_1[0]), /* 1 */ &ASN_PER_TYPE_STD_RESOLUTION_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/StdResolution.h b/src/core/libs/supl/asn-rrlp/StdResolution.h index 4ad156eaf..ae93dfd13 100644 --- a/src/core/libs/supl/asn-rrlp/StdResolution.h +++ b/src/core/libs/supl/asn-rrlp/StdResolution.h @@ -7,7 +7,6 @@ #ifndef _StdResolution_H_ #define _StdResolution_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c index 8487211a8..ca495403a 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.c @@ -6,34 +6,32 @@ #include "SystemInfoAssistBTS-R98-ExpOTD.h" -static asn_per_constraints_t ASN_PER_TYPE_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ +static asn_per_constraints_t + ASN_PER_TYPE_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1 = { + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SystemInfoAssistBTS_R98_ExpOTD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.notPresent), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "notPresent" - }, - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.present), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AssistBTSData_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "present" - }, + {ATF_NOFLAGS, 0, + offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.notPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "notPresent"}, + {ATF_NOFLAGS, 0, + offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, choice.present), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistBTSData_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "present"}, }; -static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistBTS_R98_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notPresent at 927 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* present at 929 */ +static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistBTS_R98_ExpOTD_tag2el_1[] = + { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* notPresent at 927 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* present at 929 */ }; static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 = { sizeof(struct SystemInfoAssistBTS_R98_ExpOTD), @@ -41,9 +39,9 @@ static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 = { offsetof(struct SystemInfoAssistBTS_R98_ExpOTD, present), sizeof(((struct SystemInfoAssistBTS_R98_ExpOTD *)0)->present), asn_MAP_SystemInfoAssistBTS_R98_ExpOTD_tag2el_1, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS_R98_ExpOTD = { "SystemInfoAssistBTS-R98-ExpOTD", @@ -58,13 +56,12 @@ asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS_R98_ExpOTD = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_SYSTEM_INFO_ASSIST_BTS_R98_EXP_OTD_CONSTR_1, asn_MBR_SystemInfoAssistBTS_R98_ExpOTD_1, - 2, /* Elements count */ - &asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SystemInfoAssistBTS_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h index c4719af8e..fd389ee03 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _SystemInfoAssistBTS_R98_ExpOTD_H_ #define _SystemInfoAssistBTS_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c index 55f41722c..a0875af9e 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.c @@ -7,33 +7,27 @@ #include "SystemInfoAssistBTS.h" static asn_per_constraints_t ASN_PER_TYPE_SYSTEM_INFO_ASSIST_BTS_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SystemInfoAssistBTS_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.notPresent), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NULL, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "notPresent" - }, - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.present), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AssistBTSData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "present" - }, + {ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.notPresent), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NULL, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "notPresent"}, + {ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistBTS, choice.present), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AssistBTSData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "present"}, }; static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistBTS_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notPresent at 223 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* present at 225 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* notPresent at 223 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* present at 225 */ }; static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_specs_1 = { sizeof(struct SystemInfoAssistBTS), @@ -41,9 +35,9 @@ static asn_CHOICE_specifics_t asn_SPC_SystemInfoAssistBTS_specs_1 = { offsetof(struct SystemInfoAssistBTS, present), sizeof(((struct SystemInfoAssistBTS *)0)->present), asn_MAP_SystemInfoAssistBTS_tag2el_1, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS = { "SystemInfoAssistBTS", @@ -58,13 +52,12 @@ asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistBTS = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_SYSTEM_INFO_ASSIST_BTS_CONSTR_1, asn_MBR_SystemInfoAssistBTS_1, - 2, /* Elements count */ - &asn_SPC_SystemInfoAssistBTS_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SystemInfoAssistBTS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h index ef532a9d7..5eecf4a9d 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistBTS.h @@ -7,7 +7,6 @@ #ifndef _SystemInfoAssistBTS_H_ #define _SystemInfoAssistBTS_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c index 1a9631237..12690aba2 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.c @@ -7,30 +7,33 @@ #include "SystemInfoAssistData-R98-ExpOTD.h" static asn_TYPE_member_t asn_MBR_SystemInfoAssistData_R98_ExpOTD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistData_R98_ExpOTD, systemInfoAssistListR98_ExpOTD), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoAssistListR98-ExpOTD" - }, + {ATF_NOFLAGS, 0, + offsetof(struct SystemInfoAssistData_R98_ExpOTD, + systemInfoAssistListR98_ExpOTD), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSystemInfoAssistBTS_R98_ExpOTD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoAssistListR98-ExpOTD"}, }; static ber_tlv_tag_t asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; +static asn_TYPE_tag2member_t + asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1[] = { + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* systemInfoAssistListR98-ExpOTD at 917 */ }; -static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* systemInfoAssistListR98-ExpOTD at 917 */ -}; -static asn_SEQUENCE_specifics_t asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 = { - sizeof(struct SystemInfoAssistData_R98_ExpOTD), - offsetof(struct SystemInfoAssistData_R98_ExpOTD, _asn_ctx), - asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ +static asn_SEQUENCE_specifics_t + asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 = { + sizeof(struct SystemInfoAssistData_R98_ExpOTD), + offsetof(struct SystemInfoAssistData_R98_ExpOTD, _asn_ctx), + asn_MAP_SystemInfoAssistData_R98_ExpOTD_tag2el_1, + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData_R98_ExpOTD = { "SystemInfoAssistData-R98-ExpOTD", @@ -44,16 +47,15 @@ asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData_R98_ExpOTD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1, - sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ - asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1, /* Same as above */ - sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) - /sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1) / + sizeof(asn_DEF_SystemInfoAssistData_R98_ExpOTD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SystemInfoAssistData_R98_ExpOTD_1, - 1, /* Elements count */ - &asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_SystemInfoAssistData_R98_ExpOTD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h index e65457314..7b171b457 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData-R98-ExpOTD.h @@ -7,7 +7,6 @@ #ifndef _SystemInfoAssistData_R98_ExpOTD_H_ #define _SystemInfoAssistData_R98_ExpOTD_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c index 11b436135..1a1bd263b 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.c @@ -7,30 +7,30 @@ #include "SystemInfoAssistData.h" static asn_TYPE_member_t asn_MBR_SystemInfoAssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SystemInfoAssistData, systemInfoAssistList), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SeqOfSystemInfoAssistBTS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "systemInfoAssistList" - }, + {ATF_NOFLAGS, 0, + offsetof(struct SystemInfoAssistData, systemInfoAssistList), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SeqOfSystemInfoAssistBTS, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "systemInfoAssistList"}, }; static ber_tlv_tag_t asn_DEF_SystemInfoAssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SystemInfoAssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* systemInfoAssistList at 218 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* systemInfoAssistList at 218 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SystemInfoAssistData_specs_1 = { sizeof(struct SystemInfoAssistData), offsetof(struct SystemInfoAssistData, _asn_ctx), asn_MAP_SystemInfoAssistData_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData = { "SystemInfoAssistData", @@ -44,16 +44,15 @@ asn_TYPE_descriptor_t asn_DEF_SystemInfoAssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SystemInfoAssistData_tags_1, - sizeof(asn_DEF_SystemInfoAssistData_tags_1) - /sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ - asn_DEF_SystemInfoAssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_SystemInfoAssistData_tags_1) - /sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SystemInfoAssistData_tags_1) / + sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoAssistData_tags_1) / + sizeof(asn_DEF_SystemInfoAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SystemInfoAssistData_1, - 1, /* Elements count */ - &asn_SPC_SystemInfoAssistData_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_SystemInfoAssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h index e1d241f3e..ab50e499f 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h +++ b/src/core/libs/supl/asn-rrlp/SystemInfoAssistData.h @@ -7,7 +7,6 @@ #ifndef _SystemInfoAssistData_H_ #define _SystemInfoAssistData_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c index 5802bc9d5..3118488ff 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c +++ b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.c @@ -6,119 +6,139 @@ #include "SystemInfoIndex.h" -int -SystemInfoIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SystemInfoIndex_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 1 && value <= 32)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 1 && value <= 32)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -SystemInfoIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void SystemInfoIndex_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -SystemInfoIndex_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void SystemInfoIndex_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -SystemInfoIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int SystemInfoIndex_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -SystemInfoIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t SystemInfoIndex_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -SystemInfoIndex_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SystemInfoIndex_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -SystemInfoIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t SystemInfoIndex_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -SystemInfoIndex_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SystemInfoIndex_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -SystemInfoIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t SystemInfoIndex_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -SystemInfoIndex_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t SystemInfoIndex_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ SystemInfoIndex_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_SYSTEM_INFO_INDEX_CONSTR_1 = { - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (1..32) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 1, 32} /* (1..32) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_SystemInfoIndex_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_SystemInfoIndex = { "SystemInfoIndex", "SystemInfoIndex", @@ -131,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_SystemInfoIndex = { SystemInfoIndex_encode_xer, SystemInfoIndex_decode_uper, SystemInfoIndex_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SystemInfoIndex_tags_1, - sizeof(asn_DEF_SystemInfoIndex_tags_1) - /sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ - asn_DEF_SystemInfoIndex_tags_1, /* Same as above */ - sizeof(asn_DEF_SystemInfoIndex_tags_1) - /sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SystemInfoIndex_tags_1) / + sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ + asn_DEF_SystemInfoIndex_tags_1, /* Same as above */ + sizeof(asn_DEF_SystemInfoIndex_tags_1) / + sizeof(asn_DEF_SystemInfoIndex_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SYSTEM_INFO_INDEX_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h index 9a1b0b4c9..562cfa66c 100644 --- a/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h +++ b/src/core/libs/supl/asn-rrlp/SystemInfoIndex.h @@ -7,7 +7,6 @@ #ifndef _SystemInfoIndex_H_ #define _SystemInfoIndex_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TA0.c b/src/core/libs/supl/asn-rrlp/TA0.c index e1d9be50b..d737478a5 100644 --- a/src/core/libs/supl/asn-rrlp/TA0.c +++ b/src/core/libs/supl/asn-rrlp/TA0.c @@ -6,119 +6,129 @@ #include "TA0.h" -int -TA0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TA0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TA0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TA0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TA0_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TA0_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ TA0_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TA0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TA0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA0_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TA0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TA0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ TA0_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TA0_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA0_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA0_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TA0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TA0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TA0_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TA0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA0_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TA0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TA0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TA0_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TA0_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TA0_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TA0_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_T_A0_CONSTR_1 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TA0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TA0 = { "TA0", "TA0", @@ -131,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_TA0 = { TA0_encode_xer, TA0_decode_uper, TA0_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TA0_tags_1, - sizeof(asn_DEF_TA0_tags_1) - /sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ - asn_DEF_TA0_tags_1, /* Same as above */ - sizeof(asn_DEF_TA0_tags_1) - /sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TA0_tags_1) / sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ + asn_DEF_TA0_tags_1, /* Same as above */ + sizeof(asn_DEF_TA0_tags_1) / sizeof(asn_DEF_TA0_tags_1[0]), /* 1 */ &ASN_PER_TYPE_T_A0_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TA0.h b/src/core/libs/supl/asn-rrlp/TA0.h index ef95b3645..e71928d20 100644 --- a/src/core/libs/supl/asn-rrlp/TA0.h +++ b/src/core/libs/supl/asn-rrlp/TA0.h @@ -7,7 +7,6 @@ #ifndef _TA0_H_ #define _TA0_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TA1.c b/src/core/libs/supl/asn-rrlp/TA1.c index adf48ae9c..5ee4dda82 100644 --- a/src/core/libs/supl/asn-rrlp/TA1.c +++ b/src/core/libs/supl/asn-rrlp/TA1.c @@ -6,119 +6,128 @@ #include "TA1.h" -int -TA1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TA1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TA1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TA1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TA1_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TA1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ TA1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TA1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TA1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TA1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TA1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ TA1_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TA1_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA1_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TA1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TA1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TA1_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TA1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TA1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TA1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TA1_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TA1_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TA1_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TA1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_T_A1_CONSTR_1 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TA1_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TA1 = { "TA1", "TA1", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_TA1 = { TA1_encode_xer, TA1_decode_uper, TA1_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TA1_tags_1, - sizeof(asn_DEF_TA1_tags_1) - /sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ - asn_DEF_TA1_tags_1, /* Same as above */ - sizeof(asn_DEF_TA1_tags_1) - /sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TA1_tags_1) / sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ + asn_DEF_TA1_tags_1, /* Same as above */ + sizeof(asn_DEF_TA1_tags_1) / sizeof(asn_DEF_TA1_tags_1[0]), /* 1 */ &ASN_PER_TYPE_T_A1_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TA1.h b/src/core/libs/supl/asn-rrlp/TA1.h index c0cd4ea97..9421afef7 100644 --- a/src/core/libs/supl/asn-rrlp/TA1.h +++ b/src/core/libs/supl/asn-rrlp/TA1.h @@ -7,7 +7,6 @@ #ifndef _TA1_H_ #define _TA1_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TA2.c b/src/core/libs/supl/asn-rrlp/TA2.c index 2a3b46893..7ef77bfb0 100644 --- a/src/core/libs/supl/asn-rrlp/TA2.c +++ b/src/core/libs/supl/asn-rrlp/TA2.c @@ -6,119 +6,128 @@ #include "TA2.h" -int -TA2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TA2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -64 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -64 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TA2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TA2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TA2_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TA2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ TA2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TA2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TA2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TA2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TA2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ TA2_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TA2_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA2_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TA2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TA2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TA2_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TA2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TA2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TA2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TA2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TA2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TA2_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TA2_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TA2_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TA2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_T_A2_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, -64, 63 } /* (-64..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, -64, 63} /* (-64..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TA2_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TA2 = { "TA2", "TA2", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_TA2 = { TA2_encode_xer, TA2_decode_uper, TA2_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TA2_tags_1, - sizeof(asn_DEF_TA2_tags_1) - /sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ - asn_DEF_TA2_tags_1, /* Same as above */ - sizeof(asn_DEF_TA2_tags_1) - /sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TA2_tags_1) / sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ + asn_DEF_TA2_tags_1, /* Same as above */ + sizeof(asn_DEF_TA2_tags_1) / sizeof(asn_DEF_TA2_tags_1[0]), /* 1 */ &ASN_PER_TYPE_T_A2_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TA2.h b/src/core/libs/supl/asn-rrlp/TA2.h index f3aa1708d..001b1995e 100644 --- a/src/core/libs/supl/asn-rrlp/TA2.h +++ b/src/core/libs/supl/asn-rrlp/TA2.h @@ -7,7 +7,6 @@ #ifndef _TA2_H_ #define _TA2_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TLMReservedBits.c b/src/core/libs/supl/asn-rrlp/TLMReservedBits.c index 40e7f08f9..c435355ab 100644 --- a/src/core/libs/supl/asn-rrlp/TLMReservedBits.c +++ b/src/core/libs/supl/asn-rrlp/TLMReservedBits.c @@ -6,119 +6,139 @@ #include "TLMReservedBits.h" -int -TLMReservedBits_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TLMReservedBits_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TLMReservedBits_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TLMReservedBits_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TLMReservedBits_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TLMReservedBits_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TLMReservedBits_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TLMReservedBits_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TLMReservedBits_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TLMReservedBits_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TLMReservedBits_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TLMReservedBits_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TLMReservedBits_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TLMReservedBits_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TLMReservedBits_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TLMReservedBits_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TLMReservedBits_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TLMReservedBits_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TLMReservedBits_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TLMReservedBits_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ TLMReservedBits_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TLM_RESERVED_BITS_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TLMReservedBits_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TLMReservedBits = { "TLMReservedBits", "TLMReservedBits", @@ -131,15 +151,15 @@ asn_TYPE_descriptor_t asn_DEF_TLMReservedBits = { TLMReservedBits_encode_xer, TLMReservedBits_decode_uper, TLMReservedBits_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TLMReservedBits_tags_1, - sizeof(asn_DEF_TLMReservedBits_tags_1) - /sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ - asn_DEF_TLMReservedBits_tags_1, /* Same as above */ - sizeof(asn_DEF_TLMReservedBits_tags_1) - /sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TLMReservedBits_tags_1) / + sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ + asn_DEF_TLMReservedBits_tags_1, /* Same as above */ + sizeof(asn_DEF_TLMReservedBits_tags_1) / + sizeof(asn_DEF_TLMReservedBits_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TLM_RESERVED_BITS_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TLMReservedBits.h b/src/core/libs/supl/asn-rrlp/TLMReservedBits.h index f52536c2c..cb947af1e 100644 --- a/src/core/libs/supl/asn-rrlp/TLMReservedBits.h +++ b/src/core/libs/supl/asn-rrlp/TLMReservedBits.h @@ -7,7 +7,6 @@ #ifndef _TLMReservedBits_H_ #define _TLMReservedBits_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TLMWord.c b/src/core/libs/supl/asn-rrlp/TLMWord.c index 83f3ce930..b8e5b6d4f 100644 --- a/src/core/libs/supl/asn-rrlp/TLMWord.c +++ b/src/core/libs/supl/asn-rrlp/TLMWord.c @@ -6,119 +6,129 @@ #include "TLMWord.h" -int -TLMWord_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TLMWord_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16383)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16383)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TLMWord_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TLMWord_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TLMWord_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TLMWord_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ TLMWord_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TLMWord_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TLMWord_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ TLMWord_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TLMWord_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TLMWord_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ TLMWord_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TLMWord_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TLMWord_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TLMWord_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TLMWord_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TLMWord_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TLMWord_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TLMWord_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TLMWord_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TLMWord_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TLMWord_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TLMWord_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TLMWord_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TLMWord_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TLMWord_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TLMWord_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TLM_WORD_CONSTR_1 = { - { APC_CONSTRAINED, 14, 14, 0, 16383 } /* (0..16383) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, 0, 16383} /* (0..16383) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TLMWord_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TLMWord = { "TLMWord", "TLMWord", @@ -131,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_TLMWord = { TLMWord_encode_xer, TLMWord_decode_uper, TLMWord_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TLMWord_tags_1, - sizeof(asn_DEF_TLMWord_tags_1) - /sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ - asn_DEF_TLMWord_tags_1, /* Same as above */ - sizeof(asn_DEF_TLMWord_tags_1) - /sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TLMWord_tags_1) / sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ + asn_DEF_TLMWord_tags_1, /* Same as above */ + sizeof(asn_DEF_TLMWord_tags_1) / sizeof(asn_DEF_TLMWord_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TLM_WORD_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TLMWord.h b/src/core/libs/supl/asn-rrlp/TLMWord.h index 89898f318..05f12ef9e 100644 --- a/src/core/libs/supl/asn-rrlp/TLMWord.h +++ b/src/core/libs/supl/asn-rrlp/TLMWord.h @@ -7,7 +7,6 @@ #ifndef _TLMWord_H_ #define _TLMWord_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c index 894be910c..bc7c61c61 100644 --- a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c +++ b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.c @@ -7,40 +7,34 @@ #include "TOA-MeasurementsOfRef.h" static asn_TYPE_member_t asn_MBR_TOA_MeasurementsOfRef_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, refQuality), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RefQuality, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "refQuality" - }, - { ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, numOfMeasurements), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NumOfMeasurements, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "numOfMeasurements" - }, + {ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, refQuality), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RefQuality, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "refQuality"}, + {ATF_NOFLAGS, 0, offsetof(struct TOA_MeasurementsOfRef, numOfMeasurements), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NumOfMeasurements, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "numOfMeasurements"}, }; static ber_tlv_tag_t asn_DEF_TOA_MeasurementsOfRef_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_TOA_MeasurementsOfRef_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refQuality at 360 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* numOfMeasurements at 362 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refQuality at 360 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* numOfMeasurements at 362 */ }; static asn_SEQUENCE_specifics_t asn_SPC_TOA_MeasurementsOfRef_specs_1 = { sizeof(struct TOA_MeasurementsOfRef), offsetof(struct TOA_MeasurementsOfRef, _asn_ctx), asn_MAP_TOA_MeasurementsOfRef_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_TOA_MeasurementsOfRef = { "TOA-MeasurementsOfRef", @@ -54,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_TOA_MeasurementsOfRef = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TOA_MeasurementsOfRef_tags_1, - sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) - /sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ - asn_DEF_TOA_MeasurementsOfRef_tags_1, /* Same as above */ - sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) - /sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) / + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ + asn_DEF_TOA_MeasurementsOfRef_tags_1, /* Same as above */ + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1) / + sizeof(asn_DEF_TOA_MeasurementsOfRef_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_TOA_MeasurementsOfRef_1, - 2, /* Elements count */ - &asn_SPC_TOA_MeasurementsOfRef_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_TOA_MeasurementsOfRef_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h index 901b1ace9..3f54b3cdf 100644 --- a/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h +++ b/src/core/libs/supl/asn-rrlp/TOA-MeasurementsOfRef.h @@ -7,7 +7,6 @@ #ifndef _TOA_MeasurementsOfRef_H_ #define _TOA_MeasurementsOfRef_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TimeRelation.c b/src/core/libs/supl/asn-rrlp/TimeRelation.c index 2f67656c4..a5e751cd8 100644 --- a/src/core/libs/supl/asn-rrlp/TimeRelation.c +++ b/src/core/libs/supl/asn-rrlp/TimeRelation.c @@ -7,42 +7,34 @@ #include "TimeRelation.h" static asn_TYPE_member_t asn_MBR_TimeRelation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct TimeRelation, gpsTOW), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GPSTOW23b, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gpsTOW" - }, - { ATF_POINTER, 1, offsetof(struct TimeRelation, gsmTime), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GSMTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gsmTime" - }, + {ATF_NOFLAGS, 0, offsetof(struct TimeRelation, gpsTOW), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GPSTOW23b, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gpsTOW"}, + {ATF_POINTER, 1, offsetof(struct TimeRelation, gsmTime), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GSMTime, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gsmTime"}, }; -static int asn_MAP_TimeRelation_oms_1[] = { 1 }; +static int asn_MAP_TimeRelation_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_TimeRelation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_TimeRelation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsTOW at 828 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gsmTime at 829 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gpsTOW at 828 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* gsmTime at 829 */ }; static asn_SEQUENCE_specifics_t asn_SPC_TimeRelation_specs_1 = { sizeof(struct TimeRelation), offsetof(struct TimeRelation, _asn_ctx), asn_MAP_TimeRelation_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_TimeRelation_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_TimeRelation_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_TimeRelation = { "TimeRelation", @@ -56,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_TimeRelation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TimeRelation_tags_1, - sizeof(asn_DEF_TimeRelation_tags_1) - /sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ - asn_DEF_TimeRelation_tags_1, /* Same as above */ - sizeof(asn_DEF_TimeRelation_tags_1) - /sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_TimeRelation_tags_1) / + sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ + asn_DEF_TimeRelation_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeRelation_tags_1) / + sizeof(asn_DEF_TimeRelation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_TimeRelation_1, - 2, /* Elements count */ - &asn_SPC_TimeRelation_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_TimeRelation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TimeRelation.h b/src/core/libs/supl/asn-rrlp/TimeRelation.h index cc6138111..cfcce0ca9 100644 --- a/src/core/libs/supl/asn-rrlp/TimeRelation.h +++ b/src/core/libs/supl/asn-rrlp/TimeRelation.h @@ -7,7 +7,6 @@ #ifndef _TimeRelation_H_ #define _TimeRelation_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TimeSlot.c b/src/core/libs/supl/asn-rrlp/TimeSlot.c index 5cc77a7a9..b155af70f 100644 --- a/src/core/libs/supl/asn-rrlp/TimeSlot.c +++ b/src/core/libs/supl/asn-rrlp/TimeSlot.c @@ -6,119 +6,130 @@ #include "TimeSlot.h" -int -TimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TimeSlot_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TimeSlot_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TimeSlot_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TimeSlot_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ TimeSlot_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TimeSlot_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ TimeSlot_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TimeSlot_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ TimeSlot_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TimeSlot_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeSlot_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TimeSlot_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TimeSlot_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TimeSlot_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TimeSlot_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeSlot_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TimeSlot_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TimeSlot_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TimeSlot_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TimeSlot_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TimeSlot_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TimeSlot_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TIME_SLOT_CONSTR_1 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TimeSlot_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TimeSlot = { "TimeSlot", "TimeSlot", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_TimeSlot = { TimeSlot_encode_xer, TimeSlot_decode_uper, TimeSlot_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TimeSlot_tags_1, - sizeof(asn_DEF_TimeSlot_tags_1) - /sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ - asn_DEF_TimeSlot_tags_1, /* Same as above */ - sizeof(asn_DEF_TimeSlot_tags_1) - /sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TimeSlot_tags_1) / + sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ + asn_DEF_TimeSlot_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeSlot_tags_1) / + sizeof(asn_DEF_TimeSlot_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TIME_SLOT_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TimeSlot.h b/src/core/libs/supl/asn-rrlp/TimeSlot.h index d43477f14..41bc35c04 100644 --- a/src/core/libs/supl/asn-rrlp/TimeSlot.h +++ b/src/core/libs/supl/asn-rrlp/TimeSlot.h @@ -7,7 +7,6 @@ #ifndef _TimeSlot_H_ #define _TimeSlot_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c index c3dd9bb2b..0538187ab 100644 --- a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c +++ b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.c @@ -6,9 +6,10 @@ #include "TimeSlotScheme.h" -int -TimeSlotScheme_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TimeSlotScheme_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,107 +19,122 @@ TimeSlotScheme_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -TimeSlotScheme_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void TimeSlotScheme_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -TimeSlotScheme_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TimeSlotScheme_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TimeSlotScheme_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TimeSlotScheme_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TimeSlotScheme_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TimeSlotScheme_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TimeSlotScheme_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeSlotScheme_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TimeSlotScheme_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TimeSlotScheme_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TimeSlotScheme_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeSlotScheme_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TimeSlotScheme_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TimeSlotScheme_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TimeSlotScheme_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TimeSlotScheme_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ TimeSlotScheme_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TIME_SLOT_SCHEME_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_TimeSlotScheme_value2enum_1[] = { - { 0, 11, "equalLength" }, - { 1, 13, "variousLength" } -}; + {0, 11, "equalLength"}, {1, 13, "variousLength"}}; static unsigned int asn_MAP_TimeSlotScheme_enum2value_1[] = { - 0, /* equalLength(0) */ - 1 /* variousLength(1) */ + 0, /* equalLength(0) */ + 1 /* variousLength(1) */ }; static asn_INTEGER_specifics_t asn_SPC_TimeSlotScheme_specs_1 = { - asn_MAP_TimeSlotScheme_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_TimeSlotScheme_enum2value_1, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_TimeSlotScheme_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_TimeSlotScheme_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_TimeSlotScheme_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_TimeSlotScheme = { "TimeSlotScheme", "TimeSlotScheme", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_TimeSlotScheme = { TimeSlotScheme_encode_xer, TimeSlotScheme_decode_uper, TimeSlotScheme_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TimeSlotScheme_tags_1, - sizeof(asn_DEF_TimeSlotScheme_tags_1) - /sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ - asn_DEF_TimeSlotScheme_tags_1, /* Same as above */ - sizeof(asn_DEF_TimeSlotScheme_tags_1) - /sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TimeSlotScheme_tags_1) / + sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ + asn_DEF_TimeSlotScheme_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeSlotScheme_tags_1) / + sizeof(asn_DEF_TimeSlotScheme_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TIME_SLOT_SCHEME_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_TimeSlotScheme_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_TimeSlotScheme_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h index cac3d62f5..4aeb73b59 100644 --- a/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h +++ b/src/core/libs/supl/asn-rrlp/TimeSlotScheme.h @@ -7,7 +7,6 @@ #ifndef _TimeSlotScheme_H_ #define _TimeSlotScheme_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/UTCModel.c b/src/core/libs/supl/asn-rrlp/UTCModel.c index 7a27c1a48..a2bcd79d3 100644 --- a/src/core/libs/supl/asn-rrlp/UTCModel.c +++ b/src/core/libs/supl/asn-rrlp/UTCModel.c @@ -6,341 +6,338 @@ #include "UTCModel.h" -static int -memb_utcA1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcA1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcTot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcTot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcWNt_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcWNt_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcDeltaTls_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcDeltaTls_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcWNlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcWNlsf_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcDN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcDN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_utcDeltaTlsf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_utcDeltaTlsf_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_UTC_A1_CONSTR_2 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_A0_CONSTR_3 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_TOT_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_W_NT_CONSTR_5 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_DELTA_TLS_CONSTR_6 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_W_NLSF_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_DN_CONSTR_8 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UTC_DELTA_TLSF_CONSTR_9 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_UTCModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA1), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcA1_constraint_1, - &ASN_PER_MEMB_UTC_A1_CONSTR_2, - 0, - "utcA1" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcA0_constraint_1, - &ASN_PER_MEMB_UTC_A0_CONSTR_3, - 0, - "utcA0" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcTot), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcTot_constraint_1, - &ASN_PER_MEMB_UTC_TOT_CONSTR_4, - 0, - "utcTot" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNt), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcWNt_constraint_1, - &ASN_PER_MEMB_UTC_W_NT_CONSTR_5, - 0, - "utcWNt" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTls), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcDeltaTls_constraint_1, - &ASN_PER_MEMB_UTC_DELTA_TLS_CONSTR_6, - 0, - "utcDeltaTls" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNlsf), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcWNlsf_constraint_1, - &ASN_PER_MEMB_UTC_W_NLSF_CONSTR_7, - 0, - "utcWNlsf" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDN), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcDN_constraint_1, - &ASN_PER_MEMB_UTC_DN_CONSTR_8, - 0, - "utcDN" - }, - { ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTlsf), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_utcDeltaTlsf_constraint_1, - &ASN_PER_MEMB_UTC_DELTA_TLSF_CONSTR_9, - 0, - "utcDeltaTlsf" - }, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA1), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcA1_constraint_1, + &ASN_PER_MEMB_UTC_A1_CONSTR_2, 0, "utcA1"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcA0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcA0_constraint_1, + &ASN_PER_MEMB_UTC_A0_CONSTR_3, 0, "utcA0"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcTot), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcTot_constraint_1, + &ASN_PER_MEMB_UTC_TOT_CONSTR_4, 0, "utcTot"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNt), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcWNt_constraint_1, + &ASN_PER_MEMB_UTC_W_NT_CONSTR_5, 0, "utcWNt"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTls), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcDeltaTls_constraint_1, + &ASN_PER_MEMB_UTC_DELTA_TLS_CONSTR_6, 0, "utcDeltaTls"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcWNlsf), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcWNlsf_constraint_1, + &ASN_PER_MEMB_UTC_W_NLSF_CONSTR_7, 0, "utcWNlsf"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDN), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcDN_constraint_1, + &ASN_PER_MEMB_UTC_DN_CONSTR_8, 0, "utcDN"}, + {ATF_NOFLAGS, 0, offsetof(struct UTCModel, utcDeltaTlsf), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_utcDeltaTlsf_constraint_1, + &ASN_PER_MEMB_UTC_DELTA_TLSF_CONSTR_9, 0, "utcDeltaTlsf"}, }; static ber_tlv_tag_t asn_DEF_UTCModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_UTCModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* utcA1 at 775 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utcA0 at 776 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* utcTot at 777 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* utcWNt at 778 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* utcDeltaTls at 779 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* utcWNlsf at 780 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* utcDN at 781 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* utcDeltaTlsf at 782 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* utcA1 at 775 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* utcA0 at 776 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* utcTot at 777 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* utcWNt at 778 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* utcDeltaTls at 779 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* utcWNlsf at 780 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* utcDN at 781 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0} /* utcDeltaTlsf at 782 */ }; static asn_SEQUENCE_specifics_t asn_SPC_UTCModel_specs_1 = { sizeof(struct UTCModel), offsetof(struct UTCModel, _asn_ctx), asn_MAP_UTCModel_tag2el_1, - 8, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 8, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_UTCModel = { "UTCModel", @@ -354,16 +351,15 @@ asn_TYPE_descriptor_t asn_DEF_UTCModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UTCModel_tags_1, - sizeof(asn_DEF_UTCModel_tags_1) - /sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ - asn_DEF_UTCModel_tags_1, /* Same as above */ - sizeof(asn_DEF_UTCModel_tags_1) - /sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_UTCModel_tags_1) / + sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ + asn_DEF_UTCModel_tags_1, /* Same as above */ + sizeof(asn_DEF_UTCModel_tags_1) / + sizeof(asn_DEF_UTCModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_UTCModel_1, - 8, /* Elements count */ - &asn_SPC_UTCModel_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_UTCModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/UTCModel.h b/src/core/libs/supl/asn-rrlp/UTCModel.h index 7ef7372cb..de84b4169 100644 --- a/src/core/libs/supl/asn-rrlp/UTCModel.h +++ b/src/core/libs/supl/asn-rrlp/UTCModel.h @@ -7,7 +7,6 @@ #ifndef _UTCModel_H_ #define _UTCModel_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c index ed245fb18..c87a76643 100644 --- a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c +++ b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.c @@ -6,9 +6,10 @@ #include "UlPseudoSegInd.h" -int -UlPseudoSegInd_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int UlPseudoSegInd_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,107 +19,122 @@ UlPseudoSegInd_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -UlPseudoSegInd_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void UlPseudoSegInd_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -UlPseudoSegInd_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void UlPseudoSegInd_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -UlPseudoSegInd_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int UlPseudoSegInd_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -UlPseudoSegInd_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t UlPseudoSegInd_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -UlPseudoSegInd_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UlPseudoSegInd_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -UlPseudoSegInd_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t UlPseudoSegInd_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -UlPseudoSegInd_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UlPseudoSegInd_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -UlPseudoSegInd_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t UlPseudoSegInd_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -UlPseudoSegInd_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t UlPseudoSegInd_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ UlPseudoSegInd_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_UL_PSEUDO_SEG_IND_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_UlPseudoSegInd_value2enum_1[] = { - { 0, 11, "firstOfMany" }, - { 1, 12, "secondOfMany" } -}; + {0, 11, "firstOfMany"}, {1, 12, "secondOfMany"}}; static unsigned int asn_MAP_UlPseudoSegInd_enum2value_1[] = { - 0, /* firstOfMany(0) */ - 1 /* secondOfMany(1) */ + 0, /* firstOfMany(0) */ + 1 /* secondOfMany(1) */ }; static asn_INTEGER_specifics_t asn_SPC_UlPseudoSegInd_specs_1 = { - asn_MAP_UlPseudoSegInd_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_UlPseudoSegInd_enum2value_1, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_UlPseudoSegInd_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_UlPseudoSegInd_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_UlPseudoSegInd_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_UlPseudoSegInd = { "UlPseudoSegInd", "UlPseudoSegInd", @@ -131,15 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_UlPseudoSegInd = { UlPseudoSegInd_encode_xer, UlPseudoSegInd_decode_uper, UlPseudoSegInd_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UlPseudoSegInd_tags_1, - sizeof(asn_DEF_UlPseudoSegInd_tags_1) - /sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ - asn_DEF_UlPseudoSegInd_tags_1, /* Same as above */ - sizeof(asn_DEF_UlPseudoSegInd_tags_1) - /sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ + sizeof(asn_DEF_UlPseudoSegInd_tags_1) / + sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ + asn_DEF_UlPseudoSegInd_tags_1, /* Same as above */ + sizeof(asn_DEF_UlPseudoSegInd_tags_1) / + sizeof(asn_DEF_UlPseudoSegInd_tags_1[0]), /* 1 */ &ASN_PER_TYPE_UL_PSEUDO_SEG_IND_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_UlPseudoSegInd_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_UlPseudoSegInd_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h index bf9491101..5e379b486 100644 --- a/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h +++ b/src/core/libs/supl/asn-rrlp/UlPseudoSegInd.h @@ -7,7 +7,6 @@ #ifndef _UlPseudoSegInd_H_ #define _UlPseudoSegInd_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c index 9ad1c73fe..b9e6f5061 100644 --- a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c +++ b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.c @@ -6,20 +6,21 @@ #include "UncompressedEphemeris.h" -static int -ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ unsigned long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const unsigned long *)sptr; - + /* Constraint check succeeded */ return 0; } @@ -28,96 +29,116 @@ ephemE_17_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -ephemE_17_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void ephemE_17_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined + * explicitly */ } -static void -ephemE_17_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +static void ephemE_17_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ephemE_17_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -static int -ephemE_17_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +static int ephemE_17_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ ephemE_17_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -static asn_dec_rval_t -ephemE_17_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +static asn_dec_rval_t ephemE_17_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ ephemE_17_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -static asn_enc_rval_t -ephemE_17_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t ephemE_17_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ephemE_17_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -static asn_dec_rval_t -ephemE_17_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +static asn_dec_rval_t ephemE_17_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ ephemE_17_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -static asn_enc_rval_t -ephemE_17_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t ephemE_17_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ ephemE_17_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static asn_dec_rval_t -ephemE_17_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +static asn_dec_rval_t ephemE_17_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ ephemE_17_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -static asn_enc_rval_t -ephemE_17_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +static asn_enc_rval_t ephemE_17_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ ephemE_17_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static int -ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ unsigned long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const unsigned long *)sptr; - + /* Constraint check succeeded */ return 0; } @@ -126,1291 +147,1312 @@ ephemAPowerHalf_19_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -ephemAPowerHalf_19_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void ephemAPowerHalf_19_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined + * explicitly */ } -static void -ephemAPowerHalf_19_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +static void ephemAPowerHalf_19_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -static int -ephemAPowerHalf_19_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +static int ephemAPowerHalf_19_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -static asn_dec_rval_t -ephemAPowerHalf_19_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +static asn_dec_rval_t ephemAPowerHalf_19_decode_ber( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -static asn_enc_rval_t -ephemAPowerHalf_19_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t ephemAPowerHalf_19_encode_der( + asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -static asn_dec_rval_t -ephemAPowerHalf_19_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +static asn_dec_rval_t ephemAPowerHalf_19_decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, size_t size) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -static asn_enc_rval_t -ephemAPowerHalf_19_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t ephemAPowerHalf_19_encode_xer( + asn_TYPE_descriptor_t *td, void *structure, int ilevel, + enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static asn_dec_rval_t -ephemAPowerHalf_19_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +static asn_dec_rval_t ephemAPowerHalf_19_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -static asn_enc_rval_t -ephemAPowerHalf_19_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +static asn_enc_rval_t ephemAPowerHalf_19_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ ephemAPowerHalf_19_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static int -memb_ephemCodeOnL2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCodeOnL2_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 3)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 3)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemURA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemURA_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 15)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 15)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemSVhealth_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemSVhealth_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemIODC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemIODC_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemL2Pflag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemL2Pflag_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemTgd_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemTgd_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemToc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemToc_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 37799)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 37799)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemAF2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemAF2_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -128 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -128 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemAF1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemAF1_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemAF0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemAF0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -2097152 && value <= 2097151)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -2097152 && value <= 2097151)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemCrs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCrs_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemDeltaN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemDeltaN_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemM0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemM0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemCuc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCuc_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ unsigned long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const unsigned long *)sptr; - + /* Constraint check succeeded */ return 0; } -static int -memb_ephemCus_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCus_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemAPowerHalf_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemAPowerHalf_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ unsigned long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const unsigned long *)sptr; - + /* Constraint check succeeded */ return 0; } -static int -memb_ephemToe_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemToe_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 37799)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 37799)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemFitFlag_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemFitFlag_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemAODA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemAODA_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemCic_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCic_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemOmegaA0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemOmegaA0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemCis_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCis_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemI0_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemI0_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemCrc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemCrc_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -32768 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -32768 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemW_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= (-2147483647L - 1) && value <= 2147483647)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= (-2147483647L - 1) && value <= 2147483647)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemOmegaADot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemOmegaADot_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_ephemIDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_ephemIDot_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8192 && value <= 8191)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8192 && value <= 8191)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_TYPE_EPHEM_E_CONSTR_17 = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, 0, 4294967295} /* (0..4294967295) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_TYPE_EPHEM_A_POWER_HALF_CONSTR_19 = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, 0, 4294967295} /* (0..4294967295) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CODE_ON_L2_CONSTR_2 = { - { APC_CONSTRAINED, 2, 2, 0, 3 } /* (0..3) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 3} /* (0..3) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_URA_CONSTR_3 = { - { APC_CONSTRAINED, 4, 4, 0, 15 } /* (0..15) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 15} /* (0..15) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_S_VHEALTH_CONSTR_4 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_IODC_CONSTR_5 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_L2_PFLAG_CONSTR_6 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_TGD_CONSTR_8 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_TOC_CONSTR_9 = { - { APC_CONSTRAINED, 16, 16, 0, 37799 } /* (0..37799) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 37799} /* (0..37799) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_A_F2_CONSTR_10 = { - { APC_CONSTRAINED, 8, 8, -128, 127 } /* (-128..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, -128, 127} /* (-128..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_A_F1_CONSTR_11 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_A_F0_CONSTR_12 = { - { APC_CONSTRAINED, 22, -1, -2097152, 2097151 } /* (-2097152..2097151) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 22, -1, -2097152, 2097151} /* (-2097152..2097151) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CRS_CONSTR_13 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_DELTA_N_CONSTR_14 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_M0_CONSTR_15 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CUC_CONSTR_16 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_E_CONSTR_17 = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, 0, 4294967295} /* (0..4294967295) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CUS_CONSTR_18 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_A_POWER_HALF_CONSTR_19 = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, 0, 4294967295} /* (0..4294967295) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_TOE_CONSTR_20 = { - { APC_CONSTRAINED, 16, 16, 0, 37799 } /* (0..37799) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 37799} /* (0..37799) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_FIT_FLAG_CONSTR_21 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_AODA_CONSTR_22 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CIC_CONSTR_23 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_OMEGA_A0_CONSTR_24 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CIS_CONSTR_25 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_I0_CONSTR_26 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_CRC_CONSTR_27 = { - { APC_CONSTRAINED, 16, 16, -32768, 32767 } /* (-32768..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, -32768, 32767} /* (-32768..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_W_CONSTR_28 = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 32, -1, (-2147483647L - 1), + 2147483647} /* (-2147483648..2147483647) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_OMEGA_A_DOT_CONSTR_29 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_EPHEM_I_DOT_CONSTR_30 = { - { APC_CONSTRAINED, 14, 14, -8192, 8191 } /* (-8192..8191) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, -8192, 8191} /* (-8192..8191) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_specifics_t asn_SPC_ephemE_specs_17 = { - 0, 0, 0, 0, 0, - 0, /* Native long size */ - 1 /* Unsigned representation */ + 0, 0, 0, 0, 0, 0, /* Native long size */ + 1 /* Unsigned representation */ }; static ber_tlv_tag_t asn_DEF_ephemE_tags_17[] = { - (ASN_TAG_CLASS_CONTEXT | (15 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_ephemE_17 = { - "ephemE", - "ephemE", - ephemE_17_free, - ephemE_17_print, - ephemE_17_constraint, - ephemE_17_decode_ber, - ephemE_17_encode_der, - ephemE_17_decode_xer, - ephemE_17_encode_xer, - ephemE_17_decode_uper, - ephemE_17_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_ephemE_tags_17, - sizeof(asn_DEF_ephemE_tags_17) - /sizeof(asn_DEF_ephemE_tags_17[0]) - 1, /* 1 */ - asn_DEF_ephemE_tags_17, /* Same as above */ - sizeof(asn_DEF_ephemE_tags_17) - /sizeof(asn_DEF_ephemE_tags_17[0]), /* 2 */ - &ASN_PER_TYPE_EPHEM_E_CONSTR_17, - 0, 0, /* No members */ - &asn_SPC_ephemE_specs_17 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_ephemE_17 = { + "ephemE", + "ephemE", + ephemE_17_free, + ephemE_17_print, + ephemE_17_constraint, + ephemE_17_decode_ber, + ephemE_17_encode_der, + ephemE_17_decode_xer, + ephemE_17_encode_xer, + ephemE_17_decode_uper, + ephemE_17_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ephemE_tags_17, + sizeof(asn_DEF_ephemE_tags_17) / sizeof(asn_DEF_ephemE_tags_17[0]) - + 1, /* 1 */ + asn_DEF_ephemE_tags_17, /* Same as above */ + sizeof(asn_DEF_ephemE_tags_17) / + sizeof(asn_DEF_ephemE_tags_17[0]), /* 2 */ + &ASN_PER_TYPE_EPHEM_E_CONSTR_17, + 0, + 0, /* No members */ + &asn_SPC_ephemE_specs_17 /* Additional specs */ }; static asn_INTEGER_specifics_t asn_SPC_ephemAPowerHalf_specs_19 = { - 0, 0, 0, 0, 0, - 0, /* Native long size */ - 1 /* Unsigned representation */ + 0, 0, 0, 0, 0, 0, /* Native long size */ + 1 /* Unsigned representation */ }; static ber_tlv_tag_t asn_DEF_ephemAPowerHalf_tags_19[] = { - (ASN_TAG_CLASS_CONTEXT | (17 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19 = { - "ephemAPowerHalf", - "ephemAPowerHalf", - ephemAPowerHalf_19_free, - ephemAPowerHalf_19_print, - ephemAPowerHalf_19_constraint, - ephemAPowerHalf_19_decode_ber, - ephemAPowerHalf_19_encode_der, - ephemAPowerHalf_19_decode_xer, - ephemAPowerHalf_19_encode_xer, - ephemAPowerHalf_19_decode_uper, - ephemAPowerHalf_19_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_ephemAPowerHalf_tags_19, - sizeof(asn_DEF_ephemAPowerHalf_tags_19) - /sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]) - 1, /* 1 */ - asn_DEF_ephemAPowerHalf_tags_19, /* Same as above */ - sizeof(asn_DEF_ephemAPowerHalf_tags_19) - /sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]), /* 2 */ - &ASN_PER_TYPE_EPHEM_A_POWER_HALF_CONSTR_19, - 0, 0, /* No members */ - &asn_SPC_ephemAPowerHalf_specs_19 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19 = { + "ephemAPowerHalf", + "ephemAPowerHalf", + ephemAPowerHalf_19_free, + ephemAPowerHalf_19_print, + ephemAPowerHalf_19_constraint, + ephemAPowerHalf_19_decode_ber, + ephemAPowerHalf_19_encode_der, + ephemAPowerHalf_19_decode_xer, + ephemAPowerHalf_19_encode_xer, + ephemAPowerHalf_19_decode_uper, + ephemAPowerHalf_19_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_ephemAPowerHalf_tags_19, + sizeof(asn_DEF_ephemAPowerHalf_tags_19) / + sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]) - + 1, /* 1 */ + asn_DEF_ephemAPowerHalf_tags_19, /* Same as above */ + sizeof(asn_DEF_ephemAPowerHalf_tags_19) / + sizeof(asn_DEF_ephemAPowerHalf_tags_19[0]), /* 2 */ + &ASN_PER_TYPE_EPHEM_A_POWER_HALF_CONSTR_19, + 0, + 0, /* No members */ + &asn_SPC_ephemAPowerHalf_specs_19 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_UncompressedEphemeris_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCodeOnL2), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCodeOnL2_constraint_1, - &ASN_PER_MEMB_EPHEM_CODE_ON_L2_CONSTR_2, - 0, - "ephemCodeOnL2" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemURA), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemURA_constraint_1, - &ASN_PER_MEMB_EPHEM_URA_CONSTR_3, - 0, - "ephemURA" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSVhealth), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemSVhealth_constraint_1, - &ASN_PER_MEMB_EPHEM_S_VHEALTH_CONSTR_4, - 0, - "ephemSVhealth" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIODC), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemIODC_constraint_1, - &ASN_PER_MEMB_EPHEM_IODC_CONSTR_5, - 0, - "ephemIODC" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemL2Pflag), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemL2Pflag_constraint_1, - &ASN_PER_MEMB_EPHEM_L2_PFLAG_CONSTR_6, - 0, - "ephemL2Pflag" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSF1Rsvd), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_EphemerisSubframe1Reserved, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ephemSF1Rsvd" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemTgd), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemTgd_constraint_1, - &ASN_PER_MEMB_EPHEM_TGD_CONSTR_8, - 0, - "ephemTgd" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToc), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemToc_constraint_1, - &ASN_PER_MEMB_EPHEM_TOC_CONSTR_9, - 0, - "ephemToc" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF2), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemAF2_constraint_1, - &ASN_PER_MEMB_EPHEM_A_F2_CONSTR_10, - 0, - "ephemAF2" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF1), - (ASN_TAG_CLASS_CONTEXT | (9 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemAF1_constraint_1, - &ASN_PER_MEMB_EPHEM_A_F1_CONSTR_11, - 0, - "ephemAF1" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF0), - (ASN_TAG_CLASS_CONTEXT | (10 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemAF0_constraint_1, - &ASN_PER_MEMB_EPHEM_A_F0_CONSTR_12, - 0, - "ephemAF0" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrs), - (ASN_TAG_CLASS_CONTEXT | (11 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCrs_constraint_1, - &ASN_PER_MEMB_EPHEM_CRS_CONSTR_13, - 0, - "ephemCrs" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemDeltaN), - (ASN_TAG_CLASS_CONTEXT | (12 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemDeltaN_constraint_1, - &ASN_PER_MEMB_EPHEM_DELTA_N_CONSTR_14, - 0, - "ephemDeltaN" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemM0), - (ASN_TAG_CLASS_CONTEXT | (13 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemM0_constraint_1, - &ASN_PER_MEMB_EPHEM_M0_CONSTR_15, - 0, - "ephemM0" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCuc), - (ASN_TAG_CLASS_CONTEXT | (14 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCuc_constraint_1, - &ASN_PER_MEMB_EPHEM_CUC_CONSTR_16, - 0, - "ephemCuc" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemE), - (ASN_TAG_CLASS_CONTEXT | (15 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ephemE_17, - memb_ephemE_constraint_1, - &ASN_PER_MEMB_EPHEM_E_CONSTR_17, - 0, - "ephemE" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCus), - (ASN_TAG_CLASS_CONTEXT | (16 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCus_constraint_1, - &ASN_PER_MEMB_EPHEM_CUS_CONSTR_18, - 0, - "ephemCus" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAPowerHalf), - (ASN_TAG_CLASS_CONTEXT | (17 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_ephemAPowerHalf_19, - memb_ephemAPowerHalf_constraint_1, - &ASN_PER_MEMB_EPHEM_A_POWER_HALF_CONSTR_19, - 0, - "ephemAPowerHalf" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToe), - (ASN_TAG_CLASS_CONTEXT | (18 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemToe_constraint_1, - &ASN_PER_MEMB_EPHEM_TOE_CONSTR_20, - 0, - "ephemToe" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemFitFlag), - (ASN_TAG_CLASS_CONTEXT | (19 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemFitFlag_constraint_1, - &ASN_PER_MEMB_EPHEM_FIT_FLAG_CONSTR_21, - 0, - "ephemFitFlag" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAODA), - (ASN_TAG_CLASS_CONTEXT | (20 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemAODA_constraint_1, - &ASN_PER_MEMB_EPHEM_AODA_CONSTR_22, - 0, - "ephemAODA" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCic), - (ASN_TAG_CLASS_CONTEXT | (21 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCic_constraint_1, - &ASN_PER_MEMB_EPHEM_CIC_CONSTR_23, - 0, - "ephemCic" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaA0), - (ASN_TAG_CLASS_CONTEXT | (22 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemOmegaA0_constraint_1, - &ASN_PER_MEMB_EPHEM_OMEGA_A0_CONSTR_24, - 0, - "ephemOmegaA0" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCis), - (ASN_TAG_CLASS_CONTEXT | (23 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCis_constraint_1, - &ASN_PER_MEMB_EPHEM_CIS_CONSTR_25, - 0, - "ephemCis" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemI0), - (ASN_TAG_CLASS_CONTEXT | (24 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemI0_constraint_1, - &ASN_PER_MEMB_EPHEM_I0_CONSTR_26, - 0, - "ephemI0" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrc), - (ASN_TAG_CLASS_CONTEXT | (25 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemCrc_constraint_1, - &ASN_PER_MEMB_EPHEM_CRC_CONSTR_27, - 0, - "ephemCrc" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemW), - (ASN_TAG_CLASS_CONTEXT | (26 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemW_constraint_1, - &ASN_PER_MEMB_EPHEM_W_CONSTR_28, - 0, - "ephemW" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaADot), - (ASN_TAG_CLASS_CONTEXT | (27 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemOmegaADot_constraint_1, - &ASN_PER_MEMB_EPHEM_OMEGA_A_DOT_CONSTR_29, - 0, - "ephemOmegaADot" - }, - { ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIDot), - (ASN_TAG_CLASS_CONTEXT | (28 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_ephemIDot_constraint_1, - &ASN_PER_MEMB_EPHEM_I_DOT_CONSTR_30, - 0, - "ephemIDot" - }, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCodeOnL2), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCodeOnL2_constraint_1, + &ASN_PER_MEMB_EPHEM_CODE_ON_L2_CONSTR_2, 0, "ephemCodeOnL2"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemURA), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemURA_constraint_1, + &ASN_PER_MEMB_EPHEM_URA_CONSTR_3, 0, "ephemURA"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSVhealth), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemSVhealth_constraint_1, + &ASN_PER_MEMB_EPHEM_S_VHEALTH_CONSTR_4, 0, "ephemSVhealth"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIODC), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemIODC_constraint_1, + &ASN_PER_MEMB_EPHEM_IODC_CONSTR_5, 0, "ephemIODC"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemL2Pflag), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemL2Pflag_constraint_1, + &ASN_PER_MEMB_EPHEM_L2_PFLAG_CONSTR_6, 0, "ephemL2Pflag"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemSF1Rsvd), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_EphemerisSubframe1Reserved, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ephemSF1Rsvd"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemTgd), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemTgd_constraint_1, + &ASN_PER_MEMB_EPHEM_TGD_CONSTR_8, 0, "ephemTgd"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToc), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemToc_constraint_1, + &ASN_PER_MEMB_EPHEM_TOC_CONSTR_9, 0, "ephemToc"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF2), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemAF2_constraint_1, + &ASN_PER_MEMB_EPHEM_A_F2_CONSTR_10, 0, "ephemAF2"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF1), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemAF1_constraint_1, + &ASN_PER_MEMB_EPHEM_A_F1_CONSTR_11, 0, "ephemAF1"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAF0), + (ASN_TAG_CLASS_CONTEXT | (10 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemAF0_constraint_1, + &ASN_PER_MEMB_EPHEM_A_F0_CONSTR_12, 0, "ephemAF0"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrs), + (ASN_TAG_CLASS_CONTEXT | (11 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCrs_constraint_1, + &ASN_PER_MEMB_EPHEM_CRS_CONSTR_13, 0, "ephemCrs"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemDeltaN), + (ASN_TAG_CLASS_CONTEXT | (12 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemDeltaN_constraint_1, + &ASN_PER_MEMB_EPHEM_DELTA_N_CONSTR_14, 0, "ephemDeltaN"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemM0), + (ASN_TAG_CLASS_CONTEXT | (13 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemM0_constraint_1, + &ASN_PER_MEMB_EPHEM_M0_CONSTR_15, 0, "ephemM0"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCuc), + (ASN_TAG_CLASS_CONTEXT | (14 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCuc_constraint_1, + &ASN_PER_MEMB_EPHEM_CUC_CONSTR_16, 0, "ephemCuc"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemE), + (ASN_TAG_CLASS_CONTEXT | (15 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ephemE_17, memb_ephemE_constraint_1, + &ASN_PER_MEMB_EPHEM_E_CONSTR_17, 0, "ephemE"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCus), + (ASN_TAG_CLASS_CONTEXT | (16 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCus_constraint_1, + &ASN_PER_MEMB_EPHEM_CUS_CONSTR_18, 0, "ephemCus"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAPowerHalf), + (ASN_TAG_CLASS_CONTEXT | (17 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_ephemAPowerHalf_19, memb_ephemAPowerHalf_constraint_1, + &ASN_PER_MEMB_EPHEM_A_POWER_HALF_CONSTR_19, 0, "ephemAPowerHalf"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemToe), + (ASN_TAG_CLASS_CONTEXT | (18 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemToe_constraint_1, + &ASN_PER_MEMB_EPHEM_TOE_CONSTR_20, 0, "ephemToe"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemFitFlag), + (ASN_TAG_CLASS_CONTEXT | (19 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemFitFlag_constraint_1, + &ASN_PER_MEMB_EPHEM_FIT_FLAG_CONSTR_21, 0, "ephemFitFlag"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemAODA), + (ASN_TAG_CLASS_CONTEXT | (20 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemAODA_constraint_1, + &ASN_PER_MEMB_EPHEM_AODA_CONSTR_22, 0, "ephemAODA"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCic), + (ASN_TAG_CLASS_CONTEXT | (21 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCic_constraint_1, + &ASN_PER_MEMB_EPHEM_CIC_CONSTR_23, 0, "ephemCic"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaA0), + (ASN_TAG_CLASS_CONTEXT | (22 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemOmegaA0_constraint_1, + &ASN_PER_MEMB_EPHEM_OMEGA_A0_CONSTR_24, 0, "ephemOmegaA0"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCis), + (ASN_TAG_CLASS_CONTEXT | (23 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCis_constraint_1, + &ASN_PER_MEMB_EPHEM_CIS_CONSTR_25, 0, "ephemCis"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemI0), + (ASN_TAG_CLASS_CONTEXT | (24 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemI0_constraint_1, + &ASN_PER_MEMB_EPHEM_I0_CONSTR_26, 0, "ephemI0"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemCrc), + (ASN_TAG_CLASS_CONTEXT | (25 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemCrc_constraint_1, + &ASN_PER_MEMB_EPHEM_CRC_CONSTR_27, 0, "ephemCrc"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemW), + (ASN_TAG_CLASS_CONTEXT | (26 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemW_constraint_1, + &ASN_PER_MEMB_EPHEM_W_CONSTR_28, 0, "ephemW"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemOmegaADot), + (ASN_TAG_CLASS_CONTEXT | (27 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemOmegaADot_constraint_1, + &ASN_PER_MEMB_EPHEM_OMEGA_A_DOT_CONSTR_29, 0, "ephemOmegaADot"}, + {ATF_NOFLAGS, 0, offsetof(struct UncompressedEphemeris, ephemIDot), + (ASN_TAG_CLASS_CONTEXT | (28 << 2)), + -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_ephemIDot_constraint_1, + &ASN_PER_MEMB_EPHEM_I_DOT_CONSTR_30, 0, "ephemIDot"}, }; static ber_tlv_tag_t asn_DEF_UncompressedEphemeris_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_UncompressedEphemeris_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ephemCodeOnL2 at 722 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ephemURA at 723 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ephemSVhealth at 724 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ephemIODC at 725 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ephemL2Pflag at 726 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* ephemSF1Rsvd at 727 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* ephemTgd at 728 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ephemToc at 729 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* ephemAF2 at 730 */ - { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* ephemAF1 at 731 */ - { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* ephemAF0 at 732 */ - { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* ephemCrs at 733 */ - { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* ephemDeltaN at 734 */ - { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* ephemM0 at 735 */ - { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* ephemCuc at 736 */ - { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* ephemE at 737 */ - { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* ephemCus at 738 */ - { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* ephemAPowerHalf at 739 */ - { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* ephemToe at 740 */ - { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* ephemFitFlag at 741 */ - { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* ephemAODA at 742 */ - { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* ephemCic at 743 */ - { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* ephemOmegaA0 at 744 */ - { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* ephemCis at 745 */ - { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* ephemI0 at 746 */ - { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* ephemCrc at 747 */ - { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* ephemW at 748 */ - { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* ephemOmegaADot at 749 */ - { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 } /* ephemIDot at 750 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ephemCodeOnL2 at 722 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* ephemURA at 723 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* ephemSVhealth at 724 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* ephemIODC at 725 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* ephemL2Pflag at 726 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* ephemSF1Rsvd at 727 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* ephemTgd at 728 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0}, /* ephemToc at 729 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0}, /* ephemAF2 at 730 */ + {(ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0}, /* ephemAF1 at 731 */ + {(ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0}, /* ephemAF0 at 732 */ + {(ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0}, /* ephemCrs at 733 */ + {(ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0}, /* ephemDeltaN at 734 */ + {(ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0}, /* ephemM0 at 735 */ + {(ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0}, /* ephemCuc at 736 */ + {(ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0}, /* ephemE at 737 */ + {(ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0}, /* ephemCus at 738 */ + {(ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, + 0}, /* ephemAPowerHalf at 739 */ + {(ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0}, /* ephemToe at 740 */ + {(ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0}, /* ephemFitFlag at 741 */ + {(ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0}, /* ephemAODA at 742 */ + {(ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0}, /* ephemCic at 743 */ + {(ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0}, /* ephemOmegaA0 at 744 */ + {(ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0}, /* ephemCis at 745 */ + {(ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0}, /* ephemI0 at 746 */ + {(ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0}, /* ephemCrc at 747 */ + {(ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0}, /* ephemW at 748 */ + {(ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0}, /* ephemOmegaADot at 749 */ + {(ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0} /* ephemIDot at 750 */ }; static asn_SEQUENCE_specifics_t asn_SPC_UncompressedEphemeris_specs_1 = { sizeof(struct UncompressedEphemeris), offsetof(struct UncompressedEphemeris, _asn_ctx), asn_MAP_UncompressedEphemeris_tag2el_1, - 29, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 29, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_UncompressedEphemeris = { "UncompressedEphemeris", @@ -1424,16 +1466,15 @@ asn_TYPE_descriptor_t asn_DEF_UncompressedEphemeris = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UncompressedEphemeris_tags_1, - sizeof(asn_DEF_UncompressedEphemeris_tags_1) - /sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ - asn_DEF_UncompressedEphemeris_tags_1, /* Same as above */ - sizeof(asn_DEF_UncompressedEphemeris_tags_1) - /sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_UncompressedEphemeris_tags_1) / + sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ + asn_DEF_UncompressedEphemeris_tags_1, /* Same as above */ + sizeof(asn_DEF_UncompressedEphemeris_tags_1) / + sizeof(asn_DEF_UncompressedEphemeris_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_UncompressedEphemeris_1, - 29, /* Elements count */ - &asn_SPC_UncompressedEphemeris_specs_1 /* Additional specs */ + 29, /* Elements count */ + &asn_SPC_UncompressedEphemeris_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h index 90f2507f8..43e9bf74a 100644 --- a/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h +++ b/src/core/libs/supl/asn-rrlp/UncompressedEphemeris.h @@ -7,7 +7,6 @@ #ifndef _UncompressedEphemeris_H_ #define _UncompressedEphemeris_H_ - #include /* Including external dependencies */ @@ -58,8 +57,10 @@ extern "C" } UncompressedEphemeris_t; /* Implementation */ - /* extern asn_TYPE_descriptor_t asn_DEF_ephemE_17; // (Use -fall-defs-global to expose) */ - /* extern asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19; // (Use -fall-defs-global to expose) */ + /* extern asn_TYPE_descriptor_t asn_DEF_ephemE_17; // (Use + * -fall-defs-global to expose) */ + /* extern asn_TYPE_descriptor_t asn_DEF_ephemAPowerHalf_19; // (Use + * -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_UncompressedEphemeris; #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/UseMultipleSets.c b/src/core/libs/supl/asn-rrlp/UseMultipleSets.c index 3f42cc85f..2ec5c7b96 100644 --- a/src/core/libs/supl/asn-rrlp/UseMultipleSets.c +++ b/src/core/libs/supl/asn-rrlp/UseMultipleSets.c @@ -6,9 +6,10 @@ #include "UseMultipleSets.h" -int -UseMultipleSets_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int UseMultipleSets_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,107 +19,123 @@ UseMultipleSets_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -UseMultipleSets_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void UseMultipleSets_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -UseMultipleSets_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void UseMultipleSets_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -UseMultipleSets_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int UseMultipleSets_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -UseMultipleSets_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t UseMultipleSets_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -UseMultipleSets_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UseMultipleSets_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -UseMultipleSets_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t UseMultipleSets_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -UseMultipleSets_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UseMultipleSets_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -UseMultipleSets_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t UseMultipleSets_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -UseMultipleSets_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t UseMultipleSets_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ UseMultipleSets_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_USE_MULTIPLE_SETS_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_UseMultipleSets_value2enum_1[] = { - { 0, 12, "multipleSets" }, - { 1, 6, "oneSet" } -}; + {0, 12, "multipleSets"}, {1, 6, "oneSet"}}; static unsigned int asn_MAP_UseMultipleSets_enum2value_1[] = { - 0, /* multipleSets(0) */ - 1 /* oneSet(1) */ + 0, /* multipleSets(0) */ + 1 /* oneSet(1) */ }; static asn_INTEGER_specifics_t asn_SPC_UseMultipleSets_specs_1 = { - asn_MAP_UseMultipleSets_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_UseMultipleSets_enum2value_1, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_UseMultipleSets_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_UseMultipleSets_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_UseMultipleSets_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_UseMultipleSets = { "UseMultipleSets", "UseMultipleSets", @@ -131,15 +148,15 @@ asn_TYPE_descriptor_t asn_DEF_UseMultipleSets = { UseMultipleSets_encode_xer, UseMultipleSets_decode_uper, UseMultipleSets_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UseMultipleSets_tags_1, - sizeof(asn_DEF_UseMultipleSets_tags_1) - /sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ - asn_DEF_UseMultipleSets_tags_1, /* Same as above */ - sizeof(asn_DEF_UseMultipleSets_tags_1) - /sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ + sizeof(asn_DEF_UseMultipleSets_tags_1) / + sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ + asn_DEF_UseMultipleSets_tags_1, /* Same as above */ + sizeof(asn_DEF_UseMultipleSets_tags_1) / + sizeof(asn_DEF_UseMultipleSets_tags_1[0]), /* 1 */ &ASN_PER_TYPE_USE_MULTIPLE_SETS_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_UseMultipleSets_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_UseMultipleSets_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-rrlp/UseMultipleSets.h b/src/core/libs/supl/asn-rrlp/UseMultipleSets.h index 3b2745c3f..34c003394 100644 --- a/src/core/libs/supl/asn-rrlp/UseMultipleSets.h +++ b/src/core/libs/supl/asn-rrlp/UseMultipleSets.h @@ -7,7 +7,6 @@ #ifndef _UseMultipleSets_H_ #define _UseMultipleSets_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/VelocityEstimate.c b/src/core/libs/supl/asn-rrlp/VelocityEstimate.c index 52c972a21..dbe8617c6 100644 --- a/src/core/libs/supl/asn-rrlp/VelocityEstimate.c +++ b/src/core/libs/supl/asn-rrlp/VelocityEstimate.c @@ -6,9 +6,10 @@ #include "VelocityEstimate.h" -int -VelocityEstimate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int VelocityEstimate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,85 +19,102 @@ VelocityEstimate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ -static void -VelocityEstimate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_INTEGER.free_struct; - td->print_struct = asn_DEF_INTEGER.print_struct; - td->ber_decoder = asn_DEF_INTEGER.ber_decoder; - td->der_encoder = asn_DEF_INTEGER.der_encoder; - td->xer_decoder = asn_DEF_INTEGER.xer_decoder; - td->xer_encoder = asn_DEF_INTEGER.xer_encoder; - td->uper_decoder = asn_DEF_INTEGER.uper_decoder; - td->uper_encoder = asn_DEF_INTEGER.uper_encoder; - if(!td->per_constraints) +static void VelocityEstimate_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; - td->elements = asn_DEF_INTEGER.elements; + td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; - td->specifics = asn_DEF_INTEGER.specifics; + td->specifics = asn_DEF_INTEGER.specifics; } -void -VelocityEstimate_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void VelocityEstimate_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -VelocityEstimate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int VelocityEstimate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -VelocityEstimate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t VelocityEstimate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -VelocityEstimate_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t VelocityEstimate_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -VelocityEstimate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t VelocityEstimate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -VelocityEstimate_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t VelocityEstimate_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -VelocityEstimate_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t VelocityEstimate_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -VelocityEstimate_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t VelocityEstimate_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ VelocityEstimate_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_VelocityEstimate_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_VelocityEstimate = { "VelocityEstimate", "VelocityEstimate", @@ -109,15 +127,15 @@ asn_TYPE_descriptor_t asn_DEF_VelocityEstimate = { VelocityEstimate_encode_xer, VelocityEstimate_decode_uper, VelocityEstimate_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_VelocityEstimate_tags_1, - sizeof(asn_DEF_VelocityEstimate_tags_1) - /sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ - asn_DEF_VelocityEstimate_tags_1, /* Same as above */ - sizeof(asn_DEF_VelocityEstimate_tags_1) - /sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_VelocityEstimate_tags_1) / + sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ + asn_DEF_VelocityEstimate_tags_1, /* Same as above */ + sizeof(asn_DEF_VelocityEstimate_tags_1) / + sizeof(asn_DEF_VelocityEstimate_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-rrlp/VelocityEstimate.h b/src/core/libs/supl/asn-rrlp/VelocityEstimate.h index 971ba80cc..762fcc0af 100644 --- a/src/core/libs/supl/asn-rrlp/VelocityEstimate.h +++ b/src/core/libs/supl/asn-rrlp/VelocityEstimate.h @@ -7,7 +7,6 @@ #ifndef _VelocityEstimate_H_ #define _VelocityEstimate_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c index 5870c0051..924cb150e 100644 --- a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c +++ b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.c @@ -7,35 +7,38 @@ typedef A_SEQUENCE_OF(void) asn_sequence; -void -asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { +void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) +{ asn_sequence *as = (asn_sequence *)asn_sequence_of_x; - if(as) { - void *ptr; - int n; + if (as) + { + void *ptr; + int n; - if(number < 0 || number >= as->count) - return; /* Nothing to delete */ + if (number < 0 || number >= as->count) + return; /* Nothing to delete */ - if(_do_free && as->free) { - ptr = as->array[number]; - } else { - ptr = 0; + if (_do_free && as->free) + { + ptr = as->array[number]; + } + else + { + ptr = 0; + } + + /* + * Shift all elements to the left to hide the gap. + */ + --as->count; + for (n = number; n < as->count; n++) + as->array[n] = as->array[n + 1]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if (ptr) as->free(ptr); } - - /* - * Shift all elements to the left to hide the gap. - */ - --as->count; - for(n = number; n < as->count; n++) - as->array[n] = as->array[n+1]; - - /* - * Invoke the third-party function only when the state - * of the parent structure is consistent. - */ - if(ptr) as->free(ptr); - } } - diff --git a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h index 2ad8287a0..7907b2ca9 100644 --- a/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h +++ b/src/core/libs/supl/asn-rrlp/asn_SEQUENCE_OF.h @@ -19,29 +19,28 @@ extern "C" */ #define A_SEQUENCE_OF(type) A_SET_OF(type) -#define ASN_SEQUENCE_ADD(headptr, ptr) \ - asn_sequence_add((headptr), (ptr)) +#define ASN_SEQUENCE_ADD(headptr, ptr) asn_sequence_add((headptr), (ptr)) /*********************************************** - * Implementation of the SEQUENCE OF structure. - */ + * Implementation of the SEQUENCE OF structure. + */ #define asn_sequence_add asn_set_add #define asn_sequence_empty asn_set_empty /* - * Delete the element from the set by its number (base 0). - * This is NOT a constant-time operation. - * The order of elements is preserved. - * If _do_free is given AND the (*free) is initialized, the element - * will be freed using the custom (*free) function as well. - */ + * Delete the element from the set by its number (base 0). + * This is NOT a constant-time operation. + * The order of elements is preserved. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); /* - * Cope with different conversions requirements to/from void in C and C++. - * This is mostly useful for support library. - */ + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; #define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) #define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) diff --git a/src/core/libs/supl/asn-rrlp/asn_SET_OF.c b/src/core/libs/supl/asn-rrlp/asn_SET_OF.c index e16036453..2239dbe58 100644 --- a/src/core/libs/supl/asn-rrlp/asn_SET_OF.c +++ b/src/core/libs/supl/asn-rrlp/asn_SET_OF.c @@ -9,80 +9,88 @@ /* * Add another element into the set. */ -int -asn_set_add(void *asn_set_of_x, void *ptr) { +int asn_set_add(void *asn_set_of_x, void *ptr) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as == 0 || ptr == 0) { - errno = EINVAL; /* Invalid arguments */ - return -1; - } + if (as == 0 || ptr == 0) + { + errno = EINVAL; /* Invalid arguments */ + return -1; + } /* * Make sure there's enough space to insert an element. */ - if(as->count == as->size) { - int _newsize = as->size ? (as->size << 1) : 4; - void *_new_arr; - _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); - if(_new_arr) { - as->array = (void **)_new_arr; - as->size = _newsize; - } else { - /* ENOMEM */ - return -1; + if (as->count == as->size) + { + int _newsize = as->size ? (as->size << 1) : 4; + void *_new_arr; + _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); + if (_new_arr) + { + as->array = (void **)_new_arr; + as->size = _newsize; + } + else + { + /* ENOMEM */ + return -1; + } } - } as->array[as->count++] = ptr; return 0; } -void -asn_set_del(void *asn_set_of_x, int number, int _do_free) { +void asn_set_del(void *asn_set_of_x, int number, int _do_free) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as) { - void *ptr; - if(number < 0 || number >= as->count) - return; + if (as) + { + void *ptr; + if (number < 0 || number >= as->count) return; - if(_do_free && as->free) { - ptr = as->array[number]; - } else { - ptr = 0; + if (_do_free && as->free) + { + ptr = as->array[number]; + } + else + { + ptr = 0; + } + + as->array[number] = as->array[--as->count]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if (ptr) as->free(ptr); } - - as->array[number] = as->array[--as->count]; - - /* - * Invoke the third-party function only when the state - * of the parent structure is consistent. - */ - if(ptr) as->free(ptr); - } } /* * Free the contents of the set, do not free the set itself. */ -void -asn_set_empty(void *asn_set_of_x) { +void asn_set_empty(void *asn_set_of_x) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as) { - if(as->array) { - if(as->free) { - while(as->count--) - as->free(as->array[as->count]); - } - FREEMEM(as->array); - as->array = 0; + if (as) + { + if (as->array) + { + if (as->free) + { + while (as->count--) as->free(as->array[as->count]); + } + FREEMEM(as->array); + as->array = 0; + } + as->count = 0; + as->size = 0; } - as->count = 0; - as->size = 0; - } - } - diff --git a/src/core/libs/supl/asn-rrlp/asn_SET_OF.h b/src/core/libs/supl/asn-rrlp/asn_SET_OF.h index 0edc0abc4..64264e091 100644 --- a/src/core/libs/supl/asn-rrlp/asn_SET_OF.h +++ b/src/core/libs/supl/asn-rrlp/asn_SET_OF.h @@ -19,40 +19,39 @@ extern "C" void (*free)(type *); \ } -#define ASN_SET_ADD(headptr, ptr) \ - asn_set_add((headptr), (ptr)) +#define ASN_SET_ADD(headptr, ptr) asn_set_add((headptr), (ptr)) /******************************************* - * Implementation of the SET OF structure. - */ + * Implementation of the SET OF structure. + */ /* - * Add another structure into the set by its pointer. - * RETURN VALUES: - * 0 for success and -1/errno for failure. - */ + * Add another structure into the set by its pointer. + * RETURN VALUES: + * 0 for success and -1/errno for failure. + */ int asn_set_add(void *asn_set_of_x, void *ptr); /* - * Delete the element from the set by its number (base 0). - * This is a constant-time operation. The order of elements before the - * deleted ones is guaranteed, the order of elements after the deleted - * one is NOT guaranteed. - * If _do_free is given AND the (*free) is initialized, the element - * will be freed using the custom (*free) function as well. - */ + * Delete the element from the set by its number (base 0). + * This is a constant-time operation. The order of elements before the + * deleted ones is guaranteed, the order of elements after the deleted + * one is NOT guaranteed. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ void asn_set_del(void *asn_set_of_x, int number, int _do_free); /* - * Empty the contents of the set. Will free the elements, if (*free) is given. - * Will NOT free the set itself. - */ + * Empty the contents of the set. Will free the elements, if (*free) is + * given. Will NOT free the set itself. + */ void asn_set_empty(void *asn_set_of_x); /* - * Cope with different conversions requirements to/from void in C and C++. - * This is mostly useful for support library. - */ + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ typedef A_SET_OF(void) asn_anonymous_set_; #define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) #define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) diff --git a/src/core/libs/supl/asn-rrlp/asn_application.h b/src/core/libs/supl/asn-rrlp/asn_application.h index 43904afb0..ec8567737 100644 --- a/src/core/libs/supl/asn-rrlp/asn_application.h +++ b/src/core/libs/supl/asn-rrlp/asn_application.h @@ -17,24 +17,25 @@ extern "C" #endif /* - * Generic type of an application-defined callback to return various - * types of data to the application. - * EXPECTED RETURN VALUES: - * -1: Failed to consume bytes. Abort the mission. - * Non-negative return values indicate success, and ignored. - */ + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size, - void *application_specific_key); + void *application_specific_key); /* - * A callback of this type is called whenever constraint validation fails - * on some ASN.1 type. See "constraints.h" for more details on constraint - * validation. - * This callback specifies a descriptor of the ASN.1 type which failed - * the constraint check, as well as human readable message on what - * particular constraint has failed. - */ - typedef void(asn_app_constraint_failed_f)(void *application_specific_key, + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ + typedef void(asn_app_constraint_failed_f)( + void *application_specific_key, struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs.h b/src/core/libs/supl/asn-rrlp/asn_codecs.h index 47098d1fd..dd6b68bcc 100644 --- a/src/core/libs/supl/asn-rrlp/asn_codecs.h +++ b/src/core/libs/supl/asn-rrlp/asn_codecs.h @@ -14,45 +14,46 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * This structure defines a set of parameters that may be passed - * to every ASN.1 encoder or decoder function. - * WARNING: if max_stack_size member is set, and you are calling the - * function pointers of the asn_TYPE_descriptor_t directly, - * this structure must be ALLOCATED ON THE STACK! - * If you can't always satisfy this requirement, use ber_decode(), - * xer_decode() and uper_decode() functions instead. - */ + * This structure defines a set of parameters that may be passed + * to every ASN.1 encoder or decoder function. + * WARNING: if max_stack_size member is set, and you are calling the + * function pointers of the asn_TYPE_descriptor_t directly, + * this structure must be ALLOCATED ON THE STACK! + * If you can't always satisfy this requirement, use ber_decode(), + * xer_decode() and uper_decode() functions instead. + */ typedef struct asn_codec_ctx_s { /* - * Limit the decoder routines to use no (much) more stack than a given - * number of bytes. Most of decoders are stack-based, and this - * would protect against stack overflows if the number of nested - * encodings is high. - * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, - * and are safe from this kind of overflow. - * A value from getrlimit(RLIMIT_STACK) may be used to initialize - * this variable. Be careful in multithreaded environments, as the - * stack size is rather limited. - */ + * Limit the decoder routines to use no (much) more stack than a given + * number of bytes. Most of decoders are stack-based, and this + * would protect against stack overflows if the number of nested + * encodings is high. + * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, + * and are safe from this kind of overflow. + * A value from getrlimit(RLIMIT_STACK) may be used to initialize + * this variable. Be careful in multithreaded environments, as the + * stack size is rather limited. + */ size_t max_stack_size; /* 0 disables stack bounds checking */ } asn_codec_ctx_t; /* - * Type of the return value of the encoding functions (der_encode, xer_encode). - */ + * Type of the return value of the encoding functions (der_encode, + * xer_encode). + */ typedef struct asn_enc_rval_s { /* - * Number of bytes encoded. - * -1 indicates failure to encode the structure. - * In this case, the members below this one are meaningful. - */ + * Number of bytes encoded. + * -1 indicates failure to encode the structure. + * In this case, the members below this one are meaningful. + */ ssize_t encoded; /* - * Members meaningful when (encoded == -1), for post mortem analysis. - */ + * Members meaningful when (encoded == -1), for post mortem analysis. + */ /* Type which cannot be encoded */ struct asn_TYPE_descriptor_s *failed_type; @@ -81,13 +82,14 @@ extern "C" while (0) /* - * Type of the return value of the decoding functions (ber_decode, xer_decode) - * - * Please note that the number of consumed bytes is ALWAYS meaningful, - * even if code==RC_FAIL. This is to indicate the number of successfully - * decoded bytes, hence providing a possibility to fail with more diagnostics - * (i.e., print the offending remainder of the buffer). - */ + * Type of the return value of the decoding functions (ber_decode, + * xer_decode) + * + * Please note that the number of consumed bytes is ALWAYS meaningful, + * even if code==RC_FAIL. This is to indicate the number of successfully + * decoded bytes, hence providing a possibility to fail with more + * diagnostics (i.e., print the offending remainder of the buffer). + */ enum asn_dec_rval_code_e { RC_OK, /* Decoded successfully */ diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c index 9495cbab9..692601c17 100644 --- a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c +++ b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.c @@ -9,10 +9,11 @@ /* * Decode an always-primitive type. */ -asn_dec_rval_t -ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, const void *buf_ptr, size_t size, int tag_mode) { +asn_dec_rval_t ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buf_ptr, size_t size, + int tag_mode) +{ ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; asn_dec_rval_t rval; ber_tlv_len_t length; @@ -20,22 +21,21 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * If the structure is not there, allocate it. */ - if(st == NULL) { - st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); - if(st == NULL) _ASN_DECODE_FAILED; - *sptr = (void *)st; - } + if (st == NULL) + { + st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); + if (st == NULL) _ASN_DECODE_FAILED; + *sptr = (void *)st; + } - ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", td->name, tag_mode); /* * Check tags and extract value length. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); @@ -44,35 +44,36 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } st->size = (int)length; /* The following better be optimized away. */ - if(sizeof(st->size) != sizeof(length) - && (ber_tlv_len_t)st->size != length) { - st->size = 0; - _ASN_DECODE_FAILED; - } + if (sizeof(st->size) != sizeof(length) && (ber_tlv_len_t)st->size != length) + { + st->size = 0; + _ASN_DECODE_FAILED; + } st->buf = (uint8_t *)MALLOC(length + 1); - if(!st->buf) { - st->size = 0; - _ASN_DECODE_FAILED; - } + if (!st->buf) + { + st->size = 0; + _ASN_DECODE_FAILED; + } memcpy(st->buf, buf_ptr, length); - st->buf[length] = '\0'; /* Just in case */ + st->buf[length] = '\0'; /* Just in case */ rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s", - (long)rval.consumed, - (long)length, td->name); + ASN_DEBUG("Took %ld/%ld bytes to encode %s", (long)rval.consumed, + (long)length, td->name); return rval; } @@ -80,62 +81,63 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * Encode an always-primitive type using DER. */ -asn_enc_rval_t -der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t erval; ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; ASN_DEBUG("%s %s as a primitive type (tm=%d)", - cb?"Encoding":"Estimating", td->name, tag_mode); + cb ? "Encoding" : "Estimating", td->name, tag_mode); - erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, - cb, app_key); + erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, cb, app_key); ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - - if(cb && st->buf) { - if(cb(st->buf, st->size, app_key) < 0) { - erval.encoded = -1; + if (erval.encoded == -1) + { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } - } else { - assert(st->buf || st->size == 0); - } + + if (cb && st->buf) + { + if (cb(st->buf, st->size, app_key) < 0) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } + else + { + assert(st->buf || st->size == 0); + } erval.encoded += st->size; _ASN_ENCODED_OK(erval); } -void -ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, - int contents_only) { +void ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, + int contents_only) +{ ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; - if(!td || !sptr) - return; + if (!td || !sptr) return; ASN_DEBUG("Freeing %s as a primitive type", td->name); - if(st->buf) - FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); - if(!contents_only) - FREEMEM(st); + if (!contents_only) FREEMEM(st); } - /* * Local internal type passed around as an argument. */ -struct xdp_arg_s { +struct xdp_arg_s +{ asn_TYPE_descriptor_t *type_descriptor; void *struct_key; xer_primitive_body_decoder_f *prim_body_decoder; @@ -143,94 +145,94 @@ struct xdp_arg_s { int want_more; }; - -static int -xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { +static int xer_decode__unexpected_tag(void *key, const void *chunk_buf, + size_t chunk_size) +{ struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; - if(arg->decoded_something) { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return 0; /* Skip it. */ - /* - * Decoding was done once already. Prohibit doing it again. - */ - return -1; - } + if (arg->decoded_something) + { + if (xer_is_whitespace(chunk_buf, chunk_size)) + return 0; /* Skip it. */ + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } - bret = arg->prim_body_decoder(arg->type_descriptor, - arg->struct_key, chunk_buf, chunk_size); - switch(bret) { - case XPBD_SYSTEM_FAILURE: - case XPBD_DECODER_LIMIT: - case XPBD_BROKEN_ENCODING: - break; - case XPBD_BODY_CONSUMED: - /* Tag decoded successfully */ - arg->decoded_something = 1; - /* Fall through */ - case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ - return 0; - } + bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, + chunk_buf, chunk_size); + switch (bret) + { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return 0; + } return -1; } -static ssize_t -xer_decode__body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t xer_decode__body(void *key, const void *chunk_buf, + size_t chunk_size, int have_more) +{ struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; - if(arg->decoded_something) { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return chunk_size; - /* - * Decoding was done once already. Prohibit doing it again. - */ - return -1; - } + if (arg->decoded_something) + { + if (xer_is_whitespace(chunk_buf, chunk_size)) return chunk_size; + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } - if(!have_more) { - /* - * If we've received something like "1", we can't really - * tell whether it is really `1` or `123`, until we know - * that there is no more data coming. - * The have_more argument will be set to 1 once something - * like this is available to the caller of this callback: - * "1want_more = 1; - return -1; - } + if (!have_more) + { + /* + * If we've received something like "1", we can't really + * tell whether it is really `1` or `123`, until we know + * that there is no more data coming. + * The have_more argument will be set to 1 once something + * like this is available to the caller of this callback: + * "1want_more = 1; + return -1; + } - bret = arg->prim_body_decoder(arg->type_descriptor, - arg->struct_key, chunk_buf, chunk_size); - switch(bret) { - case XPBD_SYSTEM_FAILURE: - case XPBD_DECODER_LIMIT: - case XPBD_BROKEN_ENCODING: - break; - case XPBD_BODY_CONSUMED: - /* Tag decoded successfully */ - arg->decoded_something = 1; - /* Fall through */ - case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ - return chunk_size; - } + bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, + chunk_buf, chunk_size); + switch (bret) + { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return chunk_size; + } return -1; } - -asn_dec_rval_t -xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, - size_t struct_size, - const char *opt_mname, - const void *buf_ptr, size_t size, - xer_primitive_body_decoder_f *prim_body_decoder -) { +asn_dec_rval_t xer_decode_primitive( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, + size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder) +{ const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; asn_struct_ctx_t s_ctx; struct xdp_arg_s s_arg; @@ -239,10 +241,11 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * Create the structure if does not exist. */ - if(!*sptr) { - *sptr = CALLOC(1, struct_size); - if(!*sptr) _ASN_DECODE_FAILED; - } + if (!*sptr) + { + *sptr = CALLOC(1, struct_size); + if (!*sptr) _ASN_DECODE_FAILED; + } memset(&s_ctx, 0, sizeof(s_ctx)); s_arg.type_descriptor = td; @@ -251,45 +254,47 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, s_arg.decoded_something = 0; s_arg.want_more = 0; - rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, - xml_tag, buf_ptr, size, - xer_decode__unexpected_tag, xer_decode__body); - switch(rc.code) { - case RC_OK: - if(!s_arg.decoded_something) { - char ch; - ASN_DEBUG("Primitive body is not recognized, " - "supplying empty one"); - /* - * Decoding opportunity has come and gone. - * Where's the result? - * Try to feed with empty body, see if it eats it. - */ - if(prim_body_decoder(s_arg.type_descriptor, - s_arg.struct_key, &ch, 0) - != XPBD_BODY_CONSUMED) { + rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, xml_tag, buf_ptr, + size, xer_decode__unexpected_tag, xer_decode__body); + switch (rc.code) + { + case RC_OK: + if (!s_arg.decoded_something) + { + char ch; + ASN_DEBUG( + "Primitive body is not recognized, " + "supplying empty one"); + /* + * Decoding opportunity has come and gone. + * Where's the result? + * Try to feed with empty body, see if it eats it. + */ + if (prim_body_decoder(s_arg.type_descriptor, + s_arg.struct_key, &ch, + 0) != XPBD_BODY_CONSUMED) + { + /* + * This decoder does not like empty stuff. + */ + _ASN_DECODE_FAILED; + } + } + break; + case RC_WMORE: /* - * This decoder does not like empty stuff. + * Redo the whole thing later. + * We don't have a context to save intermediate parsing state. */ - _ASN_DECODE_FAILED; - } + rc.consumed = 0; + break; + case RC_FAIL: + rc.consumed = 0; + if (s_arg.want_more) + rc.code = RC_WMORE; + else + _ASN_DECODE_FAILED; + break; } - break; - case RC_WMORE: - /* - * Redo the whole thing later. - * We don't have a context to save intermediate parsing state. - */ - rc.consumed = 0; - break; - case RC_FAIL: - rc.consumed = 0; - if(s_arg.want_more) - rc.code = RC_WMORE; - else - _ASN_DECODE_FAILED; - break; - } return rc; } - diff --git a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h index cb8c37937..b3108aed5 100644 --- a/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h +++ b/src/core/libs/supl/asn-rrlp/asn_codecs_prim.h @@ -14,8 +14,8 @@ extern "C" typedef struct ASN__PRIMITIVE_TYPE_s { - uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ - int size; /* Size of the buffer */ + uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ + int size; /* Size of the buffer */ } ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ asn_struct_free_f ASN__PRIMITIVE_TYPE_free; @@ -23,8 +23,8 @@ extern "C" der_type_encoder_f der_encode_primitive; /* - * A callback specification for the xer_decode_primitive() function below. - */ + * A callback specification for the xer_decode_primitive() function below. + */ enum xer_pbd_rval { XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ @@ -33,17 +33,17 @@ extern "C" XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ XPBD_BODY_CONSUMED /* Body is recognized and consumed */ }; - typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)(asn_TYPE_descriptor_t *td, void *struct_ptr, - const void *chunk_buf, size_t chunk_size); + typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)( + asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf, + size_t chunk_size); /* - * Specific function to decode simple primitive types. - * Also see xer_decode_general() in xer_decoder.h - */ - asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *type_descriptor, - void **struct_ptr, size_t struct_size, - const char *opt_mname, + * Specific function to decode simple primitive types. + * Also see xer_decode_general() in xer_decoder.h + */ + asn_dec_rval_t xer_decode_primitive( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, xer_primitive_body_decoder_f *prim_body_decoder); diff --git a/src/core/libs/supl/asn-rrlp/asn_internal.h b/src/core/libs/supl/asn-rrlp/asn_internal.h index 299c4e0e7..339dc86e4 100644 --- a/src/core/libs/supl/asn-rrlp/asn_internal.h +++ b/src/core/libs/supl/asn-rrlp/asn_internal.h @@ -41,25 +41,21 @@ extern "C" #else /* !ASN_THREAD_SAFE */ int asn_debug_indent; #endif /* ASN_THREAD_SAFE */ -#define ASN_DEBUG(fmt, args...) \ - do \ - { \ - int adi = asn_debug_indent; \ - while (adi--) fprintf(stderr, " "); \ - fprintf(stderr, fmt, ##args); \ - fprintf(stderr, " (%s:%d)\n", \ - __FILE__, __LINE__); \ - } \ +#define ASN_DEBUG(fmt, args...) \ + do \ + { \ + int adi = asn_debug_indent; \ + while (adi--) fprintf(stderr, " "); \ + fprintf(stderr, fmt, ##args); \ + fprintf(stderr, " (%s:%d)\n", __FILE__, __LINE__); \ + } \ while (0) #else /* !__GNUC__ */ void ASN_DEBUG_f(const char *fmt, ...); #define ASN_DEBUG ASN_DEBUG_f #endif /* __GNUC__ */ #else /* EMIT_ASN_DEBUG != 1 */ - static inline void ASN_DEBUG(const char *fmt, ...) - { - (void)fmt; - } + static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } #endif /* EMIT_ASN_DEBUG */ #endif /* ASN_DEBUG */ @@ -73,25 +69,24 @@ extern "C" if (foo) goto cb_failed; \ } \ while (0) -#define _ASN_CALLBACK(buf, size) \ - _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) +#define _ASN_CALLBACK(buf, size) _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) #define _ASN_CALLBACK2(buf1, size1, buf2, size2) \ _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2)) -#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ - _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2) || __ASN_E_cbc(buf3, size3)) +#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2) || \ + __ASN_E_cbc(buf3, size3)) -#define _i_ASN_TEXT_INDENT(nl, level) \ - do \ - { \ - int __level = (level); \ - int __nl = ((nl) != 0); \ - int __i; \ - if (__nl) _ASN_CALLBACK("\n", 1); \ - if (__level < 0) __level = 0; \ - for (__i = 0; __i < __level; __i++) \ - _ASN_CALLBACK(" ", 4); \ - er.encoded += __nl + 4 * __level; \ - } \ +#define _i_ASN_TEXT_INDENT(nl, level) \ + do \ + { \ + int __level = (level); \ + int __nl = ((nl) != 0); \ + int __i; \ + if (__nl) _ASN_CALLBACK("\n", 1); \ + if (__level < 0) __level = 0; \ + for (__i = 0; __i < __level; __i++) _ASN_CALLBACK(" ", 4); \ + er.encoded += __nl + 4 * __level; \ + } \ while (0) #define _i_INDENT(nl) \ @@ -108,8 +103,7 @@ extern "C" * Check stack against overflow, if limit is set. */ #define _ASN_DEFAULT_STACK_MAX (30000) - static inline int - _ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) + static inline int _ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { if (ctx && ctx->max_stack_size) { @@ -121,7 +115,7 @@ extern "C" if (usedstack < -(ptrdiff_t)ctx->max_stack_size) { ASN_DEBUG("Stack limit %ld reached", - (long)ctx->max_stack_size); + (long)ctx->max_stack_size); return -1; } } diff --git a/src/core/libs/supl/asn-rrlp/asn_system.h b/src/core/libs/supl/asn-rrlp/asn_system.h index 4c175d3d3..5eacc2ecb 100644 --- a/src/core/libs/supl/asn-rrlp/asn_system.h +++ b/src/core/libs/supl/asn-rrlp/asn_system.h @@ -28,7 +28,9 @@ #define vsnprintf _vsnprintf /* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ -#define sys_ntohl(l) ((((l) << 24) & 0xff000000) | (((l) << 16) & 0xff0000) | (((l) << 8) & 0xff00) | ((l)&0xff)) +#define sys_ntohl(l) \ + ((((l) << 24) & 0xff000000) | (((l) << 16) & 0xff0000) | \ + (((l) << 8) & 0xff00) | ((l)&0xff)) #ifdef _MSC_VER /* MSVS.Net */ #ifndef __cplusplus @@ -116,8 +118,12 @@ typedef unsigned int uint32_t; #ifndef MIN /* Suitable for comparing primitive types (integers) */ #if defined(__GNUC__) -#define MIN(a, b) ({ __typeof a _a = a; __typeof b _b = b; \ - ((_a)<(_b)?(_a):(_b)); }) +#define MIN(a, b) \ + ({ \ + __typeof a _a = a; \ + __typeof b _b = b; \ + ((_a) < (_b) ? (_a) : (_b)); \ + }) #else /* !__GNUC__ */ #define MIN(a, b) ((a) < (b) ? (a) : (b)) /* Unsafe variant */ #endif /* __GNUC__ */ diff --git a/src/core/libs/supl/asn-rrlp/ber_decoder.c b/src/core/libs/supl/asn-rrlp/ber_decoder.c index 7d990436b..36fc4b9d2 100644 --- a/src/core/libs/supl/asn-rrlp/ber_decoder.c +++ b/src/core/libs/supl/asn-rrlp/ber_decoder.c @@ -4,68 +4,80 @@ */ #include -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) -#undef RETURN -#define RETURN(_code) do { \ - asn_dec_rval_t rval; \ - rval.code = _code; \ - if(opt_ctx) opt_ctx->step = step; /* Save context */ \ - if((_code) == RC_OK || opt_ctx) \ - rval.consumed = consumed_myself; \ - else \ - rval.consumed = 0; /* Context-free */ \ - return rval; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + asn_dec_rval_t rval; \ + rval.code = _code; \ + if (opt_ctx) opt_ctx->step = step; /* Save context */ \ + if ((_code) == RC_OK || opt_ctx) \ + rval.consumed = consumed_myself; \ + else \ + rval.consumed = 0; /* Context-free */ \ + return rval; \ + } \ + while (0) /* * The BER decoder of any type. */ -asn_dec_rval_t -ber_decode(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *type_descriptor, - void **struct_ptr, const void *ptr, size_t size) { +asn_dec_rval_t ber_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, const void *ptr, size_t size) +{ asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* * Invoke type-specific decoder. */ - return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, - struct_ptr, /* Pointer to the destination structure */ - ptr, size, /* Buffer and its size */ - 0 /* Default tag mode is 0 */ - ); + return type_descriptor->ber_decoder( + opt_codec_ctx, type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + ptr, size, /* Buffer and its size */ + 0 /* Default tag mode is 0 */ + ); } /* * Check the set of >> tags matches the definition. */ -asn_dec_rval_t -ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, - const void *ptr, size_t size, int tag_mode, int last_tag_form, - ber_tlv_len_t *last_length, int *opt_tlv_form) { +asn_dec_rval_t ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_struct_ctx_t *opt_ctx, const void *ptr, + size_t size, int tag_mode, int last_tag_form, + ber_tlv_len_t *last_length, int *opt_tlv_form) +{ ssize_t consumed_myself = 0; ssize_t tag_len; ssize_t len_len; @@ -73,15 +85,14 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, ber_tlv_len_t tlv_len; ber_tlv_len_t limit_len = -1; int expect_00_terminators = 0; - int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ - int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ + int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ + int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ int tagno; /* * Make sure we didn't exceed the maximum stack size. */ - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - RETURN(RC_FAIL); + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) RETURN(RC_FAIL); /* * So what does all this implicit skip stuff mean? @@ -90,7 +101,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, * B ::= [2] EXPLICIT T * Where T is defined as * T ::= [4] IMPLICIT SEQUENCE { ... } - * + * * Let's say, we are starting to decode type A, given the * following TLV stream: <5> <0>. What does this mean? * It means that the type A contains type T which is, @@ -105,176 +116,209 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, * it appropriately. */ - tagno = step /* Continuing where left previously */ - + (tag_mode==1?-1:0) - ; + tagno = step /* Continuing where left previously */ + + (tag_mode == 1 ? -1 : 0); ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", - td->name, (long)size, tag_mode, step, tagno); + td->name, (long)size, tag_mode, step, tagno); /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ - if(tag_mode == 0 && tagno == td->tags_count) { - /* - * This must be the _untagged_ ANY type, - * which outermost tag isn't known in advance. - * Fetch the tag and length separately. - */ - tag_len = ber_fetch_tag(ptr, size, &tlv_tag); - switch(tag_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - tlv_constr = BER_TLV_CONSTRUCTED(ptr); - len_len = ber_fetch_length(tlv_constr, - (const char *)ptr + tag_len, size - tag_len, &tlv_len); - switch(len_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - ASN_DEBUG("Advancing %ld in ANY case", - (tag_len + len_len)); - ADVANCE(tag_len + len_len); - } else { - assert(tagno < td->tags_count); /* At least one loop */ - } - for((void)tagno; tagno < td->tags_count; tagno++, step++) { - - /* - * Fetch and process T from TLV. - */ - tag_len = ber_fetch_tag(ptr, size, &tlv_tag); - ASN_DEBUG("Fetching tag from {%p,%ld}: " - "len %ld, step %d, tagno %d got %s", - ptr, (long)size, - (long)tag_len, step, tagno, - ber_tlv_tag_string(tlv_tag)); - switch(tag_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - tlv_constr = BER_TLV_CONSTRUCTED(ptr); - - /* - * If {I}, don't check anything. - * If {I,B,C}, check B and C unless we're at I. - */ - if(tag_mode != 0 && step == 0) { + if (tag_mode == 0 && tagno == td->tags_count) + { /* - * We don't expect tag to match here. - * It's just because we don't know how the tag - * is supposed to look like. + * This must be the _untagged_ ANY type, + * which outermost tag isn't known in advance. + * Fetch the tag and length separately. */ - } else { - assert(tagno >= 0); /* Guaranteed by the code above */ - if(tlv_tag != td->tags[tagno]) { - /* - * Unexpected tag. Too bad. - */ - ASN_DEBUG("Expected: %s, " - "expectation failed (tn=%d, tm=%d)", - ber_tlv_tag_string(td->tags[tagno]), - tagno, tag_mode - ); - RETURN(RC_FAIL); - } - } - - /* - * Attention: if there are more tags expected, - * ensure that the current tag is presented - * in constructed form (it contains other tags!). - * If this one is the last one, check that the tag form - * matches the one given in descriptor. - */ - if(tagno < (td->tags_count - 1)) { - if(tlv_constr == 0) { - ASN_DEBUG("tlv_constr = %d, expfail", - tlv_constr); - RETURN(RC_FAIL); - } - } else { - if(last_tag_form != tlv_constr - && last_tag_form != -1) { - ASN_DEBUG("last_tag_form %d != %d", - last_tag_form, tlv_constr); - RETURN(RC_FAIL); - } - } - - /* - * Fetch and process L from TLV. - */ - len_len = ber_fetch_length(tlv_constr, - (const char *)ptr + tag_len, size - tag_len, &tlv_len); - ASN_DEBUG("Fetchinig len = %ld", (long)len_len); - switch(len_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - /* - * FIXME - * As of today, the chain of tags - * must either contain several indefinite length TLVs, - * or several definite length ones. - * No mixing is allowed. - */ - if(tlv_len == -1) { - /* - * Indefinite length. - */ - if(limit_len == -1) { - expect_00_terminators++; - } else { - ASN_DEBUG("Unexpected indefinite length " - "in a chain of definite lengths"); - RETURN(RC_FAIL); - } + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + switch (tag_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, + size - tag_len, &tlv_len); + switch (len_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + ASN_DEBUG("Advancing %ld in ANY case", (tag_len + len_len)); ADVANCE(tag_len + len_len); - continue; - } else { - if(expect_00_terminators) { - ASN_DEBUG("Unexpected definite length " - "in a chain of indefinite lengths"); - RETURN(RC_FAIL); - } } - - /* - * Check that multiple TLVs specify ever decreasing length, - * which is consistent. - */ - if(limit_len == -1) { - limit_len = tlv_len + tag_len + len_len; - if(limit_len < 0) { - /* Too great tlv_len value? */ - RETURN(RC_FAIL); - } - } else if(limit_len != tlv_len + tag_len + len_len) { + else + { + assert(tagno < td->tags_count); /* At least one loop */ + } + for ((void)tagno; tagno < td->tags_count; tagno++, step++) + { /* - * Inner TLV specifies length which is inconsistent - * with the outer TLV's length value. + * Fetch and process T from TLV. */ - ASN_DEBUG("Outer TLV is %ld and inner is %ld", - (long)limit_len, (long)tlv_len); - RETURN(RC_FAIL); - } + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + ASN_DEBUG( + "Fetching tag from {%p,%ld}: " + "len %ld, step %d, tagno %d got %s", + ptr, (long)size, (long)tag_len, step, tagno, + ber_tlv_tag_string(tlv_tag)); + switch (tag_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } - ADVANCE(tag_len + len_len); + tlv_constr = BER_TLV_CONSTRUCTED(ptr); - limit_len -= (tag_len + len_len); - if((ssize_t)size > limit_len) { /* - * Make sure that we won't consume more bytes - * from the parent frame than the inferred limit. + * If {I}, don't check anything. + * If {I,B,C}, check B and C unless we're at I. */ - size = limit_len; - } - } + if (tag_mode != 0 && step == 0) + { + /* + * We don't expect tag to match here. + * It's just because we don't know how the tag + * is supposed to look like. + */ + } + else + { + assert(tagno >= 0); /* Guaranteed by the code above */ + if (tlv_tag != td->tags[tagno]) + { + /* + * Unexpected tag. Too bad. + */ + ASN_DEBUG( + "Expected: %s, " + "expectation failed (tn=%d, tm=%d)", + ber_tlv_tag_string(td->tags[tagno]), tagno, + tag_mode); + RETURN(RC_FAIL); + } + } - if(opt_tlv_form) - *opt_tlv_form = tlv_constr; - if(expect_00_terminators) + /* + * Attention: if there are more tags expected, + * ensure that the current tag is presented + * in constructed form (it contains other tags!). + * If this one is the last one, check that the tag form + * matches the one given in descriptor. + */ + if (tagno < (td->tags_count - 1)) + { + if (tlv_constr == 0) + { + ASN_DEBUG("tlv_constr = %d, expfail", tlv_constr); + RETURN(RC_FAIL); + } + } + else + { + if (last_tag_form != tlv_constr && last_tag_form != -1) + { + ASN_DEBUG("last_tag_form %d != %d", last_tag_form, + tlv_constr); + RETURN(RC_FAIL); + } + } + + /* + * Fetch and process L from TLV. + */ + len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, + size - tag_len, &tlv_len); + ASN_DEBUG("Fetchinig len = %ld", (long)len_len); + switch (len_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + + /* + * FIXME + * As of today, the chain of tags + * must either contain several indefinite length TLVs, + * or several definite length ones. + * No mixing is allowed. + */ + if (tlv_len == -1) + { + /* + * Indefinite length. + */ + if (limit_len == -1) + { + expect_00_terminators++; + } + else + { + ASN_DEBUG( + "Unexpected indefinite length " + "in a chain of definite lengths"); + RETURN(RC_FAIL); + } + ADVANCE(tag_len + len_len); + continue; + } + else + { + if (expect_00_terminators) + { + ASN_DEBUG( + "Unexpected definite length " + "in a chain of indefinite lengths"); + RETURN(RC_FAIL); + } + } + + /* + * Check that multiple TLVs specify ever decreasing length, + * which is consistent. + */ + if (limit_len == -1) + { + limit_len = tlv_len + tag_len + len_len; + if (limit_len < 0) + { + /* Too great tlv_len value? */ + RETURN(RC_FAIL); + } + } + else if (limit_len != tlv_len + tag_len + len_len) + { + /* + * Inner TLV specifies length which is inconsistent + * with the outer TLV's length value. + */ + ASN_DEBUG("Outer TLV is %ld and inner is %ld", + (long)limit_len, (long)tlv_len); + RETURN(RC_FAIL); + } + + ADVANCE(tag_len + len_len); + + limit_len -= (tag_len + len_len); + if ((ssize_t)size > limit_len) + { + /* + * Make sure that we won't consume more bytes + * from the parent frame than the inferred limit. + */ + size = limit_len; + } + } + + if (opt_tlv_form) *opt_tlv_form = tlv_constr; + if (expect_00_terminators) *last_length = -expect_00_terminators; else *last_length = tlv_len; diff --git a/src/core/libs/supl/asn-rrlp/ber_decoder.h b/src/core/libs/supl/asn-rrlp/ber_decoder.h index 6a87fc23f..8a7f77efa 100644 --- a/src/core/libs/supl/asn-rrlp/ber_decoder.h +++ b/src/core/libs/supl/asn-rrlp/ber_decoder.h @@ -16,11 +16,12 @@ extern "C" struct asn_codec_ctx_s; /* Forward declaration */ /* - * The BER decoder of any type. - * This function may be invoked directly from the application. - * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). - */ - asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, + * The BER decoder of any type. + * This function may be invoked directly from the application. + * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). + */ + asn_dec_rval_t ber_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ @@ -28,25 +29,25 @@ extern "C" ); /* - * Type of generic function which decodes the byte stream into the structure. - */ + * Type of generic function which decodes the byte stream into the + * structure. + */ typedef asn_dec_rval_t(ber_type_decoder_f)( struct asn_codec_ctx_s *opt_codec_ctx, - struct asn_TYPE_descriptor_s *type_descriptor, - void **struct_ptr, const void *buf_ptr, size_t size, - int tag_mode); + struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, + const void *buf_ptr, size_t size, int tag_mode); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Check that all tags correspond to the type definition (as given in head). - * On return, last_length would contain either a non-negative length of the - * value part of the last TLV, or the negative number of expected - * "end of content" sequences. The number may only be negative if the - * head->last_tag_form is non-zero. - */ + * Check that all tags correspond to the type definition (as given in head). + * On return, last_length would contain either a non-negative length of the + * value part of the last TLV, or the negative number of expected + * "end of content" sequences. The number may only be negative if the + * head->last_tag_form is non-zero. + */ asn_dec_rval_t ber_check_tags( struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ struct asn_TYPE_descriptor_s *type_descriptor, @@ -54,8 +55,7 @@ extern "C" const void *ptr, size_t size, int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ int last_tag_form, /* {-1,0:1}: any, primitive, constr */ - ber_tlv_len_t *last_length, - int *opt_tlv_form /* optional tag form */ + ber_tlv_len_t *last_length, int *opt_tlv_form /* optional tag form */ ); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_length.c b/src/core/libs/supl/asn-rrlp/ber_tlv_length.c index 2814fe1cc..9d6e2998d 100644 --- a/src/core/libs/supl/asn-rrlp/ber_tlv_length.c +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_length.c @@ -6,173 +6,176 @@ #include #include -ssize_t -ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, - ber_tlv_len_t *len_r) { +ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r) +{ const uint8_t *buf = (const uint8_t *)bufptr; unsigned oct; - if(size == 0) - return 0; /* Want more */ + if (size == 0) return 0; /* Want more */ oct = *buf; - if((oct & 0x80) == 0) { - /* - * Short definite length. - */ - *len_r = oct; /* & 0x7F */ - return 1; - } else { - ber_tlv_len_t len; - size_t skipped; - - if(_is_constructed && oct == 0x80) { - *len_r = -1; /* Indefinite length */ + if ((oct & 0x80) == 0) + { + /* + * Short definite length. + */ + *len_r = oct; /* & 0x7F */ return 1; } + else + { + ber_tlv_len_t len; + size_t skipped; - if(oct == 0xff) { - /* Reserved in standard for future use. */ - return -1; + if (_is_constructed && oct == 0x80) + { + *len_r = -1; /* Indefinite length */ + return 1; + } + + if (oct == 0xff) + { + /* Reserved in standard for future use. */ + return -1; + } + + oct &= 0x7F; /* Leave only the 7 LS bits */ + for (len = 0, buf++, skipped = 1; oct && (++skipped <= size); + buf++, oct--) + { + len = (len << 8) | *buf; + if (len < 0 || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) + { + /* + * Too large length value. + */ + return -1; + } + } + + if (oct == 0) + { + ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; + /* + * Here length may be very close or equal to 2G. + * However, the arithmetics used in some decoders + * may add some (small) quantities to the length, + * to check the resulting value against some limits. + * This may result in integer wrap-around, which + * we try to avoid by checking it earlier here. + */ + if (lenplusepsilon < 0) + { + /* Too large length value */ + return -1; + } + + *len_r = len; + return skipped; + } + + return 0; /* Want more */ } - - oct &= 0x7F; /* Leave only the 7 LS bits */ - for(len = 0, buf++, skipped = 1; - oct && (++skipped <= size); buf++, oct--) { - - len = (len << 8) | *buf; - if(len < 0 - || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { - /* - * Too large length value. - */ - return -1; - } - } - - if(oct == 0) { - ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; - /* - * Here length may be very close or equal to 2G. - * However, the arithmetics used in some decoders - * may add some (small) quantities to the length, - * to check the resulting value against some limits. - * This may result in integer wrap-around, which - * we try to avoid by checking it earlier here. - */ - if(lenplusepsilon < 0) { - /* Too large length value */ - return -1; - } - - *len_r = len; - return skipped; - } - - return 0; /* Want more */ - } - } -ssize_t -ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, - int _is_constructed, const void *ptr, size_t size) { - ber_tlv_len_t vlen; /* Length of V in TLV */ - ssize_t tl; /* Length of L in TLV */ - ssize_t ll; /* Length of L in TLV */ +ssize_t ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, int _is_constructed, + const void *ptr, size_t size) +{ + ber_tlv_len_t vlen; /* Length of V in TLV */ + ssize_t tl; /* Length of L in TLV */ + ssize_t ll; /* Length of L in TLV */ size_t skip; /* * Make sure we didn't exceed the maximum stack size. */ - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - return -1; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) return -1; /* * Determine the size of L in TLV. */ ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); - if(ll <= 0) return ll; + if (ll <= 0) return ll; /* * Definite length. */ - if(vlen >= 0) { - skip = ll + vlen; - if(skip > size) - return 0; /* Want more */ - return skip; - } + if (vlen >= 0) + { + skip = ll + vlen; + if (skip > size) return 0; /* Want more */ + return skip; + } /* * Indefinite length! */ ASN_DEBUG("Skipping indefinite length"); - for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { - ber_tlv_tag_t tag; + for (skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) + { + ber_tlv_tag_t tag; - /* Fetch the tag */ - tl = ber_fetch_tag(ptr, size, &tag); - if(tl <= 0) return tl; + /* Fetch the tag */ + tl = ber_fetch_tag(ptr, size, &tag); + if (tl <= 0) return tl; - ll = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - ((const char *)ptr) + tl, size - tl); - if(ll <= 0) return ll; + ll = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), + ((const char *)ptr) + tl, size - tl); + if (ll <= 0) return ll; - skip += tl + ll; + skip += tl + ll; - /* - * This may be the end of the indefinite length structure, - * two consecutive 0 octets. - * Check if it is true. - */ - if(((const uint8_t *)ptr)[0] == 0 - && ((const uint8_t *)ptr)[1] == 0) - return skip; + /* + * This may be the end of the indefinite length structure, + * two consecutive 0 octets. + * Check if it is true. + */ + if (((const uint8_t *)ptr)[0] == 0 && + ((const uint8_t *)ptr)[1] == 0) + return skip; - ptr = ((const char *)ptr) + tl + ll; - size -= tl + ll; - } + ptr = ((const char *)ptr) + tl + ll; + size -= tl + ll; + } /* UNREACHABLE */ } -size_t -der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { - size_t required_size; /* Size of len encoding */ +size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) +{ + size_t required_size; /* Size of len encoding */ uint8_t *buf = (uint8_t *)bufp; uint8_t *end; size_t i; - if(len <= 127) { - /* Encoded in 1 octet */ - if(size) *buf = (uint8_t)len; - return 1; - } + if (len <= 127) + { + /* Encoded in 1 octet */ + if (size) *buf = (uint8_t)len; + return 1; + } /* * Compute the size of the subsequent bytes. */ - for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { - if(len >> i) - required_size++; - else - break; - } + for (required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) + { + if (len >> i) + required_size++; + else + break; + } - if(size <= required_size) - return required_size + 1; + if (size <= required_size) return required_size + 1; - *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ + *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ /* * Produce the len encoding, space permitting. */ end = buf + required_size; - for(i -= 8; buf < end; i -= 8, buf++) - *buf = (uint8_t)(len >> i); + for (i -= 8; buf < end; i -= 8, buf++) *buf = (uint8_t)(len >> i); return required_size + 1; } - diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_length.h b/src/core/libs/supl/asn-rrlp/ber_tlv_length.h index b681ff323..9daae27af 100644 --- a/src/core/libs/supl/asn-rrlp/ber_tlv_length.h +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_length.h @@ -13,36 +13,37 @@ extern "C" typedef ssize_t ber_tlv_len_t; /* - * This function tries to fetch the length of the BER TLV value and place it - * in *len_r. - * RETURN VALUES: - * 0: More data expected than bufptr contains. - * -1: Fatal error deciphering length. - * >0: Number of bytes used from bufptr. - * On return with >0, len_r is constrained as -1..MAX, where -1 mean - * that the value is of indefinite length. - */ - ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, - ber_tlv_len_t *len_r); + * This function tries to fetch the length of the BER TLV value and place it + * in *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + * On return with >0, len_r is constrained as -1..MAX, where -1 mean + * that the value is of indefinite length. + */ + ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, + size_t size, ber_tlv_len_t *len_r); /* - * This function expects bufptr to be positioned over L in TLV. - * It returns number of bytes occupied by L and V together, suitable - * for skipping. The function properly handles indefinite length. - * RETURN VALUES: - * Standard {-1,0,>0} convention. - */ + * This function expects bufptr to be positioned over L in TLV. + * It returns number of bytes occupied by L and V together, suitable + * for skipping. The function properly handles indefinite length. + * RETURN VALUES: + * Standard {-1,0,>0} convention. + */ ssize_t ber_skip_length( struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ int _is_constructed, const void *bufptr, size_t size); /* - * This function serializes the length (L from TLV) in DER format. - * It always returns number of bytes necessary to represent the length, - * it is a caller's responsibility to check the return value - * against the supplied buffer's size. - */ - size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); + * This function serializes the length (L from TLV) in DER format. + * It always returns number of bytes necessary to represent the length, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ + size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, + size_t size); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c index 9c587df34..2de303992 100644 --- a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c @@ -6,92 +6,105 @@ #include #include -ssize_t -ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { +ssize_t ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) +{ ber_tlv_tag_t val; ber_tlv_tag_t tclass; size_t skipped; - if(size == 0) - return 0; + if (size == 0) return 0; val = *(const uint8_t *)ptr; tclass = (val >> 6); - if((val &= 0x1F) != 0x1F) { - /* - * Simple form: everything encoded in a single octet. - * Tag Class is encoded using two least significant bits. - */ - *tag_r = (val << 2) | tclass; - return 1; - } + if ((val &= 0x1F) != 0x1F) + { + /* + * Simple form: everything encoded in a single octet. + * Tag Class is encoded using two least significant bits. + */ + *tag_r = (val << 2) | tclass; + return 1; + } /* * Each octet contains 7 bits of useful information. * The MSB is 0 if it is the last octet of the tag. */ - for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; - skipped <= size; - ptr = ((const char *)ptr) + 1, skipped++) { - unsigned int oct = *(const uint8_t *)ptr; - if(oct & 0x80) { - val = (val << 7) | (oct & 0x7F); - /* - * Make sure there are at least 9 bits spare - * at the MS side of a value. - */ - if(val >> ((8 * sizeof(val)) - 9)) { - /* - * We would not be able to accommodate - * any more tag bits. - */ - return -1; - } - } else { - val = (val << 7) | oct; - *tag_r = (val << 2) | tclass; - return skipped; + for (val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; skipped <= size; + ptr = ((const char *)ptr) + 1, skipped++) + { + unsigned int oct = *(const uint8_t *)ptr; + if (oct & 0x80) + { + val = (val << 7) | (oct & 0x7F); + /* + * Make sure there are at least 9 bits spare + * at the MS side of a value. + */ + if (val >> ((8 * sizeof(val)) - 9)) + { + /* + * We would not be able to accommodate + * any more tag bits. + */ + return -1; + } + } + else + { + val = (val << 7) | oct; + *tag_r = (val << 2) | tclass; + return skipped; + } } - } - return 0; /* Want more */ + return 0; /* Want more */ } - -ssize_t -ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { +ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) +{ char buf[sizeof("[APPLICATION ]") + 32]; ssize_t ret; ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); - if(ret >= (ssize_t)sizeof(buf) || ret < 2) { - errno = EPERM; - return -1; - } + if (ret >= (ssize_t)sizeof(buf) || ret < 2) + { + errno = EPERM; + return -1; + } return fwrite(buf, 1, ret, f); } -ssize_t -ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { +ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) +{ char *type = 0; int ret; - switch(tag & 0x3) { - case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; - case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; - case ASN_TAG_CLASS_CONTEXT: type = ""; break; - case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; - } + switch (tag & 0x3) + { + case ASN_TAG_CLASS_UNIVERSAL: + type = "UNIVERSAL "; + break; + case ASN_TAG_CLASS_APPLICATION: + type = "APPLICATION "; + break; + case ASN_TAG_CLASS_CONTEXT: + type = ""; + break; + case ASN_TAG_CLASS_PRIVATE: + type = "PRIVATE "; + break; + } ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); - if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ + if (ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ return ret; } -char * -ber_tlv_tag_string(ber_tlv_tag_t tag) { +char *ber_tlv_tag_string(ber_tlv_tag_t tag) +{ static char buf[sizeof("[APPLICATION ]") + 32]; (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); @@ -99,9 +112,8 @@ ber_tlv_tag_string(ber_tlv_tag_t tag) { return buf; } - -size_t -ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { +size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) +{ int tclass = BER_TAG_CLASS(tag); ber_tlv_tag_t tval = BER_TAG_VALUE(tag); uint8_t *buf = (uint8_t *)bufp; @@ -109,35 +121,37 @@ ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { size_t required_size; size_t i; - if(tval <= 30) { - /* Encoded in 1 octet */ - if(size) buf[0] = (tclass << 6) | tval; - return 1; - } else if(size) { - *buf++ = (tclass << 6) | 0x1F; - size--; - } + if (tval <= 30) + { + /* Encoded in 1 octet */ + if (size) buf[0] = (tclass << 6) | tval; + return 1; + } + else if (size) + { + *buf++ = (tclass << 6) | 0x1F; + size--; + } /* * Compute the size of the subsequent bytes. */ - for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { - if(tval >> i) - required_size++; - else - break; - } + for (required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) + { + if (tval >> i) + required_size++; + else + break; + } - if(size < required_size) - return required_size + 1; + if (size < required_size) return required_size + 1; /* * Fill in the buffer, space permitting. */ end = buf + required_size - 1; - for(i -= 7; buf < end; i -= 7, buf++) - *buf = 0x80 | ((tval >> i) & 0x7F); - *buf = (tval & 0x7F); /* Last octet without high bit */ + for (i -= 7; buf < end; i -= 7, buf++) *buf = 0x80 | ((tval >> i) & 0x7F); + *buf = (tval & 0x7F); /* Last octet without high bit */ return required_size + 1; } diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h index f7892fc1c..0693688c6 100644 --- a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.h @@ -24,35 +24,36 @@ extern "C" */ #define BER_TAG_CLASS(tag) ((tag)&0x3) #define BER_TAG_VALUE(tag) ((tag) >> 2) -#define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr) & 0x20) ? 1 : 0) +#define BER_TLV_CONSTRUCTED(tagptr) \ + (((*(const uint8_t *)tagptr) & 0x20) ? 1 : 0) #define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) /* - * Several functions for printing the TAG in the canonical form - * (i.e. "[PRIVATE 0]"). - * Return values correspond to their libc counterparts (if any). - */ + * Several functions for printing the TAG in the canonical form + * (i.e. "[PRIVATE 0]"). + * Return values correspond to their libc counterparts (if any). + */ ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); char *ber_tlv_tag_string(ber_tlv_tag_t tag); + /* + * This function tries to fetch the tag from the input stream. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering tag. + * >0: Number of bytes used from bufptr. tag_r will contain the tag. + */ + ssize_t ber_fetch_tag(const void *bufptr, size_t size, + ber_tlv_tag_t *tag_r); /* - * This function tries to fetch the tag from the input stream. - * RETURN VALUES: - * 0: More data expected than bufptr contains. - * -1: Fatal error deciphering tag. - * >0: Number of bytes used from bufptr. tag_r will contain the tag. - */ - ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); - - /* - * This function serializes the tag (T from TLV) in BER format. - * It always returns number of bytes necessary to represent the tag, - * it is a caller's responsibility to check the return value - * against the supplied buffer's size. - */ + * This function serializes the tag (T from TLV) in BER format. + * It always returns number of bytes necessary to represent the tag, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c index 82d4db700..62682ab72 100644 --- a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,81 +25,96 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) +#undef NEXT_PHASE +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * See the definitions. */ -static int _fetch_present_idx(const void *struct_ptr, int pres_offset, int size); +static int _fetch_present_idx(const void *struct_ptr, int pres_offset, + int size); static void _set_present_idx(void *struct_ptr, int offset, int size, int pres); /* * Tags are canonically sorted in the tag to member table. */ -static int -_search4tag(const void *ap, const void *bp) { +static int _search4tag(const void *ap, const void *bp) +{ const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); - if(a_class == b_class) { - ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); - ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + if (a_class == b_class) + { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); - if(a_value == b_value) - return 0; - else if(a_value < b_value) + if (a_value == b_value) + return 0; + else if (a_value < b_value) + return -1; + else + return 1; + } + else if (a_class < b_class) + { return -1; - else + } + else + { return 1; - } else if(a_class < b_class) { - return -1; - } else { - return 1; - } + } } /* * The decoder of the CHOICE type. */ -asn_dec_rval_t -CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ @@ -109,26 +124,28 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - ssize_t tag_len; /* Length of TLV's T */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + ssize_t tag_len; /* Length of TLV's T */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as CHOICE", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -138,415 +155,487 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - if(tag_mode || td->tags_count) { - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, -1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) { - /* ?Subtracted below! */ - ctx->left += rval.consumed; - } - ADVANCE(rval.consumed); - } else { - ctx->left = -1; - } - - NEXT_PHASE(ctx); - - ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", - (long)ctx->left, (long)size); - - /* Fall through */ - case 1: - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - do { - asn_TYPE_tag2member_t *t2m; - asn_TYPE_tag2member_t key; - - key.el_tag = tlv_tag; - t2m = (asn_TYPE_tag2member_t *)bsearch(&key, - specs->tag2el, specs->tag2el_count, - sizeof(specs->tag2el[0]), _search4tag); - if(t2m) { + switch (ctx->phase) + { + case 0: /* - * Found the element corresponding to the tag. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ + + if (tag_mode || td->tags_count) + { + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, -1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if (ctx->left >= 0) + { + /* ?Subtracted below! */ + ctx->left += rval.consumed; + } + ADVANCE(rval.consumed); + } + else + { + ctx->left = -1; + } + NEXT_PHASE(ctx); - ctx->step = t2m->el_no; - break; - } else if(specs->ext_start == -1) { - ASN_DEBUG("Unexpected tag %s " - "in non-extensible CHOICE %s", - ber_tlv_tag_string(tlv_tag), td->name); - RETURN(RC_FAIL); - } else { - /* Skip this tag */ - ssize_t skip; - ASN_DEBUG("Skipping unknown tag %s", - ber_tlv_tag_string(tlv_tag)); + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); - skip = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tag_len, - LEFT - tag_len); - - switch(skip) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - ADVANCE(skip + tag_len); - RETURN(RC_OK); - } - } while(0); - - case 2: - /* - * PHASE 2. - * Read in the element. - */ - do { - asn_TYPE_member_t *elm;/* CHOICE's element */ - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - - elm = &elements[ctx->step]; - - /* - * Compute the position of the member inside a structure, - * and also a type of containment (it may be contained - * as pointer or using inline inclusion). - */ - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - /* - * A pointer to a pointer - * holding the start of the structure - */ - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - /* Set presence to be able to free it properly at any time */ - _set_present_idx(st, specs->pres_offset, - specs->pres_size, ctx->step + 1); - /* - * Invoke the member fetch routine according to member's type - */ - rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, - memb_ptr2, ptr, LEFT, elm->tag_mode); - switch(rval.code) { - case RC_OK: - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { - ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - RETURN(RC_FAIL); - case RC_FAIL: /* Fatal error */ - RETURN(rval.code); - } /* switch(rval) */ - - ADVANCE(rval.consumed); - } while(0); - - NEXT_PHASE(ctx); - - /* Fall through */ - case 3: - ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", - td->name, (long)ctx->left, (long)size, - tag_mode, td->tags_count); - - if(ctx->left > 0) { - /* - * The type must be fully decoded - * by the CHOICE member-specific decoder. - */ - RETURN(RC_FAIL); - } - - if(ctx->left == -1 - && !(tag_mode || td->tags_count)) { - /* - * This is an untagged CHOICE. - * It doesn't contain nothing - * except for the member itself, including all its tags. - * The decoding is completed. - */ - NEXT_PHASE(ctx); - break; - } - - /* - * Read in the "end of data chunks"'s. - */ - while(ctx->left < 0) { - ssize_t tl; - - tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tl) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ - case -1: RETURN(RC_FAIL); - } + case 1: + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } - /* - * Expected <0><0>... - */ - if(((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) + do + { + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + + key.el_tag = tlv_tag; + t2m = (asn_TYPE_tag2member_t *)bsearch( + &key, specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _search4tag); + if (t2m) + { + /* + * Found the element corresponding to the tag. + */ + NEXT_PHASE(ctx); + ctx->step = t2m->el_no; + break; + } + else if (specs->ext_start == -1) + { + ASN_DEBUG( + "Unexpected tag %s " + "in non-extensible CHOICE %s", + ber_tlv_tag_string(tlv_tag), td->name); + RETURN(RC_FAIL); + } + else + { + /* Skip this tag */ + ssize_t skip; + + ASN_DEBUG("Skipping unknown tag %s", + ber_tlv_tag_string(tlv_tag)); + + skip = ber_skip_length( + opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + + switch (skip) + { + case 0: + if (!SIZE_VIOLATION) + RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + RETURN(RC_OK); + } + } + while (0); + + case 2: + /* + * PHASE 2. + * Read in the element. + */ + do + { + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &elements[ctx->step]; + + /* + * Compute the position of the member inside a + * structure, and also a type of containment (it may be + * contained as pointer or using inline inclusion). + */ + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + /* Set presence to be able to free it properly at any + * time */ + _set_present_idx(st, specs->pres_offset, + specs->pres_size, ctx->step + 1); + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + memb_ptr2, ptr, LEFT, + elm->tag_mode); + switch (rval.code) + { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + RETURN(RC_FAIL); + case RC_FAIL: /* Fatal error */ + RETURN(rval.code); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } + while (0); + + NEXT_PHASE(ctx); + + /* Fall through */ + case 3: + ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", + td->name, (long)ctx->left, (long)size, tag_mode, + td->tags_count); + + if (ctx->left > 0) + { + /* + * The type must be fully decoded + * by the CHOICE member-specific decoder. + */ RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - /* - * Correctly finished with <0><0>. - */ - ADVANCE(2); - ctx->left++; - continue; - } - } else { - ASN_DEBUG("Unexpected continuation in %s", - td->name); - RETURN(RC_FAIL); - } + } - /* UNREACHABLE */ + if (ctx->left == -1 && !(tag_mode || td->tags_count)) + { + /* + * This is an untagged CHOICE. + * It doesn't contain nothing + * except for the member itself, including all its tags. + * The decoding is completed. + */ + NEXT_PHASE(ctx); + break; + } + + /* + * Read in the "end of data chunks"'s. + */ + while (ctx->left < 0) + { + ssize_t tl; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tl) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + /* + * Expected <0><0>... + */ + if (((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + continue; + } + } + else + { + ASN_DEBUG("Unexpected continuation in %s", + td->name); + RETURN(RC_FAIL); + } + + /* UNREACHABLE */ + } + + NEXT_PHASE(ctx); + case 4: + /* No meaningful work here */ + break; } - NEXT_PHASE(ctx); - case 4: - /* No meaningful work here */ - break; - } - RETURN(RC_OK); } -asn_enc_rval_t -CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; - asn_TYPE_member_t *elm; /* CHOICE element */ + asn_TYPE_member_t *elm; /* CHOICE element */ asn_enc_rval_t erval; void *memb_ptr; size_t computed_size = 0; int present; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; - ASN_DEBUG("%s %s as CHOICE", - cb?"Encoding":"Estimating", td->name); + ASN_DEBUG("%s %s as CHOICE", cb ? "Encoding" : "Estimating", td->name); - present = _fetch_present_idx(sptr, - specs->pres_offset, specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized, it cannot be encoded: * can't deduce what to encode in the choice type. */ - if(present <= 0 || present > td->elements_count) { - if(present == 0 && td->elements_count == 0) { - /* The CHOICE is empty?! */ - erval.encoded = 0; - _ASN_ENCODED_OK(erval); + if (present <= 0 || present > td->elements_count) + { + if (present == 0 && td->elements_count == 0) + { + /* The CHOICE is empty?! */ + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + _ASN_ENCODE_FAILED; } - _ASN_ENCODE_FAILED; - } /* * Seek over the present member of the structure. */ - elm = &td->elements[present-1]; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(memb_ptr == 0) { - if(elm->optional) { - erval.encoded = 0; - _ASN_ENCODED_OK(erval); - } - /* Mandatory element absent */ - _ASN_ENCODE_FAILED; + elm = &td->elements[present - 1]; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (memb_ptr == 0) + { + if (elm->optional) + { + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + /* Mandatory element absent */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - } /* * If the CHOICE itself is tagged EXPLICIT: * T ::= [2] EXPLICIT CHOICE { ... } * Then emit the appropriate tags. */ - if(tag_mode == 1 || td->tags_count) { - /* - * For this, we need to pre-compute the member. - */ - ssize_t ret; + if (tag_mode == 1 || td->tags_count) + { + /* + * For this, we need to pre-compute the member. + */ + ssize_t ret; - /* Encode member with its tag */ - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, 0, 0); - if(erval.encoded == -1) - return erval; + /* Encode member with its tag */ + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, + elm->tag, 0, 0); + if (erval.encoded == -1) return erval; - /* Encode CHOICE with parent or my own tag */ - ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, - cb, app_key); - if(ret == -1) - _ASN_ENCODE_FAILED; - computed_size += ret; - } + /* Encode CHOICE with parent or my own tag */ + ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, cb, + app_key); + if (ret == -1) _ASN_ENCODE_FAILED; + computed_size += ret; + } /* * Encode the single underlying member. */ - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, cb, app_key); - if(erval.encoded == -1) - return erval; + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, + cb, app_key); + if (erval.encoded == -1) return erval; - ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", - (long)erval.encoded, (long)computed_size); + ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", (long)erval.encoded, + (long)computed_size); erval.encoded += computed_size; return erval; } -ber_tlv_tag_t -CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { +ber_tlv_tag_t CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, + int tag_mode, ber_tlv_tag_t tag) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - assert(tag_mode == 0); (void)tag_mode; - assert(tag == 0); (void)tag; + assert(tag_mode == 0); + (void)tag_mode; + assert(tag == 0); + (void)tag; /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); - if(present > 0 || present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + if (present > 0 || present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *) - ((const char *)ptr + elm->memb_offset); - } else { - memb_ptr = (const void *) - ((const char *)ptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)ptr + + elm->memb_offset); + } + else + { + memb_ptr = + (const void *)((const char *)ptr + elm->memb_offset); + } + + return asn_TYPE_outmost_tag(elm->type, memb_ptr, elm->tag_mode, + elm->tag); + } + else + { + return (ber_tlv_tag_t)-1; } - - return asn_TYPE_outmost_tag(elm->type, memb_ptr, - elm->tag_mode, elm->tag); - } else { - return (ber_tlv_tag_t)-1; - } } -int -CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - return 0; - _ASN_CTFAIL(app_key, td, sptr, - "%s: mandatory CHOICE element %s absent (%s:%d)", - td->name, elm->name, __FILE__, __LINE__); - return -1; - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); - } + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) return 0; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory CHOICE element %s " + "absent (%s:%d)", + td->name, elm->name, __FILE__, + __LINE__); + return -1; + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } - if(elm->memb_constraints) { - return elm->memb_constraints(elm->type, memb_ptr, - ctfailcb, app_key); - } else { - int ret = elm->type->check_constraints(elm->type, - memb_ptr, ctfailcb, app_key); - /* - * Cannot inherit it eralier: - * need to make sure we get the updated version. - */ - elm->memb_constraints = elm->type->check_constraints; - return ret; + if (elm->memb_constraints) + { + return elm->memb_constraints(elm->type, memb_ptr, ctfailcb, + app_key); + } + else + { + int ret = elm->type->check_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + return ret; + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: no CHOICE element given (%s:%d)", td->name, + __FILE__, __LINE__); + return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: no CHOICE element given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } } -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ @@ -556,27 +645,28 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value of a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* Element index */ + asn_dec_rval_t rval; /* Return value of a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - if(ctx->phase == 0 && !*xml_tag) - ctx->phase = 1; /* Skip the outer tag checking phase */ + if (ctx->phase == 0 && !*xml_tag) + ctx->phase = 1; /* Skip the outer tag checking phase */ /* * Phases of XER/XML processing: @@ -587,453 +677,502 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 4: Skipping unknown extensions. * Phase 5: PHASED OUT */ - for(edx = ctx->step; ctx->phase <= 4;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ - asn_TYPE_member_t *elm; - - /* - * Go inside the member. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - - elm = &td->elements[edx]; - - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - - /* Start/Continue decoding the inner member */ - tmprval = elm->type->xer_decoder(opt_codec_ctx, - elm->type, memb_ptr2, elm->name, - buf_ptr, size); - XER_ADVANCE(tmprval.consumed); - ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", - elm->type->name, tmprval.code); - if(tmprval.code != RC_OK) - RETURN(tmprval.code); - assert(_fetch_present_idx(st, - specs->pres_offset, specs->pres_size) == 0); - /* Record what we've got */ - _set_present_idx(st, - specs->pres_offset, specs->pres_size, edx + 1); - ctx->phase = 3; - /* Fall through */ - } - - /* No need to wait for closing tag; special mode. */ - if(ctx->phase == 3 && !*xml_tag) { - ctx->phase = 5; /* Phase out */ - RETURN(RC_OK); - } - - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", - ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', - ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', - ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', - ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', - xml_tag, tcv); - - /* Skip the extensions section */ - if(ctx->phase == 4) { - ASN_DEBUG("skip_unknown(%d, %ld)", - tcv, (long)ctx->left); - switch(xer_skip_unknown(tcv, &ctx->left)) { - case -1: - ctx->phase = 5; - RETURN(RC_FAIL); - continue; - case 1: - ctx->phase = 3; - /* Fall through */ - case 0: - XER_ADVANCE(ch_size); - continue; - case 2: - ctx->phase = 3; - break; - } - } - - switch(tcv) { - case XCT_BOTH: - break; /* No CHOICE? */ - case XCT_CLOSING: - if(ctx->phase != 3) - break; - XER_ADVANCE(ch_size); - ctx->phase = 5; /* Phase out */ - RETURN(RC_OK); - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - - if(ctx->phase != 1) - break; /* Really unexpected */ + for (edx = ctx->step; ctx->phase <= 4;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; /* - * Search which inner member corresponds to this tag. + * Go inside the member. */ - for(edx = 0; edx < td->elements_count; edx++) { - elm = &td->elements[edx]; - tcv = xer_check_tag(buf_ptr,ch_size,elm->name); - switch(tcv) { - case XCT_BOTH: - case XCT_OPENING: - /* - * Process this member. - */ - ctx->step = edx; - ctx->phase = 2; - break; - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - continue; - default: - edx = td->elements_count; - break; /* Phase out */ - } - break; - } - if(edx != td->elements_count) - continue; + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - /* It is expected extension */ - if(specs->ext_start != -1) { - ASN_DEBUG("Got anticipated extension"); - /* - * Check for (XCT_BOTH or XCT_UNKNOWN_BO) - * By using a mask. Only record a pure - * tags. - */ - if(tcv & XCT_CLOSING) { - /* Found without body */ - ctx->phase = 3; /* Terminating */ - } else { - ctx->left = 1; - ctx->phase = 4; /* Skip ...'s */ - } - XER_ADVANCE(ch_size); - continue; - } + elm = &td->elements[edx]; - /* Fall through */ - default: + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Start/Continue decoding the inner member */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, + memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", elm->type->name, + tmprval.code); + if (tmprval.code != RC_OK) RETURN(tmprval.code); + assert(_fetch_present_idx(st, specs->pres_offset, + specs->pres_size) == 0); + /* Record what we've got */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, + edx + 1); + ctx->phase = 3; + /* Fall through */ + } + + /* No need to wait for closing tag; special mode. */ + if (ctx->phase == 3 && !*xml_tag) + { + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", + ch_size > 0 ? ((const uint8_t *)buf_ptr)[0] : '?', + ch_size > 1 ? ((const uint8_t *)buf_ptr)[1] : '?', + ch_size > 2 ? ((const uint8_t *)buf_ptr)[2] : '?', + ch_size > 3 ? ((const uint8_t *)buf_ptr)[3] : '?', + xml_tag, tcv); + + /* Skip the extensions section */ + if (ctx->phase == 4) + { + ASN_DEBUG("skip_unknown(%d, %ld)", tcv, (long)ctx->left); + switch (xer_skip_unknown(tcv, &ctx->left)) + { + case -1: + ctx->phase = 5; + RETURN(RC_FAIL); + continue; + case 1: + ctx->phase = 3; + /* Fall through */ + case 0: + XER_ADVANCE(ch_size); + continue; + case 2: + ctx->phase = 3; + break; + } + } + + switch (tcv) + { + case XCT_BOTH: + break; /* No CHOICE? */ + case XCT_CLOSING: + if (ctx->phase != 3) break; + XER_ADVANCE(ch_size); + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + if (ctx->phase != 1) break; /* Really unexpected */ + + /* + * Search which inner member corresponds to this tag. + */ + for (edx = 0; edx < td->elements_count; edx++) + { + elm = &td->elements[edx]; + tcv = + xer_check_tag(buf_ptr, ch_size, elm->name); + switch (tcv) + { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + edx = td->elements_count; + break; /* Phase out */ + } + break; + } + if (edx != td->elements_count) continue; + + /* It is expected extension */ + if (specs->ext_start != -1) + { + ASN_DEBUG("Got anticipated extension"); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if (tcv & XCT_CLOSING) + { + /* Found without body */ + ctx->phase = 3; /* Terminating */ + } + else + { + ctx->left = 1; + ctx->phase = 4; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG( + "Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" + " (ph=%d, tag=%s)", + ch_size > 0 ? ((const uint8_t *)buf_ptr)[0] : '?', + ch_size > 1 ? ((const uint8_t *)buf_ptr)[1] : '?', + ch_size > 2 ? ((const uint8_t *)buf_ptr)[2] : '?', + ch_size > 3 ? ((const uint8_t *)buf_ptr)[3] : '?', td->name, + ctx->phase, xml_tag); break; } - ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" - " (ph=%d, tag=%s)", - ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', - ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', - ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', - ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', - td->name, ctx->phase, xml_tag); - break; - } - - ctx->phase = 5; /* Phase out, just in case */ + ctx->phase = 5; /* Phase out, just in case */ RETURN(RC_FAIL); } - -asn_enc_rval_t -CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; +asn_enc_rval_t CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_enc_rval_t er; int present; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); - if(present <= 0 || present > td->elements_count) { - _ASN_ENCODE_FAILED; - } else { - asn_enc_rval_t tmper; - asn_TYPE_member_t *elm = &td->elements[present-1]; - void *memb_ptr; - const char *mname = elm->name; - unsigned int mlen = strlen(mname); + if (present <= 0 || present > td->elements_count) + { + _ASN_ENCODE_FAILED; + } + else + { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[present - 1]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) _ASN_ENCODE_FAILED; - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) _ASN_ENCODE_FAILED; + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + er.encoded = 0; + + if (!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + + er.encoded += 5 + (2 * mlen) + tmper.encoded; } - er.encoded = 0; - - if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - - _ASN_CALLBACK3("", 1); - - er.encoded += 5 + (2 * mlen) + tmper.encoded; - } - - if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -asn_dec_rval_t -CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_dec_rval_t rv; asn_per_constraint_t *ct; - asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_TYPE_member_t *elm; /* CHOICE's element */ void *memb_ptr; void **memb_ptr2; void *st = *sptr; int value; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; /* * Create the target structure if it is not present already. */ - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else ct = 0; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + ct = 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - value = per_get_few_bits(pd, 1); - if(value < 0) _ASN_DECODE_STARVED; - if(value) ct = 0; /* Not restricted */ - } + if (ct && ct->flags & APC_EXTENSIBLE) + { + value = per_get_few_bits(pd, 1); + if (value < 0) _ASN_DECODE_STARVED; + if (value) ct = 0; /* Not restricted */ + } - if(ct && ct->range_bits >= 0) { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - ASN_DEBUG("CHOICE %s got index %d in range %d", - td->name, value, ct->range_bits); - if(value > ct->upper_bound) - _ASN_DECODE_FAILED; - } else { - if(specs->ext_start == -1) - _ASN_DECODE_FAILED; - value = uper_get_nsnnwn(pd); - if(value < 0) _ASN_DECODE_STARVED; - value += specs->ext_start; - if(value >= td->elements_count) - _ASN_DECODE_FAILED; - } + if (ct && ct->range_bits >= 0) + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", td->name, value, + ct->range_bits); + if (value > ct->upper_bound) _ASN_DECODE_FAILED; + } + else + { + if (specs->ext_start == -1) _ASN_DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if (value < 0) _ASN_DECODE_STARVED; + value += specs->ext_start; + if (value >= td->elements_count) _ASN_DECODE_FAILED; + } /* Adjust if canonical order is different from natural order */ - if(specs->canonical_order) - value = specs->canonical_order[value]; + if (specs->canonical_order) value = specs->canonical_order[value]; /* Set presence to be able to free it later */ _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); elm = &td->elements[value]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); - if(ct && ct->range_bits >= 0) { - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - } else { - rv = uper_open_type_get(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - } + if (ct && ct->range_bits >= 0) + { + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + else + { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } - if(rv.code != RC_OK) - ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", - elm->name, td->name, rv.code); + if (rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, + rv.code); return rv; } -asn_enc_rval_t -CHOICE_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; - asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_TYPE_member_t *elm; /* CHOICE's element */ asn_per_constraint_t *ct; void *memb_ptr; int present; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; ASN_DEBUG("Encoding %s as CHOICE", td->name); - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else ct = 0; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + ct = 0; - present = _fetch_present_idx(sptr, - specs->pres_offset, specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized properly, it cannot be encoded: * can't deduce what to encode in the choice type. */ - if(present <= 0 || present > td->elements_count) + if (present <= 0 || present > td->elements_count) _ASN_ENCODE_FAILED; else present--; /* Adjust if canonical order is different from natural order */ - if(specs->canonical_order) - present = specs->canonical_order[present]; + if (specs->canonical_order) present = specs->canonical_order[present]; ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); - if(ct && ct->range_bits >= 0) { - if(present < ct->lower_bound - || present > ct->upper_bound) { - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, 1, 1)) - _ASN_ENCODE_FAILED; - } else { - _ASN_ENCODE_FAILED; - } - ct = 0; + if (ct && ct->range_bits >= 0) + { + if (present < ct->lower_bound || present > ct->upper_bound) + { + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, 1, 1)) _ASN_ENCODE_FAILED; + } + else + { + _ASN_ENCODE_FAILED; + } + ct = 0; + } } - } - if(ct && ct->flags & APC_EXTENSIBLE) - if(per_put_few_bits(po, 0, 1)) - _ASN_ENCODE_FAILED; + if (ct && ct->flags & APC_EXTENSIBLE) + if (per_put_few_bits(po, 0, 1)) _ASN_ENCODE_FAILED; elm = &td->elements[present]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) _ASN_ENCODE_FAILED; - } else { - memb_ptr = (char *)sptr + elm->memb_offset; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) _ASN_ENCODE_FAILED; + } + else + { + memb_ptr = (char *)sptr + elm->memb_offset; + } - if(ct && ct->range_bits >= 0) { - if(per_put_few_bits(po, present, ct->range_bits)) - _ASN_ENCODE_FAILED; + if (ct && ct->range_bits >= 0) + { + if (per_put_few_bits(po, present, ct->range_bits)) + _ASN_ENCODE_FAILED; - return elm->type->uper_encoder(elm->type, elm->per_constraints, - memb_ptr, po); - } else { - asn_enc_rval_t rval; - if(specs->ext_start == -1) - _ASN_ENCODE_FAILED; - if(uper_put_nsnnwn(po, present - specs->ext_start)) - _ASN_ENCODE_FAILED; - if(uper_open_type_put(elm->type, elm->per_constraints, - memb_ptr, po)) - _ASN_ENCODE_FAILED; - rval.encoded = 0; - _ASN_ENCODED_OK(rval); - } + return elm->type->uper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } + else + { + asn_enc_rval_t rval; + if (specs->ext_start == -1) _ASN_ENCODE_FAILED; + if (uper_put_nsnnwn(po, present - specs->ext_start)) + _ASN_ENCODE_FAILED; + if (uper_open_type_put(elm->type, elm->per_constraints, memb_ptr, + po)) + _ASN_ENCODE_FAILED; + rval.encoded = 0; + _ASN_ENCODED_OK(rval); + } } - -int -CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * Print that element. */ - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + return (cb("", 8, app_key) < 0) ? -1 : 0; + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Print member's name and stuff */ + if (0) + { + if (cb(elm->name, strlen(elm->name), app_key) < 0 || + cb(": ", 2, app_key) < 0) + return -1; + } + + return elm->type->print_struct(elm->type, memb_ptr, ilevel, cb, + app_key); } - - /* Print member's name and stuff */ - if(0) { - if(cb(elm->name, strlen(elm->name), app_key) < 0 - || cb(": ", 2, app_key) < 0) - return -1; + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; } - - return elm->type->print_struct(elm->type, memb_ptr, ilevel, - cb, app_key); - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } } -void -CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { +void CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!td || !ptr) - return; + if (!td || !ptr) return; ASN_DEBUG("Freeing %s as CHOICE", td->name); @@ -1045,26 +1184,29 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { /* * Free that element. */ - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - void *memb_ptr; + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)ptr + elm->memb_offset); - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); - } else { - memb_ptr = (void *)((char *)ptr + elm->memb_offset); - ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)ptr + elm->memb_offset); + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + else + { + memb_ptr = (void *)((char *)ptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } } - } - if(!contents_only) { - FREEMEM(ptr); - } + if (!contents_only) + { + FREEMEM(ptr); + } } - /* * The following functions functions offer protection against -fshort-enums, * compatible with little- and big-endian machines. @@ -1074,37 +1216,53 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { * is guaranteed to be aligned properly. ASN.1 compiler itself does not * produce packed code. */ -static int -_fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { +static int _fetch_present_idx(const void *struct_ptr, int pres_offset, + int pres_size) +{ const void *present_ptr; int present; present_ptr = ((const char *)struct_ptr) + pres_offset; - switch(pres_size) { - case sizeof(int): present = *(const int *)present_ptr; break; - case sizeof(short): present = *(const short *)present_ptr; break; - case sizeof(char): present = *(const char *)present_ptr; break; - default: - /* ANSI C mandates enum to be equivalent to integer */ - assert(pres_size != sizeof(int)); - return 0; /* If not aborted, pass back safe value */ - } + switch (pres_size) + { + case sizeof(int): + present = *(const int *)present_ptr; + break; + case sizeof(short): + present = *(const short *)present_ptr; + break; + case sizeof(char): + present = *(const char *)present_ptr; + break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + return 0; /* If not aborted, pass back safe value */ + } return present; } -static void -_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { +static void _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, + int present) +{ void *present_ptr; present_ptr = ((char *)struct_ptr) + pres_offset; - switch(pres_size) { - case sizeof(int): *(int *)present_ptr = present; break; - case sizeof(short): *(short *)present_ptr = present; break; - case sizeof(char): *(char *)present_ptr = present; break; - default: - /* ANSI C mandates enum to be equivalent to integer */ - assert(pres_size != sizeof(int)); - } + switch (pres_size) + { + case sizeof(int): + *(int *)present_ptr = present; + break; + case sizeof(short): + *(short *)present_ptr = present; + break; + case sizeof(char): + *(char *)present_ptr = present; + break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + } } diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.h b/src/core/libs/supl/asn-rrlp/constr_CHOICE.h index 90694fdb8..847df624c 100644 --- a/src/core/libs/supl/asn-rrlp/constr_CHOICE.h +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.h @@ -16,16 +16,16 @@ extern "C" typedef struct asn_CHOICE_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_codec_ctx_t member */ int pres_offset; /* Identifier of the present member */ int pres_size; /* Size of the identifier (enum) */ /* - * Tags to members mapping table. - */ + * Tags to members mapping table. + */ asn_TYPE_tag2member_t *tag2el; int tag2el_count; @@ -33,14 +33,14 @@ extern "C" int *canonical_order; /* - * Extensions-related stuff. - */ + * Extensions-related stuff. + */ int ext_start; /* First member of extensions, or -1 */ } asn_CHOICE_specifics_t; /* - * A set specialized functions dealing with the CHOICE type. - */ + * A set specialized functions dealing with the CHOICE type. + */ asn_struct_free_f CHOICE_free; asn_struct_print_f CHOICE_print; asn_constr_check_f CHOICE_constraint; diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c index 650c4b9f3..3b36c1fcd 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,92 +25,109 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#undef PHASE_OUT -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) -#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) +#define PHASE_OUT(ctx) \ + do \ + { \ + (ctx)->phase = 10; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * Check whether we are inside the extensions group. */ -#define IN_EXTENSION_GROUP(specs, memb_idx) \ - ( ((memb_idx) > (specs)->ext_after) \ - &&((memb_idx) < (specs)->ext_before)) - +#define IN_EXTENSION_GROUP(specs, memb_idx) \ + (((memb_idx) > (specs)->ext_after) && ((memb_idx) < (specs)->ext_before)) /* * Tags are canonically sorted in the tag2element map. */ -static int -_t2e_cmp(const void *ap, const void *bp) { +static int _t2e_cmp(const void *ap, const void *bp) +{ const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); - if(a_class == b_class) { - ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); - ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + if (a_class == b_class) + { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); - if(a_value == b_value) { - if(a->el_no > b->el_no) + if (a_value == b_value) + { + if (a->el_no > b->el_no) return 1; + /* + * Important: we do not check + * for a->el_no <= b->el_no! + */ + return 0; + } + else if (a_value < b_value) + return -1; + else return 1; - /* - * Important: we do not check - * for a->el_no <= b->el_no! - */ - return 0; - } else if(a_value < b_value) + } + else if (a_class < b_class) + { return -1; - else + } + else + { return 1; - } else if(a_class < b_class) { - return -1; - } else { - return 1; - } + } } - /* * The decoder of the SEQUENCE type. */ -asn_dec_rval_t -SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ @@ -120,26 +137,28 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* SEQUENCE element's index */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* SEQUENCE element's index */ ASN_DEBUG("Decoding %s as SEQUENCE", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -149,442 +168,504 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, 1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Subtracted below! */ - ADVANCE(rval.consumed); - - NEXT_PHASE(ctx); - - ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", - (long)ctx->left, (long)size); - - /* Fall through */ - case 1: - /* - * PHASE 1. - * From the place where we've left it previously, - * try to decode the next member from the list of - * this structure's elements. - * (ctx->step) stores the member being processed - * between invocations and the microphase {0,1} of parsing - * that member: - * step = ( * 2 + ). - */ - for(edx = (ctx->step >> 1); edx < td->elements_count; - edx++, ctx->step = (ctx->step & ~1) + 2) { - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - ssize_t tag_len; /* Length of TLV's T */ - int opt_edx_end; /* Next non-optional element */ - int use_bsearch; - int n; - - if(ctx->step & 1) - goto microphase2; - - /* - * MICROPHASE 1: Synchronize decoding. - */ - ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" - " opt=%d ec=%d", - td->name, (int)ctx->left, edx, - elements[edx].flags, elements[edx].optional, - td->elements_count); - - if(ctx->left == 0 /* No more stuff is expected */ - && ( - /* Explicit OPTIONAL specification reaches the end */ - (edx + elements[edx].optional - == td->elements_count) - || - /* All extensions are optional */ - (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before > td->elements_count) - ) - ) { - ASN_DEBUG("End of SEQUENCE %s", td->name); - /* - * Found the legitimate end of the structure. - */ - PHASE_OUT(ctx); - RETURN(RC_OK); - } - - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - ASN_DEBUG("Current tag in %s SEQUENCE for element %d " - "(%s) is %s encoded in %d bytes, of frame %ld", - td->name, edx, elements[edx].name, - ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - ASN_DEBUG("edx = %d, opt = %d, ec=%d", - edx, elements[edx].optional, - td->elements_count); - if((edx + elements[edx].optional - == td->elements_count) - || (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before - > td->elements_count)) { - /* - * Yeah, baby! Found the terminator - * of the indefinite length structure. - */ - /* - * Proceed to the canonical - * finalization function. - * No advancing is necessary. - */ - goto phase3; - } - } - } - - /* - * Find the next available type with this tag. - */ - use_bsearch = 0; - opt_edx_end = edx + elements[edx].optional + 1; - if(opt_edx_end > td->elements_count) - opt_edx_end = td->elements_count; /* Cap */ - else if(opt_edx_end - edx > 8) { - /* Limit the scope of linear search... */ - opt_edx_end = edx + 8; - use_bsearch = 1; - /* ... and resort to bsearch() */ - } - for(n = edx; n < opt_edx_end; n++) { - if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { + switch (ctx->phase) + { + case 0: /* - * Found element corresponding to the tag - * being looked at. - * Reposition over the right element. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ - edx = n; - ctx->step = 1 + 2 * edx; /* Remember! */ - goto microphase2; - } else if(elements[n].flags & ATF_OPEN_TYPE) { - /* - * This is the ANY type, which may bear - * any flag whatsoever. - */ - edx = n; - ctx->step = 1 + 2 * edx; /* Remember! */ - goto microphase2; - } else if(elements[n].tag == (ber_tlv_tag_t)-1) { - use_bsearch = 1; - break; - } - } - if(use_bsearch) { - /* - * Resort to a binary search over - * sorted array of tags. - */ - asn_TYPE_tag2member_t *t2m; - asn_TYPE_tag2member_t key; - key.el_tag = tlv_tag; - key.el_no = edx; - t2m = (asn_TYPE_tag2member_t *)bsearch(&key, - specs->tag2el, specs->tag2el_count, - sizeof(specs->tag2el[0]), _t2e_cmp); - if(t2m) { - asn_TYPE_tag2member_t *best = 0; - asn_TYPE_tag2member_t *t2m_f; - asn_TYPE_tag2member_t *t2m_l; - int edx_max = edx + elements[edx].optional; - /* - * Rewind to the first element with that tag, - * `cause bsearch() does not guarantee order. - */ - t2m_f = t2m + t2m->toff_first; - t2m_l = t2m + t2m->toff_last; - for(t2m = t2m_f; t2m <= t2m_l; t2m++) { - if(t2m->el_no > edx_max) break; - if(t2m->el_no < edx) continue; - best = t2m; - } - if(best) { - edx = best->el_no; - ctx->step = 1 + 2 * edx; - goto microphase2; - } - } - n = opt_edx_end; - } - if(n == opt_edx_end) { - /* - * If tag is unknown, it may be either - * an unknown (thus, incorrect) tag, - * or an extension (...), - * or an end of the indefinite-length structure. - */ - if(!IN_EXTENSION_GROUP(specs, - edx + elements[edx].optional)) { - ASN_DEBUG("Unexpected tag %s (at %d)", - ber_tlv_tag_string(tlv_tag), edx); - ASN_DEBUG("Expected tag %s (%s)%s", - ber_tlv_tag_string(elements[edx].tag), - elements[edx].name, - elements[edx].optional - ?" or alternatives":""); - RETURN(RC_FAIL); - } else { - /* Skip this tag */ - ssize_t skip; - edx += elements[edx].optional; - ASN_DEBUG("Skipping unexpected %s (at %d)", - ber_tlv_tag_string(tlv_tag), edx); - skip = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tag_len, - LEFT - tag_len); - ASN_DEBUG("Skip length %d in %s", - (int)skip, td->name); - switch(skip) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", td->name, + rval.code); + return rval; + } - ADVANCE(skip + tag_len); - ctx->step -= 2; - edx--; - continue; /* Try again with the next tag */ - } - } - - /* - * MICROPHASE 2: Invoke the member-specific decoder. - */ - ctx->step |= 1; /* Confirm entering next microphase */ - microphase2: - ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); - - /* - * Compute the position of the member inside a structure, - * and also a type of containment (it may be contained - * as pointer or using inline inclusion). - */ - if(elements[edx].flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); - } else { - /* - * A pointer to a pointer - * holding the start of the structure - */ - memb_ptr = (char *)st + elements[edx].memb_offset; - memb_ptr2 = &memb_ptr; - } - /* - * Invoke the member fetch routine according to member's type - */ - rval = elements[edx].type->ber_decoder(opt_codec_ctx, - elements[edx].type, - memb_ptr2, ptr, LEFT, - elements[edx].tag_mode); - ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " - "in %d bytes rval.code %d, size=%d", - td->name, edx, elements[edx].type->name, - (int)LEFT, (int)rval.consumed, rval.code, (int)size); - switch(rval.code) { - case RC_OK: - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { + if (ctx->left >= 0) + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", - (long)ctx->left, (long)size); - /* Fall through */ - case RC_FAIL: /* Fatal error */ - RETURN(RC_FAIL); - } /* switch(rval) */ - ADVANCE(rval.consumed); - } /* for(all structure members) */ + NEXT_PHASE(ctx); - phase3: - ctx->phase = 3; - case 3: /* 00 and other tags expected */ - case 4: /* only 00's expected */ + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); - ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", - td->name, (long)ctx->left, (long)size); - - /* - * Skip everything until the end of the SEQUENCE. - */ - while(ctx->left) { - ssize_t tl; - ssize_t ll; - - tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tl) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ - case -1: RETURN(RC_FAIL); - } + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next member from the list of + * this structure's elements. + * (ctx->step) stores the member being processed + * between invocations and the microphase {0,1} of parsing + * that member: + * step = ( * 2 + ). + */ + for (edx = (ctx->step >> 1); edx < td->elements_count; + edx++, ctx->step = (ctx->step & ~1) + 2) + { + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + ssize_t tag_len; /* Length of TLV's T */ + int opt_edx_end; /* Next non-optional element */ + int use_bsearch; + int n; - /* - * If expected <0><0>... - */ - if(ctx->left < 0 - && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - /* - * Correctly finished with <0><0>. - */ - ADVANCE(2); - ctx->left++; - ctx->phase = 4; - continue; - } - } + if (ctx->step & 1) goto microphase2; - if(!IN_EXTENSION_GROUP(specs, td->elements_count) - || ctx->phase == 4) { - ASN_DEBUG("Unexpected continuation " - "of a non-extensible type " - "%s (SEQUENCE): %s", - td->name, - ber_tlv_tag_string(tlv_tag)); - RETURN(RC_FAIL); - } + /* + * MICROPHASE 1: Synchronize decoding. + */ + ASN_DEBUG( + "In %s SEQUENCE left %d, edx=%d flags=%d" + " opt=%d ec=%d", + td->name, (int)ctx->left, edx, elements[edx].flags, + elements[edx].optional, td->elements_count); - ll = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tl, LEFT - tl); - switch(ll) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } + if (ctx->left == 0 /* No more stuff is expected */ + && ( + /* Explicit OPTIONAL specification reaches + the end */ + (edx + elements[edx].optional == + td->elements_count) || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > td->elements_count))) + { + ASN_DEBUG("End of SEQUENCE %s", td->name); + /* + * Found the legitimate end of the structure. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } - ADVANCE(tl + ll); + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG( + "Current tag in %s SEQUENCE for element %d " + "(%s) is %s encoded in %d bytes, of frame %ld", + td->name, edx, elements[edx].name, + ber_tlv_tag_string(tlv_tag), (int)tag_len, + (long)LEFT); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + ASN_DEBUG("edx = %d, opt = %d, ec=%d", + edx, elements[edx].optional, + td->elements_count); + if ((edx + elements[edx].optional == + td->elements_count) || + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > + td->elements_count)) + { + /* + * Yeah, baby! Found the + * terminator of the indefinite + * length structure. + */ + /* + * Proceed to the canonical + * finalization function. + * No advancing is necessary. + */ + goto phase3; + } + } + } + + /* + * Find the next available type with this tag. + */ + use_bsearch = 0; + opt_edx_end = edx + elements[edx].optional + 1; + if (opt_edx_end > td->elements_count) + opt_edx_end = td->elements_count; /* Cap */ + else if (opt_edx_end - edx > 8) + { + /* Limit the scope of linear search... */ + opt_edx_end = edx + 8; + use_bsearch = 1; + /* ... and resort to bsearch() */ + } + for (n = edx; n < opt_edx_end; n++) + { + if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) + { + /* + * Found element corresponding to the + * tag being looked at. Reposition over + * the right element. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } + else if (elements[n].flags & ATF_OPEN_TYPE) + { + /* + * This is the ANY type, which may bear + * any flag whatsoever. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } + else if (elements[n].tag == (ber_tlv_tag_t)-1) + { + use_bsearch = 1; + break; + } + } + if (use_bsearch) + { + /* + * Resort to a binary search over + * sorted array of tags. + */ + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + key.el_tag = tlv_tag; + key.el_no = edx; + t2m = (asn_TYPE_tag2member_t *)bsearch( + &key, specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _t2e_cmp); + if (t2m) + { + asn_TYPE_tag2member_t *best = 0; + asn_TYPE_tag2member_t *t2m_f; + asn_TYPE_tag2member_t *t2m_l; + int edx_max = + edx + elements[edx].optional; + /* + * Rewind to the first element with that + * tag, `cause bsearch() does not + * guarantee order. + */ + t2m_f = t2m + t2m->toff_first; + t2m_l = t2m + t2m->toff_last; + for (t2m = t2m_f; t2m <= t2m_l; t2m++) + { + if (t2m->el_no > edx_max) break; + if (t2m->el_no < edx) continue; + best = t2m; + } + if (best) + { + edx = best->el_no; + ctx->step = 1 + 2 * edx; + goto microphase2; + } + } + n = opt_edx_end; + } + if (n == opt_edx_end) + { + /* + * If tag is unknown, it may be either + * an unknown (thus, incorrect) tag, + * or an extension (...), + * or an end of the indefinite-length structure. + */ + if (!IN_EXTENSION_GROUP( + specs, edx + elements[edx].optional)) + { + ASN_DEBUG("Unexpected tag %s (at %d)", + ber_tlv_tag_string(tlv_tag), + edx); + ASN_DEBUG("Expected tag %s (%s)%s", + ber_tlv_tag_string( + elements[edx].tag), + elements[edx].name, + elements[edx].optional + ? " or alternatives" + : ""); + RETURN(RC_FAIL); + } + else + { + /* Skip this tag */ + ssize_t skip; + edx += elements[edx].optional; + + ASN_DEBUG( + "Skipping unexpected %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + skip = ber_skip_length( + opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + ASN_DEBUG("Skip length %d in %s", + (int)skip, td->name); + switch (skip) + { + case 0: + if (!SIZE_VIOLATION) + RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + ctx->step -= 2; + edx--; + continue; /* Try again with the next tag + */ + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); + + /* + * Compute the position of the member inside a + * structure, and also a type of containment (it may be + * contained as pointer or using inline inclusion). + */ + if (elements[edx].flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + + elements[edx].memb_offset); + } + else + { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = + (char *)st + elements[edx].memb_offset; + memb_ptr2 = &memb_ptr; + } + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elements[edx].type->ber_decoder( + opt_codec_ctx, elements[edx].type, memb_ptr2, ptr, + LEFT, elements[edx].tag_mode); + ASN_DEBUG( + "In %s SEQUENCE decoded %d %s of %d " + "in %d bytes rval.code %d, size=%d", + td->name, edx, elements[edx].type->name, (int)LEFT, + (int)rval.consumed, rval.code, (int)size); + switch (rval.code) + { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + ASN_DEBUG( + "Size violation (c->l=%ld <= s=%ld)", + (long)ctx->left, (long)size); + /* Fall through */ + case RC_FAIL: /* Fatal error */ + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all structure members) */ + + phase3: + ctx->phase = 3; + case 3: /* 00 and other tags expected */ + case 4: /* only 00's expected */ + + ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", td->name, + (long)ctx->left, (long)size); + + /* + * Skip everything until the end of the SEQUENCE. + */ + while (ctx->left) + { + ssize_t tl; + ssize_t ll; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tl) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + /* + * If expected <0><0>... + */ + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + ctx->phase = 4; + continue; + } + } + + if (!IN_EXTENSION_GROUP(specs, td->elements_count) || + ctx->phase == 4) + { + ASN_DEBUG( + "Unexpected continuation " + "of a non-extensible type " + "%s (SEQUENCE): %s", + td->name, ber_tlv_tag_string(tlv_tag)); + RETURN(RC_FAIL); + } + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tl, LEFT - tl); + switch (ll) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(tl + ll); + } + + PHASE_OUT(ctx); } - PHASE_OUT(ctx); - } - RETURN(RC_OK); } - /* * The DER encoder of the SEQUENCE type. */ -asn_enc_rval_t -SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, - void *sptr, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ size_t computed_size = 0; asn_enc_rval_t erval; ssize_t ret; int edx; - ASN_DEBUG("%s %s as SEQUENCE", - cb?"Encoding":"Estimating", td->name); + ASN_DEBUG("%s %s as SEQUENCE", cb ? "Encoding" : "Estimating", td->name); /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, + elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; + ASN_DEBUG("Member %d %s estimated %ld bytes", edx, elm->name, + (long)erval.encoded); } - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, - 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; - ASN_DEBUG("Member %d %s estimated %ld bytes", - edx, elm->name, (long)erval.encoded); - } /* * Encode the TLV for the sequence itself. */ ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); - if(ret == -1) - _ASN_ENCODE_FAILED; + if (ret == -1) _ASN_ENCODE_FAILED; erval.encoded = computed_size + ret; - if(!cb) _ASN_ENCODED_OK(erval); + if (!cb) _ASN_ENCODED_OK(erval); /* * Encode all members. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - asn_enc_rval_t tmperval; - void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmperval; + void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) continue; - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) continue; + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + tmperval = elm->type->der_encoder( + elm->type, memb_ptr, elm->tag_mode, elm->tag, cb, app_key); + if (tmperval.encoded == -1) return tmperval; + computed_size -= tmperval.encoded; + ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", edx, + elm->name, td->name, (long)tmperval.encoded); } - tmperval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, - cb, app_key); - if(tmperval.encoded == -1) - return tmperval; - computed_size -= tmperval.encoded; - ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", - edx, elm->name, td->name, (long)tmperval.encoded); - } - if(computed_size != 0) + if (computed_size != 0) /* * Encoded size is not equal to the computed size. */ @@ -593,55 +674,57 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(erval); } - -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * ... and parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value from a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* Element index */ + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ int edx_end; /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. @@ -650,486 +733,548 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 3: Skipping unknown extensions. * Phase 4: PHASED OUT */ - for(edx = ctx->step; ctx->phase <= 3;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ - asn_TYPE_member_t *elm; - int n; + for (edx = ctx->step; ctx->phase <= 3;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + int n; - /* - * Go inside the inner member of a sequence. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + /* + * Go inside the inner member of a sequence. + */ + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - elm = &td->elements[edx]; + elm = &td->elements[edx]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } - /* Invoke the inner type decoder, m.b. multiple times */ - tmprval = elm->type->xer_decoder(opt_codec_ctx, - elm->type, memb_ptr2, elm->name, - buf_ptr, size); - XER_ADVANCE(tmprval.consumed); - if(tmprval.code != RC_OK) - RETURN(tmprval.code); - ctx->phase = 1; /* Back to body processing */ - ctx->step = ++edx; - ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", - ctx->phase, ctx->step); - /* Fall through */ - } - - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, - &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", - tcv, ctx->phase, xml_tag); - - /* Skip the extensions section */ - if(ctx->phase == 3) { - switch(xer_skip_unknown(tcv, &ctx->left)) { - case -1: - ctx->phase = 4; - RETURN(RC_FAIL); - case 0: - XER_ADVANCE(ch_size); - continue; - case 1: - XER_ADVANCE(ch_size); - ctx->phase = 1; - continue; - case 2: - ctx->phase = 1; - break; - } - } - - switch(tcv) { - case XCT_CLOSING: - if(ctx->phase == 0) break; - ctx->phase = 0; - /* Fall through */ - case XCT_BOTH: - if(ctx->phase == 0) { - if(edx >= td->elements_count - || - /* Explicit OPTIONAL specs reaches the end */ - (edx + elements[edx].optional - == td->elements_count) - || - /* All extensions are optional */ - (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before - > td->elements_count) - ) { - XER_ADVANCE(ch_size); - ctx->phase = 4; /* Phase out */ - RETURN(RC_OK); - } else { - ASN_DEBUG("Premature end of XER SEQUENCE"); - RETURN(RC_FAIL); + /* Invoke the inner type decoder, m.b. multiple times */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, + memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + if (tmprval.code != RC_OK) RETURN(tmprval.code); + ctx->phase = 1; /* Back to body processing */ + ctx->step = ++edx; + ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", + ctx->phase, ctx->step); + /* Fall through */ } - } - /* Fall through */ - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", - tcv, ctx->phase, edx); - if(ctx->phase != 1) { - break; /* Really unexpected */ - } + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } - if(edx < td->elements_count) { - /* - * Search which member corresponds to this tag. - */ - edx_end = edx + elements[edx].optional + 1; - if(edx_end > td->elements_count) - edx_end = td->elements_count; - for(n = edx; n < edx_end; n++) { - elm = &td->elements[n]; - tcv = xer_check_tag(buf_ptr, - ch_size, elm->name); - switch(tcv) { + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", tcv, ctx->phase, + xml_tag); + + /* Skip the extensions section */ + if (ctx->phase == 3) + { + switch (xer_skip_unknown(tcv, &ctx->left)) + { + case -1: + ctx->phase = 4; + RETURN(RC_FAIL); + case 0: + XER_ADVANCE(ch_size); + continue; + case 1: + XER_ADVANCE(ch_size); + ctx->phase = 1; + continue; + case 2: + ctx->phase = 1; + break; + } + } + + switch (tcv) + { + case XCT_CLOSING: + if (ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ case XCT_BOTH: + if (ctx->phase == 0) + { + if (edx >= td->elements_count || + /* Explicit OPTIONAL specs reaches the end + */ + (edx + elements[edx].optional == + td->elements_count) || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > td->elements_count)) + { + XER_ADVANCE(ch_size); + ctx->phase = 4; /* Phase out */ + RETURN(RC_OK); + } + else + { + ASN_DEBUG( + "Premature end of XER SEQUENCE"); + RETURN(RC_FAIL); + } + } + /* Fall through */ case XCT_OPENING: - /* - * Process this member. - */ - ctx->step = edx = n; - ctx->phase = 2; - break; + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: - continue; + + ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", tcv, + ctx->phase, edx); + if (ctx->phase != 1) + { + break; /* Really unexpected */ + } + + if (edx < td->elements_count) + { + /* + * Search which member corresponds to this tag. + */ + edx_end = edx + elements[edx].optional + 1; + if (edx_end > td->elements_count) + edx_end = td->elements_count; + for (n = edx; n < edx_end; n++) + { + elm = &td->elements[n]; + tcv = xer_check_tag(buf_ptr, ch_size, + elm->name); + switch (tcv) + { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx = n; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + n = edx_end; + break; /* Phase out */ + } + break; + } + if (n != edx_end) continue; + } + else + { + ASN_DEBUG("Out of defined members: %d/%d", edx, + td->elements_count); + } + + /* It is expected extension */ + if (IN_EXTENSION_GROUP( + specs, edx + (edx < td->elements_count + ? elements[edx].optional + : 0))) + { + ASN_DEBUG("Got anticipated extension at %d", + edx); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if (tcv & XCT_CLOSING) + { + /* Found without body */ + } + else + { + ctx->left = 1; + ctx->phase = 3; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ default: - n = edx_end; - break; /* Phase out */ - } - break; + break; } - if(n != edx_end) - continue; - } else { - ASN_DEBUG("Out of defined members: %d/%d", - edx, td->elements_count); - } - /* It is expected extension */ - if(IN_EXTENSION_GROUP(specs, - edx + (edx < td->elements_count - ? elements[edx].optional : 0))) { - ASN_DEBUG("Got anticipated extension at %d", - edx); - /* - * Check for (XCT_BOTH or XCT_UNKNOWN_BO) - * By using a mask. Only record a pure - * tags. - */ - if(tcv & XCT_CLOSING) { - /* Found without body */ - } else { - ctx->left = 1; - ctx->phase = 3; /* Skip ...'s */ - } - XER_ADVANCE(ch_size); - continue; - } - - /* Fall through */ - default: + ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", + size > 0 ? ((const char *)buf_ptr)[0] : '.', + size > 1 ? ((const char *)buf_ptr)[1] : '.', + size > 2 ? ((const char *)buf_ptr)[2] : '.', + size > 3 ? ((const char *)buf_ptr)[3] : '.', + size > 4 ? ((const char *)buf_ptr)[4] : '.', + size > 5 ? ((const char *)buf_ptr)[5] : '.'); break; } - ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", - size>0?((const char *)buf_ptr)[0]:'.', - size>1?((const char *)buf_ptr)[1]:'.', - size>2?((const char *)buf_ptr)[2]:'.', - size>3?((const char *)buf_ptr)[3]:'.', - size>4?((const char *)buf_ptr)[4]:'.', - size>5?((const char *)buf_ptr)[5]:'.'); - break; - } - - ctx->phase = 4; /* "Phase out" on hard failure */ + ctx->phase = 4; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } -asn_enc_rval_t -SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; int xcan = (flags & XER_F_CANONICAL); int edx; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; - for(edx = 0; edx < td->elements_count; edx++) { - asn_enc_rval_t tmper; - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - const char *mname = elm->name; - unsigned int mlen = strlen(mname); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + /* Print the member itself */ + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + er.encoded += 5 + (2 * mlen) + tmper.encoded; } - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - - /* Print the member itself */ - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - - _ASN_CALLBACK3("", 1); - er.encoded += 5 + (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -int -SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ int edx; int ret; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ - if(cb(td->name, strlen(td->name), app_key) < 0 - || cb(" ::= {", 6, app_key) < 0) + if (cb(td->name, strlen(td->name), app_key) < 0 || + cb(" ::= {", 6, app_key) < 0) return -1; - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - const void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) continue; - /* Print line */ - /* Fall through */ - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Print line */ + /* Fall through */ + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Indentation */ + _i_INDENT(1); + + /* Print the member's name and stuff */ + if (cb(elm->name, strlen(elm->name), app_key) < 0 || + cb(": ", 2, app_key) < 0) + return -1; + + /* Print the member itself */ + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, + app_key); + if (ret) return ret; } - /* Indentation */ - _i_INDENT(1); - - /* Print the member's name and stuff */ - if(cb(elm->name, strlen(elm->name), app_key) < 0 - || cb(": ", 2, app_key) < 0) - return -1; - - /* Print the member itself */ - ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, - cb, app_key); - if(ret) return ret; - } - ilevel--; _i_INDENT(1); return (cb("}", 1, app_key) < 0) ? -1 : 0; } -void -SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { +void SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) +{ int edx; - if(!td || !sptr) - return; + if (!td || !sptr) return; ASN_DEBUG("Freeing %s as SEQUENCE", td->name); - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } } - } - if(!contents_only) { - FREEMEM(sptr); - } + if (!contents_only) + { + FREEMEM(sptr); + } } -int -SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ int edx; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } /* * Iterate over structure members and check their validity. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - const void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - continue; - _ASN_CTFAIL(app_key, td, sptr, - "%s: mandatory element %s absent (%s:%d)", - td->name, elm->name, __FILE__, __LINE__); - return -1; - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); - } + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + _ASN_CTFAIL( + app_key, td, sptr, + "%s: mandatory element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } - if(elm->memb_constraints) { - int ret = elm->memb_constraints(elm->type, memb_ptr, - ctfailcb, app_key); - if(ret) return ret; - } else { - int ret = elm->type->check_constraints(elm->type, - memb_ptr, ctfailcb, app_key); - if(ret) return ret; - /* - * Cannot inherit it earlier: - * need to make sure we get the updated version. - */ - elm->memb_constraints = elm->type->check_constraints; + if (elm->memb_constraints) + { + int ret = elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if (ret) return ret; + } + else + { + int ret = elm->type->check_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if (ret) return ret; + /* + * Cannot inherit it earlier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + } } - } return 0; } -asn_dec_rval_t -SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; - void *st = *sptr; /* Target structure. */ - int extpresent; /* Extension additions are present */ - uint8_t *opres; /* Presence of optional root members */ + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ asn_per_data_t opmd; asn_dec_rval_t rv; int edx; (void)constraints; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); /* Handle extensions */ - if(specs->ext_before >= 0) { - extpresent = per_get_few_bits(pd, 1); - if(extpresent < 0) _ASN_DECODE_STARVED; - } else { - extpresent = 0; - } + if (specs->ext_before >= 0) + { + extpresent = per_get_few_bits(pd, 1); + if (extpresent < 0) _ASN_DECODE_STARVED; + } + else + { + extpresent = 0; + } /* Prepare a place and read-in the presence bitmap */ memset(&opmd, 0, sizeof(opmd)); - if(specs->roms_count) { - opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); - if(!opres) _ASN_DECODE_FAILED; - /* Get the presence map */ - if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { - FREEMEM(opres); - _ASN_DECODE_STARVED; + if (specs->roms_count) + { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if (!opres) _ASN_DECODE_FAILED; + /* Get the presence map */ + if (per_get_many_bits(pd, opres, 0, specs->roms_count)) + { + FREEMEM(opres); + _ASN_DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } + else + { + opres = 0; } - opmd.buffer = opres; - opmd.nbits = specs->roms_count; - ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", - td->name, specs->roms_count, *opres); - } else { - opres = 0; - } /* * Get the sequence ROOT elements. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - if(IN_EXTENSION_GROUP(specs, edx)) - continue; + if (IN_EXTENSION_GROUP(specs, edx)) continue; - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - - /* Deal with optionality */ - if(elm->optional) { - int present = per_get_few_bits(&opmd, 1); - ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", - td->name, elm->name, present, - (int)opmd.nboff, (int)opmd.nbits); - if(present == 0) { - /* This element is not present */ - if(elm->default_value) { - /* Fill-in DEFAULT */ - if(elm->default_value(1, memb_ptr2)) { - FREEMEM(opres); - _ASN_DECODE_FAILED; - } - ASN_DEBUG("Filled-in default"); + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; } - /* The member is just not present */ - continue; - } - /* Fall through */ - } - /* Fetch the member from the stream */ - ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - if(rv.code != RC_OK) { - ASN_DEBUG("Failed decode %s in %s", - elm->name, td->name); - FREEMEM(opres); - return rv; + /* Deal with optionality */ + if (elm->optional) + { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, (int)opmd.nboff, + (int)opmd.nbits); + if (present == 0) + { + /* This element is not present */ + if (elm->default_value) + { + /* Fill-in DEFAULT */ + if (elm->default_value(1, memb_ptr2)) + { + FREEMEM(opres); + _ASN_DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if (rv.code != RC_OK) + { + ASN_DEBUG("Failed decode %s in %s", elm->name, td->name); + FREEMEM(opres); + return rv; + } } - } /* Optionality map is not needed anymore */ FREEMEM(opres); @@ -1137,170 +1282,194 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Deal with extensions. */ - if(extpresent) { - ssize_t bmlength; - uint8_t *epres; /* Presence of extension members */ - asn_per_data_t epmd; + if (extpresent) + { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; - bmlength = uper_get_nslength(pd); - if(bmlength < 0) _ASN_DECODE_STARVED; + bmlength = uper_get_nslength(pd); + if (bmlength < 0) _ASN_DECODE_STARVED; - ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); - epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); - if(!epres) _ASN_DECODE_STARVED; + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if (!epres) _ASN_DECODE_STARVED; - /* Get the extensions map */ - if(per_get_many_bits(pd, epres, 0, bmlength)) { - FREEMEM(epres); - _ASN_DECODE_STARVED; - } - - memset(&epmd, 0, sizeof(epmd)); - epmd.buffer = epres; - epmd.nbits = bmlength; - ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", - td->name, bmlength, *epres); - - /* Go over extensions and read them in */ - for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; - - if(!IN_EXTENSION_GROUP(specs, edx)) { - ASN_DEBUG("%d is not extension", edx); - continue; - } - - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (void *)((char *)st + elm->memb_offset); - memb_ptr2 = &memb_ptr; - } - - present = per_get_few_bits(&epmd, 1); - if(present <= 0) { - if(present < 0) break; /* No more extensions */ - continue; - } - - ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); - rv = uper_open_type_get(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - if(rv.code != RC_OK) { - FREEMEM(epres); - return rv; - } - } - - /* Skip over overflow extensions which aren't present - * in this system's version of the protocol */ - for(;;) { - ASN_DEBUG("Getting overflow extensions"); - switch(per_get_few_bits(&epmd, 1)) { - case -1: break; - case 0: continue; - default: - if(uper_open_type_skip(opt_codec_ctx, pd)) { + /* Get the extensions map */ + if (per_get_many_bits(pd, epres, 0, bmlength)) + { FREEMEM(epres); _ASN_DECODE_STARVED; } - } - break; - } - FREEMEM(epres); - } + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", + td->name, bmlength, *epres); + + /* Go over extensions and read them in */ + for (edx = specs->ext_after + 1; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if (!IN_EXTENSION_GROUP(specs, edx)) + { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if (present <= 0) + { + if (present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, + td->name, *memb_ptr2); + rv = + uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if (rv.code != RC_OK) + { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for (;;) + { + ASN_DEBUG("Getting overflow extensions"); + switch (per_get_few_bits(&epmd, 1)) + { + case -1: + break; + case 0: + continue; + default: + if (uper_open_type_skip(opt_codec_ctx, pd)) + { + FREEMEM(epres); + _ASN_DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } /* Fill DEFAULT members in extensions */ - for(edx = specs->roms_count; edx < specs->roms_count - + specs->aoms_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void **memb_ptr2; /* Pointer to member pointer */ + for (edx = specs->roms_count; edx < specs->roms_count + specs->aoms_count; + edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ - if(!elm->default_value) continue; + if (!elm->default_value) continue; - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - if(*memb_ptr2) continue; - } else { - continue; /* Extensions are all optionals */ + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + if (*memb_ptr2) continue; + } + else + { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if (elm->default_value(1, memb_ptr2)) + { + _ASN_DECODE_FAILED; + } } - /* Set default value */ - if(elm->default_value(1, memb_ptr2)) { - _ASN_DECODE_FAILED; - } - } - rv.consumed = 0; rv.code = RC_OK; return rv; } -static int -SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, - asn_per_outp_t *po1, asn_per_outp_t *po2) { - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; +static int SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) +{ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; int exts_present = 0; int exts_count = 0; int edx; - if(specs->ext_before < 0) - return 0; + if (specs->ext_before < 0) return 0; /* Find out which extensions are present */ - for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; + for (edx = specs->ext_after + 1; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; - if(!IN_EXTENSION_GROUP(specs, edx)) { - ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); - continue; + if (!IN_EXTENSION_GROUP(specs, edx)) + { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, + edx); + continue; + } + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", elm->type->name, edx, + present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if (po1 && per_put_few_bits(po1, present, 1)) return -1; + /* Encode as open type field */ + if (po2 && present && + uper_open_type_put(elm->type, elm->per_constraints, *memb_ptr2, + po2)) + return -1; } - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - present = (*memb_ptr2 != 0); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; - present = 1; - } - - ASN_DEBUG("checking %s (@%d) present => %d", - elm->type->name, edx, present); - exts_count++; - exts_present += present; - - /* Encode as presence marker */ - if(po1 && per_put_few_bits(po1, present, 1)) - return -1; - /* Encode as open type field */ - if(po2 && present && uper_open_type_put(elm->type, - elm->per_constraints, *memb_ptr2, po2)) - return -1; - - } - return exts_present ? exts_count : 0; } -asn_enc_rval_t -SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; +asn_enc_rval_t SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_enc_rval_t er; int n_extensions; int edx; @@ -1308,118 +1477,124 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, (void)constraints; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); - /* * X.691#18.1 Whether structure is extensible * and whether to encode extensions */ - if(specs->ext_before >= 0) { - n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); - per_put_few_bits(po, n_extensions ? 1 : 0, 1); - } else { - n_extensions = 0; /* There are no extensions to encode */ - } - - /* Encode a presence bitmap */ - for(i = 0; i < specs->roms_count; i++) { - asn_TYPE_member_t *elm; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; - - edx = specs->oms[i]; - elm = &td->elements[edx]; - - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - present = (*memb_ptr2 != 0); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; - present = 1; + if (specs->ext_before >= 0) + { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } + else + { + n_extensions = 0; /* There are no extensions to encode */ } - /* Eliminate default values */ - if(present && elm->default_value - && elm->default_value(0, memb_ptr2) == 1) - present = 0; + /* Encode a presence bitmap */ + for (i = 0; i < specs->roms_count; i++) + { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; - ASN_DEBUG("Element %s %s %s->%s is %s", - elm->flags & ATF_POINTER ? "ptr" : "inline", - elm->default_value ? "def" : "wtv", - td->name, elm->name, present ? "present" : "absent"); - if(per_put_few_bits(po, present, 1)) - _ASN_ENCODE_FAILED; - } + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if (present && elm->default_value && + elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", td->name, elm->name, + present ? "present" : "absent"); + if (per_put_few_bits(po, present, 1)) _ASN_ENCODE_FAILED; + } /* * Encode the sequence ROOT elements. */ - ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); - for(edx = 0; edx < ((specs->ext_after < 0) - ? td->elements_count : specs->ext_before - 1); edx++) { + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, + td->elements_count, specs->ext_before); + for (edx = 0; edx < ((specs->ext_after < 0) ? td->elements_count + : specs->ext_before - 1); + edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + if (IN_EXTENSION_GROUP(specs, edx)) continue; - if(IN_EXTENSION_GROUP(specs, edx)) - continue; + ASN_DEBUG("About to encode %s", elm->type->name); - ASN_DEBUG("About to encode %s", elm->type->name); + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if (!*memb_ptr2) + { + ASN_DEBUG("Element %s %d not present", elm->name, + edx); + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - if(!*memb_ptr2) { - ASN_DEBUG("Element %s %d not present", - elm->name, edx); - if(elm->optional) - continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; + /* Eliminate default values */ + if (elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->uper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if (er.encoded == -1) return er; } - /* Eliminate default values */ - if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) - continue; - - ASN_DEBUG("Encoding %s->%s", td->name, elm->name); - er = elm->type->uper_encoder(elm->type, elm->per_constraints, - *memb_ptr2, po); - if(er.encoded == -1) - return er; - } - /* No extensions to encode */ - if(!n_extensions) _ASN_ENCODED_OK(er); + if (!n_extensions) _ASN_ENCODED_OK(er); ASN_DEBUG("Length of %d bit-map", n_extensions); /* #18.8. Write down the presence bit-map length. */ - if(uper_put_nslength(po, n_extensions)) - _ASN_ENCODE_FAILED; + if (uper_put_nslength(po, n_extensions)) _ASN_ENCODE_FAILED; ASN_DEBUG("Bit-map of %d elements", n_extensions); /* #18.7. Encoding the extensions presence bit-map. */ /* TODO: act upon NOTE in #18.7 for canonical PER */ - if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + if (SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) _ASN_ENCODE_FAILED; ASN_DEBUG("Writing %d extensions", n_extensions); /* #18.9. Encode extensions as open type fields. */ - if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + if (SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h index dbb095ba3..c5b74090f 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.h @@ -15,36 +15,35 @@ extern "C" typedef struct asn_SEQUENCE_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ /* - * Tags to members mapping table (sorted). - */ + * Tags to members mapping table (sorted). + */ asn_TYPE_tag2member_t *tag2el; int tag2el_count; /* - * Optional members of the extensions root (roms) or additions (aoms). - * Meaningful for PER. - */ + * Optional members of the extensions root (roms) or additions (aoms). + * Meaningful for PER. + */ int *oms; /* Optional MemberS */ int roms_count; /* Root optional members count */ int aoms_count; /* Additions optional members count */ /* - * Description of an extensions group. - */ + * Description of an extensions group. + */ int ext_after; /* Extensions start after this member */ int ext_before; /* Extensions stop before this member */ } asn_SEQUENCE_specifics_t; - /* - * A set specialized functions dealing with the SEQUENCE type. - */ + * A set specialized functions dealing with the SEQUENCE type. + */ asn_struct_free_f SEQUENCE_free; asn_struct_print_f SEQUENCE_print; asn_constr_check_f SEQUENCE_constraint; diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c index 5d54cf077..00e6a2a4a 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE_OF.c @@ -10,10 +10,11 @@ /* * The DER encoder of the SEQUENCE OF type. */ -asn_enc_rval_t -SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); size_t computed_size = 0; @@ -26,183 +27,203 @@ SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = elm->type->der_encoder(elm->type, memb_ptr, - 0, elm->tag, - 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; - } + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = + elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; + } /* * Encode the TLV for the sequence itself. */ - encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, - cb, app_key); - if(encoding_size == -1) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } + encoding_size = + der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + if (encoding_size == -1) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } computed_size += encoding_size; - if(!cb) { - erval.encoded = computed_size; - _ASN_ENCODED_OK(erval); - } + if (!cb) + { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); /* * Encode all members. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = elm->type->der_encoder(elm->type, memb_ptr, - 0, elm->tag, - cb, app_key); - if(erval.encoded == -1) - return erval; - encoding_size += erval.encoded; - } + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, cb, + app_key); + if (erval.encoded == -1) return erval; + encoding_size += erval.encoded; + } - if(computed_size != (size_t)encoding_size) { - /* - * Encoded size is not equal to the computed size. - */ - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - } else { - erval.encoded = computed_size; - erval.structure_ptr = 0; - erval.failed_type = 0; - } + if (computed_size != (size_t)encoding_size) + { + /* + * Encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } + else + { + erval.encoded = computed_size; + erval.structure_ptr = 0; + erval.failed_type = 0; + } return erval; } -asn_enc_rval_t -SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_enc_rval_t er; - asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList - ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + ? 0 + : ((*elm->name) ? elm->name : elm->type->xml_tag); unsigned int mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); int i; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; - for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; - void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + for (i = 0; i < list->count; i++) + { + asn_enc_rval_t tmper; + void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - if(mname) { - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - } - - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - if(tmper.encoded == 0 && specs->as_XMLValueList) { - const char *name = elm->type->xml_tag; - size_t len = strlen(name); - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); - _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + if (mname) + { + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); } - if(mname) { - _ASN_CALLBACK3("", 1); - er.encoded += 5; + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + if (tmper.encoded == 0 && specs->as_XMLValueList) + { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if (mname) + { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; } - er.encoded += (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -asn_enc_rval_t -SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_anonymous_sequence_ *list; asn_per_constraint_t *ct; asn_enc_rval_t er; asn_TYPE_member_t *elm = td->elements; int seq; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; list = _A_SEQUENCE_FROM_VOID(sptr); er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); - if(constraints) ct = &constraints->size; - else if(td->per_constraints) ct = &td->per_constraints->size; - else ct = 0; + if (constraints) + ct = &constraints->size; + else if (td->per_constraints) + ct = &td->per_constraints->size; + else + ct = 0; /* If extensible constraint, check if size is in root */ - if(ct) { - int not_in_root = (list->count < ct->lower_bound - || list->count > ct->upper_bound); - ASN_DEBUG("lb %ld ub %ld %s", - ct->lower_bound, ct->upper_bound, - ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); - if(ct->flags & APC_EXTENSIBLE) { - /* Declare whether size is in extension root */ - if(per_put_few_bits(po, not_in_root, 1)) - _ASN_ENCODE_FAILED; - if(not_in_root) ct = 0; - } else if(not_in_root && ct->effective_bits >= 0) - _ASN_ENCODE_FAILED; - } - - if(ct && ct->effective_bits >= 0) { - /* X.691, #19.5: No length determinant */ - if(per_put_few_bits(po, list->count - ct->lower_bound, - ct->effective_bits)) - _ASN_ENCODE_FAILED; - } - - for(seq = -1; seq < list->count;) { - ssize_t mayEncode; - if(seq < 0) seq = 0; - if(ct && ct->effective_bits >= 0) { - mayEncode = list->count; - } else { - mayEncode = uper_put_length(po, list->count - seq); - if(mayEncode < 0) _ASN_ENCODE_FAILED; - } - - while(mayEncode--) { - void *memb_ptr = list->array[seq++]; - if(!memb_ptr) _ASN_ENCODE_FAILED; - er = elm->type->uper_encoder(elm->type, - elm->per_constraints, memb_ptr, po); - if(er.encoded == -1) + if (ct) + { + int not_in_root = (list->count < ct->lower_bound || + list->count > ct->upper_bound); + ASN_DEBUG("lb %ld ub %ld %s", ct->lower_bound, ct->upper_bound, + ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); + if (ct->flags & APC_EXTENSIBLE) + { + /* Declare whether size is in extension root */ + if (per_put_few_bits(po, not_in_root, 1)) + _ASN_ENCODE_FAILED; + if (not_in_root) ct = 0; + } + else if (not_in_root && ct->effective_bits >= 0) _ASN_ENCODE_FAILED; } - } + + if (ct && ct->effective_bits >= 0) + { + /* X.691, #19.5: No length determinant */ + if (per_put_few_bits(po, list->count - ct->lower_bound, + ct->effective_bits)) + _ASN_ENCODE_FAILED; + } + + for (seq = -1; seq < list->count;) + { + ssize_t mayEncode; + if (seq < 0) seq = 0; + if (ct && ct->effective_bits >= 0) + { + mayEncode = list->count; + } + else + { + mayEncode = uper_put_length(po, list->count - seq); + if (mayEncode < 0) _ASN_ENCODE_FAILED; + } + + while (mayEncode--) + { + void *memb_ptr = list->array[seq++]; + if (!memb_ptr) _ASN_ENCODE_FAILED; + er = elm->type->uper_encoder( + elm->type, elm->per_constraints, memb_ptr, po); + if (er.encoded == -1) _ASN_ENCODE_FAILED; + } + } _ASN_ENCODED_OK(er); } - diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c index b7c5a1342..d662e4ac8 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,77 +25,93 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#undef PHASE_OUT -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) -#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) +#define PHASE_OUT(ctx) \ + do \ + { \ + (ctx)->phase = 10; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * The decoder of the SET OF type. */ -asn_dec_rval_t -SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; - asn_TYPE_member_t *elm = td->elements; /* Single one */ + asn_TYPE_member_t *elm = td->elements; /* Single one */ /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as SET OF", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -105,203 +121,239 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, 1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Subtracted below! */ - ADVANCE(rval.consumed); - - ASN_DEBUG("Structure consumes %ld bytes, " - "buffer %ld", (long)ctx->left, (long)size); - - NEXT_PHASE(ctx); - /* Fall through */ - case 1: - /* - * PHASE 1. - * From the place where we've left it previously, - * try to decode the next item. - */ - for(;; ctx->step = 0) { - ssize_t tag_len; /* Length of TLV's T */ - - if(ctx->step & 1) - goto microphase2; - - /* - * MICROPHASE 1: Synchronize decoding. - */ - - if(ctx->left == 0) { - ASN_DEBUG("End of SET OF %s", td->name); - /* - * No more things to decode. - * Exit out of here. - */ - PHASE_OUT(ctx); - RETURN(RC_OK); - } - - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { + switch (ctx->phase) + { + case 0: /* - * Found the terminator of the - * indefinite length structure. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ - break; - } - } - /* Outmost tag may be unknown and cannot be fetched/compared */ - if(elm->tag != (ber_tlv_tag_t)-1) { - if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { - /* - * The new list member of expected type has arrived. - */ - } else { - ASN_DEBUG("Unexpected tag %s fixed SET OF %s", - ber_tlv_tag_string(tlv_tag), td->name); - ASN_DEBUG("%s SET OF has tag %s", - td->name, ber_tlv_tag_string(elm->tag)); - RETURN(RC_FAIL); - } - } + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", td->name, + rval.code); + return rval; + } - /* - * MICROPHASE 2: Invoke the member-specific decoder. - */ - ctx->step |= 1; /* Confirm entering next microphase */ - microphase2: - - /* - * Invoke the member fetch routine according to member's type - */ - rval = elm->type->ber_decoder(opt_codec_ctx, - elm->type, &ctx->ptr, ptr, LEFT, 0); - ASN_DEBUG("In %s SET OF %s code %d consumed %d", - td->name, elm->type->name, - rval.code, (int)rval.consumed); - switch(rval.code) { - case RC_OK: - { - asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); - if(ASN_SET_ADD(list, ctx->ptr) != 0) - RETURN(RC_FAIL); - else - ctx->ptr = 0; - } - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { + if (ctx->left >= 0) + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - /* Fall through */ - case RC_FAIL: /* Fatal error */ - ASN_STRUCT_FREE(*elm->type, ctx->ptr); - ctx->ptr = 0; - RETURN(RC_FAIL); - } /* switch(rval) */ - ADVANCE(rval.consumed); - } /* for(all list members) */ + ASN_DEBUG( + "Structure consumes %ld bytes, " + "buffer %ld", + (long)ctx->left, (long)size); - NEXT_PHASE(ctx); - case 2: - /* - * Read in all "end of content" TLVs. - */ - while(ctx->left < 0) { - if(LEFT < 2) { - if(LEFT > 0 && ((const char *)ptr)[0] != 0) { - /* Unexpected tag */ - RETURN(RC_FAIL); - } else { - RETURN(RC_WMORE); - } - } - if(((const char *)ptr)[0] == 0 - && ((const char *)ptr)[1] == 0) { - ADVANCE(2); - ctx->left++; - } else { - RETURN(RC_FAIL); - } + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next item. + */ + for (;; ctx->step = 0) + { + ssize_t tag_len; /* Length of TLV's T */ + + if (ctx->step & 1) goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + + if (ctx->left == 0) + { + ASN_DEBUG("End of SET OF %s", td->name); + /* + * No more things to decode. + * Exit out of here. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Found the terminator of the + * indefinite length structure. + */ + break; + } + } + + /* Outmost tag may be unknown and cannot be + * fetched/compared */ + if (elm->tag != (ber_tlv_tag_t)-1) + { + if (BER_TAGS_EQUAL(tlv_tag, elm->tag)) + { + /* + * The new list member of expected type + * has arrived. + */ + } + else + { + ASN_DEBUG( + "Unexpected tag %s fixed SET OF %s", + ber_tlv_tag_string(tlv_tag), + td->name); + ASN_DEBUG("%s SET OF has tag %s", + td->name, + ber_tlv_tag_string(elm->tag)); + RETURN(RC_FAIL); + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + &ctx->ptr, ptr, LEFT, 0); + ASN_DEBUG("In %s SET OF %s code %d consumed %d", + td->name, elm->type->name, rval.code, + (int)rval.consumed); + switch (rval.code) + { + case RC_OK: + { + asn_anonymous_set_ *list = + _A_SET_FROM_VOID(st); + if (ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + else + ctx->ptr = 0; + } + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + /* Fall through */ + case RC_FAIL: /* Fatal error */ + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all list members) */ + + NEXT_PHASE(ctx); + case 2: + /* + * Read in all "end of content" TLVs. + */ + while (ctx->left < 0) + { + if (LEFT < 2) + { + if (LEFT > 0 && ((const char *)ptr)[0] != 0) + { + /* Unexpected tag */ + RETURN(RC_FAIL); + } + else + { + RETURN(RC_WMORE); + } + } + if (((const char *)ptr)[0] == 0 && + ((const char *)ptr)[1] == 0) + { + ADVANCE(2); + ctx->left++; + } + else + { + RETURN(RC_FAIL); + } + } + + PHASE_OUT(ctx); } - PHASE_OUT(ctx); - } - RETURN(RC_OK); } /* * Internally visible buffer holding a single encoded element. */ -struct _el_buffer { +struct _el_buffer +{ uint8_t *buf; size_t length; size_t size; }; /* Append bytes to the above structure */ -static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { +static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) +{ struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; - if(el_buf->length + size > el_buf->size) - return -1; + if (el_buf->length + size > el_buf->size) return -1; memcpy(el_buf->buf + el_buf->length, buffer, size); el_buf->length += size; return 0; } -static int _el_buf_cmp(const void *ap, const void *bp) { +static int _el_buf_cmp(const void *ap, const void *bp) +{ const struct _el_buffer *a = (const struct _el_buffer *)ap; const struct _el_buffer *b = (const struct _el_buffer *)bp; int ret; size_t common_len; - if(a->length < b->length) + if (a->length < b->length) common_len = a->length; else common_len = b->length; ret = memcmp(a->buf, b->buf, common_len); - if(ret == 0) { - if(a->length < b->length) - ret = -1; - else if(a->length > b->length) - ret = 1; - } + if (ret == 0) + { + if (a->length < b->length) + ret = -1; + else if (a->length > b->length) + ret = 1; + } return ret; } @@ -309,10 +361,10 @@ static int _el_buf_cmp(const void *ap, const void *bp) { /* * The DER encoder of the SET OF type. */ -asn_enc_rval_t -SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_TYPE_descriptor_t *elm_type = elm->type; der_type_encoder_f *der_encoder = elm_type->der_encoder; @@ -331,93 +383,99 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; - /* Compute maximum encoding's size */ - if(max_encoded_len < (size_t)erval.encoded) - max_encoded_len = erval.encoded; - } + /* Compute maximum encoding's size */ + if (max_encoded_len < (size_t)erval.encoded) + max_encoded_len = erval.encoded; + } /* * Encode the TLV for the sequence itself. */ - encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, - cb, app_key); - if(encoding_size == -1) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } + encoding_size = + der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + if (encoding_size == -1) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } computed_size += encoding_size; - if(!cb || list->count == 0) { - erval.encoded = computed_size; - _ASN_ENCODED_OK(erval); - } + if (!cb || list->count == 0) + { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } /* * DER mandates dynamic sorting of the SET OF elements * according to their encodings. Build an array of the * encoded elements. */ - encoded_els = (struct _el_buffer *)MALLOC( - list->count * sizeof(encoded_els[0])); - if(encoded_els == NULL) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } - - ASN_DEBUG("Encoding members of %s SET OF", td->name); - - /* - * Encode all members. - */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - struct _el_buffer *encoded_el = &encoded_els[eels_count]; - - if(!memb_ptr) continue; - - /* - * Prepare space for encoding. - */ - encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); - if(encoded_el->buf) { - encoded_el->length = 0; - encoded_el->size = max_encoded_len; - } else { - for(edx--; edx >= 0; edx--) - FREEMEM(encoded_els[edx].buf); - FREEMEM(encoded_els); + encoded_els = + (struct _el_buffer *)MALLOC(list->count * sizeof(encoded_els[0])); + if (encoded_els == NULL) + { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } - /* - * Encode the member into the prepared space. - */ - erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, - _el_addbytes, encoded_el); - if(erval.encoded == -1) { - for(; edx >= 0; edx--) - FREEMEM(encoded_els[edx].buf); - FREEMEM(encoded_els); - return erval; + ASN_DEBUG("Encoding members of %s SET OF", td->name); + + /* + * Encode all members. + */ + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + struct _el_buffer *encoded_el = &encoded_els[eels_count]; + + if (!memb_ptr) continue; + + /* + * Prepare space for encoding. + */ + encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); + if (encoded_el->buf) + { + encoded_el->length = 0; + encoded_el->size = max_encoded_len; + } + else + { + for (edx--; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + /* + * Encode the member into the prepared space. + */ + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, _el_addbytes, + encoded_el); + if (erval.encoded == -1) + { + for (; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + return erval; + } + encoding_size += erval.encoded; + eels_count++; } - encoding_size += erval.encoded; - eels_count++; - } /* * Sort the encoded elements according to their encoding. @@ -429,46 +487,54 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, * Dispose of temporary sorted members table. */ ret = 0; - for(edx = 0; edx < eels_count; edx++) { - struct _el_buffer *encoded_el = &encoded_els[edx]; - /* Report encoded chunks to the application */ - if(ret == 0 - && cb(encoded_el->buf, encoded_el->length, app_key) < 0) - ret = -1; - FREEMEM(encoded_el->buf); - } + for (edx = 0; edx < eels_count; edx++) + { + struct _el_buffer *encoded_el = &encoded_els[edx]; + /* Report encoded chunks to the application */ + if (ret == 0 && + cb(encoded_el->buf, encoded_el->length, app_key) < 0) + ret = -1; + FREEMEM(encoded_el->buf); + } FREEMEM(encoded_els); - if(ret || computed_size != (size_t)encoding_size) { - /* - * Standard callback failed, or - * encoded size is not equal to the computed size. - */ - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - } else { - erval.encoded = computed_size; - } + if (ret || computed_size != (size_t)encoding_size) + { + /* + * Standard callback failed, or + * encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } + else + { + erval.encoded = computed_size; + } _ASN_ENCODED_OK(erval); } -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ @@ -480,27 +546,30 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * ... and parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value from a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* Which tag is expected for the downstream */ - if(specs->as_XMLValueList) { - elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; - } else { - elm_tag = (*element->name) - ? element->name : element->type->xml_tag; - } + if (specs->as_XMLValueList) + { + elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; + } + else + { + elm_tag = (*element->name) ? element->name : element->type->xml_tag; + } /* * Restore parsing context. @@ -513,152 +582,163 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. */ - for(; ctx->phase <= 2;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ + for (; ctx->phase <= 2;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ - /* - * Go inside the inner member of a set. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; + /* + * Go inside the inner member of a set. + */ + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; - /* Invoke the inner type decoder, m.b. multiple times */ - ASN_DEBUG("XER/SET OF element [%s]", elm_tag); - tmprval = element->type->xer_decoder(opt_codec_ctx, - element->type, &ctx->ptr, elm_tag, - buf_ptr, size); - if(tmprval.code == RC_OK) { - asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); - if(ASN_SET_ADD(list, ctx->ptr) != 0) - RETURN(RC_FAIL); - ctx->ptr = 0; - XER_ADVANCE(tmprval.consumed); - } else { - XER_ADVANCE(tmprval.consumed); - RETURN(tmprval.code); - } - ctx->phase = 1; /* Back to body processing */ - ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); - /* Fall through */ - } + /* Invoke the inner type decoder, m.b. multiple times */ + ASN_DEBUG("XER/SET OF element [%s]", elm_tag); + tmprval = element->type->xer_decoder( + opt_codec_ctx, element->type, &ctx->ptr, elm_tag, + buf_ptr, size); + if (tmprval.code == RC_OK) + { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if (ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + ctx->ptr = 0; + XER_ADVANCE(tmprval.consumed); + } + else + { + XER_ADVANCE(tmprval.consumed); + RETURN(tmprval.code); + } + ctx->phase = 1; /* Back to body processing */ + ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); + /* Fall through */ + } - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, - buf_ptr, size, &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", - tcv, ctx->phase, xml_tag); - switch(tcv) { - case XCT_CLOSING: - if(ctx->phase == 0) break; - ctx->phase = 0; - /* Fall through */ - case XCT_BOTH: - if(ctx->phase == 0) { - /* No more things to decode */ - XER_ADVANCE(ch_size); - ctx->phase = 3; /* Phase out */ - RETURN(RC_OK); - } - /* Fall through */ - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", tcv, ctx->phase, + xml_tag); + switch (tcv) + { + case XCT_CLOSING: + if (ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if (ctx->phase == 0) + { + /* No more things to decode */ + XER_ADVANCE(ch_size); + ctx->phase = 3; /* Phase out */ + RETURN(RC_OK); + } + /* Fall through */ + case XCT_OPENING: + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: - ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); - if(ctx->phase == 1) { - /* - * Process a single possible member. - */ - ctx->phase = 2; - continue; - } - /* Fall through */ - default: + ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); + if (ctx->phase == 1) + { + /* + * Process a single possible member. + */ + ctx->phase = 2; + continue; + } + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SET OF"); break; } - ASN_DEBUG("Unexpected XML tag in SET OF"); - break; - } - - ctx->phase = 3; /* "Phase out" on hard failure */ + ctx->phase = 3; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } - - -typedef struct xer_tmp_enc_s { +typedef struct xer_tmp_enc_s +{ void *buffer; size_t offset; size_t size; } xer_tmp_enc_t; -static int -SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { +static int SET_OF_encode_xer_callback(const void *buffer, size_t size, + void *key) +{ xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; - if(t->offset + size >= t->size) { - size_t newsize = (t->size << 2) + size; - void *p = REALLOC(t->buffer, newsize); - if(!p) return -1; - t->buffer = p; - t->size = newsize; - } + if (t->offset + size >= t->size) + { + size_t newsize = (t->size << 2) + size; + void *p = REALLOC(t->buffer, newsize); + if (!p) return -1; + t->buffer = p; + t->size = newsize; + } memcpy((char *)t->buffer + t->offset, buffer, size); t->offset += size; return 0; } -static int -SET_OF_xer_order(const void *aptr, const void *bptr) { +static int SET_OF_xer_order(const void *aptr, const void *bptr) +{ const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; size_t minlen = a->offset; int ret; - if(b->offset < minlen) minlen = b->offset; + if (b->offset < minlen) minlen = b->offset; /* Well-formed UTF-8 has this nice lexicographical property... */ ret = memcmp(a->buffer, b->buffer, minlen); - if(ret != 0) return ret; - if(a->offset == b->offset) - return 0; - if(a->offset == minlen) - return -1; + if (ret != 0) return ret; + if (a->offset == b->offset) return 0; + if (a->offset == minlen) return -1; return 1; } - -asn_enc_rval_t -SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList - ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + ? 0 + : ((*elm->name) ? elm->name : elm->type->xml_tag); size_t mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); xer_tmp_enc_t *encs = 0; @@ -667,118 +747,130 @@ SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *original_cb = cb; int i; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; - if(xcan) { - encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); - if(!encs) _ASN_ENCODE_FAILED; - cb = SET_OF_encode_xer_callback; - } + if (xcan) + { + encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); + if (!encs) _ASN_ENCODE_FAILED; + cb = SET_OF_encode_xer_callback; + } er.encoded = 0; - for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; + for (i = 0; i < list->count; i++) + { + asn_enc_rval_t tmper; - void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - if(encs) { - memset(&encs[encs_count], 0, sizeof(encs[0])); - app_key = &encs[encs_count]; - encs_count++; - } + if (encs) + { + memset(&encs[encs_count], 0, sizeof(encs[0])); + app_key = &encs[encs_count]; + encs_count++; + } - if(mname) { - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - } + if (mname) + { + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } - if(!xcan && specs->as_XMLValueList == 1) - _i_ASN_TEXT_INDENT(1, ilevel + 1); - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + (specs->as_XMLValueList != 2), + if (!xcan && specs->as_XMLValueList == 1) + _i_ASN_TEXT_INDENT(1, ilevel + 1); + tmper = elm->type->xer_encoder( + elm->type, memb_ptr, ilevel + (specs->as_XMLValueList != 2), flags, cb, app_key); - if(tmper.encoded == -1) { - td = tmper.failed_type; - sptr = tmper.structure_ptr; - goto cb_failed; - } - if(tmper.encoded == 0 && specs->as_XMLValueList) { - const char *name = elm->type->xml_tag; - size_t len = strlen(name); - _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + if (tmper.encoded == -1) + { + td = tmper.failed_type; + sptr = tmper.structure_ptr; + goto cb_failed; + } + if (tmper.encoded == 0 && specs->as_XMLValueList) + { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if (mname) + { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; } - if(mname) { - _ASN_CALLBACK3("", 1); - er.encoded += 5; + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + if (encs) + { + xer_tmp_enc_t *enc = encs; + xer_tmp_enc_t *end = encs + encs_count; + ssize_t control_size = 0; + + cb = original_cb; + app_key = original_app_key; + qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); + + for (; enc < end; enc++) + { + _ASN_CALLBACK(enc->buffer, enc->offset); + FREEMEM(enc->buffer); + enc->buffer = 0; + control_size += enc->offset; + } + assert(control_size == er.encoded); } - er.encoded += (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); - - if(encs) { - xer_tmp_enc_t *enc = encs; - xer_tmp_enc_t *end = encs + encs_count; - ssize_t control_size = 0; - - cb = original_cb; - app_key = original_app_key; - qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); - - for(; enc < end; enc++) { - _ASN_CALLBACK(enc->buffer, enc->offset); - FREEMEM(enc->buffer); - enc->buffer = 0; - control_size += enc->offset; - } - assert(control_size == er.encoded); - } - goto cleanup; cb_failed: er.encoded = -1; er.failed_type = td; er.structure_ptr = sptr; cleanup: - if(encs) { - while(encs_count-- > 0) { - if(encs[encs_count].buffer) - FREEMEM(encs[encs_count].buffer); + if (encs) + { + while (encs_count-- > 0) + { + if (encs[encs_count].buffer) + FREEMEM(encs[encs_count].buffer); + } + FREEMEM(encs); } - FREEMEM(encs); - } _ASN_ENCODED_OK(er); } -int -SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int ret; int i; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ - if(cb(td->name, strlen(td->name), app_key) < 0 - || cb(" ::= {", 6, app_key) < 0) + if (cb(td->name, strlen(td->name), app_key) < 0 || + cb(" ::= {", 6, app_key) < 0) return -1; - for(i = 0; i < list->count; i++) { - const void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + for (i = 0; i < list->count; i++) + { + const void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - _i_INDENT(1); + _i_INDENT(1); - ret = elm->type->print_struct(elm->type, memb_ptr, - ilevel + 1, cb, app_key); - if(ret) return ret; - } + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, + app_key); + if (ret) return ret; + } ilevel--; _i_INDENT(1); @@ -786,163 +878,183 @@ SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, return (cb("}", 1, app_key) < 0) ? -1 : 0; } -void -SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { - if(td && ptr) { - asn_SET_OF_specifics_t *specs; - asn_TYPE_member_t *elm = td->elements; - asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); - asn_struct_ctx_t *ctx; /* Decoder context */ - int i; +void SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (td && ptr) + { + asn_SET_OF_specifics_t *specs; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + asn_struct_ctx_t *ctx; /* Decoder context */ + int i; - /* - * Could not use set_of_empty() because of (*free) - * incompatibility. - */ - for(i = 0; i < list->count; i++) { - void *memb_ptr = list->array[i]; - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); + /* + * Could not use set_of_empty() because of (*free) + * incompatibility. + */ + for (i = 0; i < list->count; i++) + { + void *memb_ptr = list->array[i]; + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + list->count = 0; /* No meaningful elements left */ + + asn_set_empty(list); /* Remove (list->array) */ + + specs = (asn_SET_OF_specifics_t *)td->specifics; + ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); + if (ctx->ptr) + { + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + } + + if (!contents_only) + { + FREEMEM(ptr); + } } - list->count = 0; /* No meaningful elements left */ - - asn_set_empty(list); /* Remove (list->array) */ - - specs = (asn_SET_OF_specifics_t *)td->specifics; - ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); - if(ctx->ptr) { - ASN_STRUCT_FREE(*elm->type, ctx->ptr); - ctx->ptr = 0; - } - - if(!contents_only) { - FREEMEM(ptr); - } - } } -int -SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_constr_check_f *constr; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int i; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } constr = elm->memb_constraints; - if(!constr) constr = elm->type->check_constraints; + if (!constr) constr = elm->type->check_constraints; /* * Iterate over the members of an array. * Validate each in turn, until one fails. */ - for(i = 0; i < list->count; i++) { - const void *memb_ptr = list->array[i]; - int ret; + for (i = 0; i < list->count; i++) + { + const void *memb_ptr = list->array[i]; + int ret; - if(!memb_ptr) continue; + if (!memb_ptr) continue; - ret = constr(elm->type, memb_ptr, ctfailcb, app_key); - if(ret) return ret; - } + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); + if (ret) return ret; + } /* * Cannot inherit it eralier: * need to make sure we get the updated version. */ - if(!elm->memb_constraints) + if (!elm->memb_constraints) elm->memb_constraints = elm->type->check_constraints; return 0; } -asn_dec_rval_t -SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rv; - asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; - asn_TYPE_member_t *elm = td->elements; /* Single one */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ void *st = *sptr; asn_anonymous_set_ *list; asn_per_constraint_t *ct; int repeat = 0; ssize_t nelems; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; /* * Create the target structure if it is not present already. */ - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ - if(constraints) ct = &constraints->size; - else if(td->per_constraints) ct = &td->per_constraints->size; - else ct = 0; + if (constraints) + ct = &constraints->size; + else if (td->per_constraints) + ct = &td->per_constraints->size; + else + ct = 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - int value = per_get_few_bits(pd, 1); - if(value < 0) _ASN_DECODE_STARVED; - if(value) ct = 0; /* Not restricted! */ - } - - if(ct && ct->effective_bits >= 0) { - /* X.691, #19.5: No length determinant */ - nelems = per_get_few_bits(pd, ct->effective_bits); - ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", - (long)nelems, ct->lower_bound, td->name); - if(nelems < 0) _ASN_DECODE_STARVED; - nelems += ct->lower_bound; - } else { - nelems = -1; - } - - do { - int i; - if(nelems < 0) { - nelems = uper_get_length(pd, - ct ? ct->effective_bits : -1, &repeat); - ASN_DEBUG("Got to decode %d elements (eff %d)", - (int)nelems, (long)ct ? ct->effective_bits : -1); - if(nelems < 0) _ASN_DECODE_STARVED; + if (ct && ct->flags & APC_EXTENSIBLE) + { + int value = per_get_few_bits(pd, 1); + if (value < 0) _ASN_DECODE_STARVED; + if (value) ct = 0; /* Not restricted! */ } - for(ssize_t k = 0; k < nelems; k++) { - void *ptr = 0; - ASN_DEBUG("SET OF %s decoding", elm->type->name); - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, &ptr, pd); - ASN_DEBUG("%s SET OF %s decoded %d, %p", - td->name, elm->type->name, rv.code, ptr); - if(rv.code == RC_OK) { - if(ASN_SET_ADD(list, ptr) == 0) - continue; - ASN_DEBUG("Failed to add element into %s", - td->name); - /* Fall through */ - rv.code = RC_FAIL; - } else { - ASN_DEBUG("Failed decoding %s of %s (SET OF)", - elm->type->name, td->name); - } - if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); - return rv; + if (ct && ct->effective_bits >= 0) + { + /* X.691, #19.5: No length determinant */ + nelems = per_get_few_bits(pd, ct->effective_bits); + ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if (nelems < 0) _ASN_DECODE_STARVED; + nelems += ct->lower_bound; + } + else + { + nelems = -1; } - nelems = -1; /* Allow uper_get_length() */ - } while(repeat); + do + { + int i; + if (nelems < 0) + { + nelems = uper_get_length(pd, ct ? ct->effective_bits : -1, + &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", (int)nelems, + (long)ct ? ct->effective_bits : -1); + if (nelems < 0) _ASN_DECODE_STARVED; + } + + for (ssize_t k = 0; k < nelems; k++) + { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = + elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", td->name, + elm->type->name, rv.code, ptr); + if (rv.code == RC_OK) + { + if (ASN_SET_ADD(list, ptr) == 0) continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } + else + { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if (ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } + while (repeat); ASN_DEBUG("Decoded %s as SET OF", td->name); diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.h b/src/core/libs/supl/asn-rrlp/constr_SET_OF.h index 202afab57..2b9d3a020 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SET_OF.h +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.h @@ -15,8 +15,8 @@ extern "C" typedef struct asn_SET_OF_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ @@ -25,8 +25,8 @@ extern "C" } asn_SET_OF_specifics_t; /* - * A set specialized functions dealing with the SET OF type. - */ + * A set specialized functions dealing with the SET OF type. + */ asn_struct_free_f SET_OF_free; asn_struct_print_f SET_OF_print; asn_constr_check_f SET_OF_constraint; diff --git a/src/core/libs/supl/asn-rrlp/constr_TYPE.c b/src/core/libs/supl/asn-rrlp/constr_TYPE.c index 4102276b9..05c70989d 100644 --- a/src/core/libs/supl/asn-rrlp/constr_TYPE.c +++ b/src/core/libs/supl/asn-rrlp/constr_TYPE.c @@ -16,15 +16,13 @@ static asn_app_consume_bytes_f _print2fp; /* * Return the outmost tag of the type. */ -ber_tlv_tag_t -asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { +ber_tlv_tag_t asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, int tag_mode, + ber_tlv_tag_t tag) +{ + if (tag_mode) return tag; - if(tag_mode) - return tag; - - if(type_descriptor->tags_count) - return type_descriptor->tags[0]; + if (type_descriptor->tags_count) return type_descriptor->tags[0]; return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); } @@ -32,43 +30,41 @@ asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, /* * Print the target language's structure in human readable form. */ -int -asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) { - if(!stream) stream = stdout; - if(!td || !struct_ptr) { - errno = EINVAL; - return -1; - } +int asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) +{ + if (!stream) stream = stdout; + if (!td || !struct_ptr) + { + errno = EINVAL; + return -1; + } /* Invoke type-specific printer */ - if(td->print_struct(td, struct_ptr, 1, _print2fp, stream)) - return -1; + if (td->print_struct(td, struct_ptr, 1, _print2fp, stream)) return -1; /* Terminate the output */ - if(_print2fp("\n", 1, stream)) - return -1; + if (_print2fp("\n", 1, stream)) return -1; return fflush(stream); } /* Dump the data into the specified stdio stream */ -static int -_print2fp(const void *buffer, size_t size, void *app_key) { +static int _print2fp(const void *buffer, size_t size, void *app_key) +{ FILE *stream = (FILE *)app_key; - if(fwrite(buffer, 1, size, stream) != size) - return -1; + if (fwrite(buffer, 1, size, stream) != size) return -1; return 0; } - /* * Some compilers do not support variable args macros. * This function is a replacement of ASN_DEBUG() macro. */ void ASN_DEBUG_f(const char *fmt, ...); -void ASN_DEBUG_f(const char *fmt, ...) { +void ASN_DEBUG_f(const char *fmt, ...) +{ va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); diff --git a/src/core/libs/supl/asn-rrlp/constr_TYPE.h b/src/core/libs/supl/asn-rrlp/constr_TYPE.h index e920d3d6e..3af569530 100644 --- a/src/core/libs/supl/asn-rrlp/constr_TYPE.h +++ b/src/core/libs/supl/asn-rrlp/constr_TYPE.h @@ -24,10 +24,11 @@ extern "C" struct asn_TYPE_member_s; /* Forward declaration */ /* - * This type provides the context information for various ASN.1 routines, - * primarily ones doing decoding. A member _asn_ctx of this type must be - * included into certain target language's structures, such as compound types. - */ + * This type provides the context information for various ASN.1 routines, + * primarily ones doing decoding. A member _asn_ctx of this type must be + * included into certain target language's structures, such as compound + * types. + */ typedef struct asn_struct_ctx_s { short phase; /* Decoding phase */ @@ -46,53 +47,51 @@ extern "C" #include /* Subtype constraints support */ /* - * Free the structure according to its specification. - * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) - * will not be freed. (It may be useful in case the structure is allocated - * statically or arranged on the stack, yet its elements are allocated - * dynamically.) - */ + * Free the structure according to its specification. + * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) + * will not be freed. (It may be useful in case the structure is allocated + * statically or arranged on the stack, yet its elements are allocated + * dynamically.) + */ typedef void(asn_struct_free_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - void *struct_ptr, int free_contents_only); + struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, + int free_contents_only); #define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF), ptr, 0) #define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ (asn_DEF).free_struct(&(asn_DEF), ptr, 1) /* - * Print the structure according to its specification. - */ + * Print the structure according to its specification. + */ typedef int(asn_struct_print_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, /* Indentation level */ asn_app_consume_bytes_f *callback, void *app_key); /* - * Return the outmost tag of the type. - * If the type is untagged CHOICE, the dynamic operation is performed. - * NOTE: This function pointer type is only useful internally. - * Do not use it in your application. - */ + * Return the outmost tag of the type. + * If the type is untagged CHOICE, the dynamic operation is performed. + * NOTE: This function pointer type is only useful internally. + * Do not use it in your application. + */ typedef ber_tlv_tag_t(asn_outmost_tag_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, + int tag_mode, ber_tlv_tag_t tag); /* The instance of the above function type; used internally. */ asn_outmost_tag_f asn_TYPE_outmost_tag; - /* - * The definitive description of the destination language's structure. - */ + * The definitive description of the destination language's structure. + */ typedef struct asn_TYPE_descriptor_s { char *name; /* A name of the ASN.1 type. "" in some cases. */ char *xml_tag; /* Name used in XML tag */ /* - * Generalized functions for dealing with the specific type. - * May be directly invoked by applications. - */ + * Generalized functions for dealing with the specific type. + * May be directly invoked by applications. + */ asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_constr_check_f *check_constraints; /* Constraints validator */ @@ -104,37 +103,37 @@ extern "C" per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ /*********************************************************************** - * Internally useful members. Not to be used by applications directly. * - **********************************************************************/ + * Internally useful members. Not to be used by applications directly. * + **********************************************************************/ /* - * Tags that are expected to occur. - */ + * Tags that are expected to occur. + */ asn_outmost_tag_f *outmost_tag; /* */ - ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ - int tags_count; /* Number of tags which are expected */ - ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ - int all_tags_count; /* Number of tags */ + ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ + int tags_count; /* Number of tags which are expected */ + ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ + int all_tags_count; /* Number of tags */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ /* - * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). - */ + * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). + */ struct asn_TYPE_member_s *elements; int elements_count; /* - * Additional information describing the type, used by appropriate - * functions above. - */ + * Additional information describing the type, used by appropriate + * functions above. + */ void *specifics; } asn_TYPE_descriptor_t; /* - * This type describes an element of the constructed type, - * i.e. SEQUENCE, SET, CHOICE, etc. - */ + * This type describes an element of the constructed type, + * i.e. SEQUENCE, SET, CHOICE, etc. + */ enum asn_TYPE_flags_e { ATF_NOFLAGS, @@ -143,21 +142,21 @@ extern "C" }; typedef struct asn_TYPE_member_s { - enum asn_TYPE_flags_e flags; /* Element's presentation flags */ - int optional; /* Following optional members, including current */ - int memb_offset; /* Offset of the element */ - ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ - int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ - asn_TYPE_descriptor_t *type; /* Member type descriptor */ - asn_constr_check_f *memb_constraints; /* Constraints validator */ - asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + enum asn_TYPE_flags_e flags; /* Element's presentation flags */ + int optional; /* Following optional members, including current */ + int memb_offset; /* Offset of the element */ + ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ + int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_constr_check_f *memb_constraints; /* Constraints validator */ + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ int (*default_value)(int setval, void **sptr); /* DEFAULT */ - char *name; /* ASN.1 identifier of the element */ + char *name; /* ASN.1 identifier of the element */ } asn_TYPE_member_t; /* - * BER tag to element number mapping. - */ + * BER tag to element number mapping. + */ typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ @@ -167,17 +166,17 @@ extern "C" } asn_TYPE_tag2member_t; /* - * This function is a wrapper around (td)->print_struct, which prints out - * the contents of the target language's structure (struct_ptr) into the - * file pointer (stream) in human readable form. - * RETURN VALUES: - * 0: The structure is printed. - * -1: Problem dumping the structure. - * (See also xer_fprint() in xer_encoder.h) - */ - int asn_fprint(FILE *stream, /* Destination stream descriptor */ - asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ - const void *struct_ptr); /* Structure to be printed */ + * This function is a wrapper around (td)->print_struct, which prints out + * the contents of the target language's structure (struct_ptr) into the + * file pointer (stream) in human readable form. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem dumping the structure. + * (See also xer_fprint() in xer_encoder.h) + */ + int asn_fprint(FILE *stream, /* Destination stream descriptor */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr); /* Structure to be printed */ #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-rrlp/constraints.c b/src/core/libs/supl/asn-rrlp/constraints.c index c63087bff..ba03304f1 100644 --- a/src/core/libs/supl/asn-rrlp/constraints.c +++ b/src/core/libs/supl/asn-rrlp/constraints.c @@ -1,41 +1,43 @@ #include "asn_internal.h" #include "constraints.h" -int -asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { - - (void)type_descriptor; /* Unused argument */ - (void)struct_ptr; /* Unused argument */ - (void)cb; /* Unused argument */ - (void)key; /* Unused argument */ +int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *cb, void *key) +{ + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ /* Nothing to check */ return 0; } -int -asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { - - (void)type_descriptor; /* Unused argument */ - (void)struct_ptr; /* Unused argument */ - (void)cb; /* Unused argument */ - (void)key; /* Unused argument */ +int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *cb, void *key) +{ + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ /* Unknown how to check */ return 0; } -struct errbufDesc { +struct errbufDesc +{ asn_TYPE_descriptor_t *failed_type; const void *failed_struct_ptr; char *errbuf; size_t errlen; }; -static void -_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { +static void _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, + const void *sptr, const char *fmt, ...) +{ struct errbufDesc *arg = key; va_list ap; ssize_t vlen; @@ -45,34 +47,38 @@ _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const ch arg->failed_struct_ptr = sptr; maxlen = arg->errlen; - if(maxlen <= 0) - return; + if (maxlen <= 0) return; va_start(ap, fmt); vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); va_end(ap); - if(vlen >= maxlen) { - arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ - arg->errlen = maxlen - 1; /* Not counting termination */ - return; - } else if(vlen >= 0) { - arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ - arg->errlen = vlen; /* Not counting termination */ - } else { - /* - * The libc on this system is broken. - */ - vlen = sizeof("") - 1; - maxlen--; - arg->errlen = vlen < maxlen ? vlen : maxlen; - memcpy(arg->errbuf, "", arg->errlen); - arg->errbuf[arg->errlen] = 0; - } + if (vlen >= maxlen) + { + arg->errbuf[maxlen - 1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } + else if (vlen >= 0) + { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } + else + { + /* + * The libc on this system is broken. + */ + vlen = sizeof("") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "", arg->errlen); + arg->errbuf[arg->errlen] = 0; + } } -int -asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, char *errbuf, size_t *errlen) { +int asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) +{ struct errbufDesc arg; int ret; @@ -81,11 +87,9 @@ asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, arg.errbuf = errbuf; arg.errlen = errlen ? *errlen : 0; - ret = type_descriptor->check_constraints(type_descriptor, - struct_ptr, _asn_i_ctfailcb, &arg); - if(ret == -1 && errlen) - *errlen = arg.errlen; + ret = type_descriptor->check_constraints(type_descriptor, struct_ptr, + _asn_i_ctfailcb, &arg); + if (ret == -1 && errlen) *errlen = arg.errlen; return ret; } - diff --git a/src/core/libs/supl/asn-rrlp/constraints.h b/src/core/libs/supl/asn-rrlp/constraints.h index bc4fdb938..5d339e2ff 100644 --- a/src/core/libs/supl/asn-rrlp/constraints.h +++ b/src/core/libs/supl/asn-rrlp/constraints.h @@ -15,40 +15,39 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Validate the structure according to the ASN.1 constraints. - * If errbuf and errlen are given, they shall be pointing to the appropriate - * buffer space and its length before calling this function. Alternatively, - * they could be passed as NULL's. If constraints validation fails, - * errlen will contain the actual number of bytes taken from the errbuf - * to encode an error message (properly 0-terminated). - * - * RETURN VALUES: - * This function returns 0 in case all ASN.1 constraints are met - * and -1 if one or more constraints were failed. - */ - int asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, + * Validate the structure according to the ASN.1 constraints. + * If errbuf and errlen are given, they shall be pointing to the appropriate + * buffer space and its length before calling this function. Alternatively, + * they could be passed as NULL's. If constraints validation fails, + * errlen will contain the actual number of bytes taken from the errbuf + * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. + */ + int asn_check_constraints( + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, /* Target language's structure */ char *errbuf, /* Returned error description */ size_t *errlen /* Length of the error description */ ); - /* - * Generic type for constraint checking callback, - * associated with every type descriptor. - */ + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ typedef int(asn_constr_check_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *optional_callback, /* Log the error */ - void *optional_app_key /* Opaque key passed to a callback */ + void *optional_app_key /* Opaque key passed to a callback */ ); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ - asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ + asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ /* diff --git a/src/core/libs/supl/asn-rrlp/converter-sample.c b/src/core/libs/supl/asn-rrlp/converter-sample.c index fd401fa43..90b889405 100644 --- a/src/core/libs/supl/asn-rrlp/converter-sample.c +++ b/src/core/libs/supl/asn-rrlp/converter-sample.c @@ -7,75 +7,76 @@ * * cc -DPDU=MyCustomType -o myDecoder.o -c converter-sample.c */ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H #include #endif #include #include -#include /* for atoi(3) */ -#include /* for getopt(3) */ -#include /* for strerror(3) */ -#include /* for EX_* exit codes */ +#include /* for atoi(3) */ +#include /* for getopt(3) */ +#include /* for strerror(3) */ +#include /* for EX_* exit codes */ #include /* for errno */ #include -#include /* for _ASN_DEFAULT_STACK_MAX */ +#include /* for _ASN_DEFAULT_STACK_MAX */ /* Convert "Type" defined by -DPDU into "asn_DEF_Type" */ -#define ASN_DEF_PDU(t) asn_DEF_ ## t -#define DEF_PDU_Type(t) ASN_DEF_PDU(t) -#define PDU_Type DEF_PDU_Type(PDU) +#define ASN_DEF_PDU(t) asn_DEF_##t +#define DEF_PDU_Type(t) ASN_DEF_PDU(t) +#define PDU_Type DEF_PDU_Type(PDU) -extern asn_TYPE_descriptor_t PDU_Type; /* ASN.1 type to be decoded */ -#ifdef ASN_PDU_COLLECTION /* Generated by asn1c: -pdu=... */ +extern asn_TYPE_descriptor_t PDU_Type; /* ASN.1 type to be decoded */ +#ifdef ASN_PDU_COLLECTION /* Generated by asn1c: -pdu=... */ extern asn_TYPE_descriptor_t *asn_pdu_collection[]; #endif /* * Open file and parse its contents. */ -static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, - FILE *file, const char *name, ssize_t suggested_bufsize, int first_pdu); +static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, + const char *name, ssize_t suggested_bufsize, + int first_pdu); static int write_out(const void *buffer, size_t size, void *key); static FILE *argument_to_file(char *av[], int idx); static char *argument_to_name(char *av[], int idx); - int opt_debug; /* -d (or -dd) */ -static int opt_check; /* -c (constraints checking) */ -static int opt_stack; /* -s (maximum stack size) */ -static int opt_nopad; /* -per-nopad (PER input is not padded) */ -static int opt_onepdu; /* -1 (decode single PDU) */ +int opt_debug; /* -d (or -dd) */ +static int opt_check; /* -c (constraints checking) */ +static int opt_stack; /* -s (maximum stack size) */ +static int opt_nopad; /* -per-nopad (PER input is not padded) */ +static int opt_onepdu; /* -1 (decode single PDU) */ /* Input data format selector */ static enum input_format { - INP_BER, /* -iber: BER input */ - INP_XER, /* -ixer: XER input */ - INP_PER /* -iper: Unaligned PER input */ -} iform; /* -i */ + INP_BER, /* -iber: BER input */ + INP_XER, /* -ixer: XER input */ + INP_PER /* -iper: Unaligned PER input */ +} iform; /* -i */ /* Output data format selector */ static enum output_format { - OUT_XER, /* -oxer: XER (XML) output */ - OUT_DER, /* -oder: DER (BER) output */ - OUT_PER, /* -oper: Unaligned PER output */ - OUT_TEXT, /* -otext: semi-structured text */ - OUT_NULL /* -onull: No pretty-printing */ -} oform; /* -o */ + OUT_XER, /* -oxer: XER (XML) output */ + OUT_DER, /* -oder: DER (BER) output */ + OUT_PER, /* -oper: Unaligned PER output */ + OUT_TEXT, /* -otext: semi-structured text */ + OUT_NULL /* -onull: No pretty-printing */ +} oform; /* -o */ -#ifdef JUNKTEST /* Enable -J */ -#define JUNKOPT "J:" -static double opt_jprob; /* Junk bit probability */ -static int junk_failures; -static void junk_bytes_with_probability(uint8_t *, size_t, double prob); +#ifdef JUNKTEST /* Enable -J */ +#define JUNKOPT "J:" +static double opt_jprob; /* Junk bit probability */ +static int junk_failures; +static void junk_bytes_with_probability(uint8_t *, size_t, double prob); #else -#define JUNKOPT +#define JUNKOPT #endif /* Debug output function */ -static inline void -DEBUG(const char *fmt, ...) { +static inline void DEBUG(const char *fmt, ...) +{ va_list ap; - if(!opt_debug) return; + if (!opt_debug) return; fprintf(stderr, "AD: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); @@ -83,472 +84,560 @@ DEBUG(const char *fmt, ...) { fprintf(stderr, "\n"); } -int -main(int ac, char *av[]) { +int main(int ac, char *av[]) +{ static asn_TYPE_descriptor_t *pduType = &PDU_Type; - ssize_t suggested_bufsize = 8192; /* close or equal to stdio buffer */ + ssize_t suggested_bufsize = 8192; /* close or equal to stdio buffer */ int number_of_iterations = 1; int num; int ch; /* Figure out if Unaligned PER needs to be default */ - if(pduType->uper_decoder) - iform = INP_PER; + if (pduType->uper_decoder) iform = INP_PER; /* * Process the command-line arguments. */ - while((ch = getopt(ac, av, "i:o:1b:cdn:p:hs:" JUNKOPT)) != -1) - switch(ch) { - case 'i': - if(optarg[0] == 'b') { iform = INP_BER; break; } - if(optarg[0] == 'x') { iform = INP_XER; break; } - if(pduType->uper_decoder - && optarg[0] == 'p') { iform = INP_PER; break; } - fprintf(stderr, "-i: '%s': improper format selector\n", - optarg); - exit(EX_UNAVAILABLE); - case 'o': - if(optarg[0] == 'd') { oform = OUT_DER; break; } - if(pduType->uper_encoder - && optarg[0] == 'p') { oform = OUT_PER; break; } - if(optarg[0] == 'x') { oform = OUT_XER; break; } - if(optarg[0] == 't') { oform = OUT_TEXT; break; } - if(optarg[0] == 'n') { oform = OUT_NULL; break; } - fprintf(stderr, "-o: '%s': improper format selector\n", - optarg); - exit(EX_UNAVAILABLE); - case '1': - opt_onepdu = 1; - break; - case 'b': - suggested_bufsize = atoi(optarg); - if(suggested_bufsize < 1 - || suggested_bufsize > 16 * 1024 * 1024) { - fprintf(stderr, - "-b %s: Improper buffer size (1..16M)\n", - optarg); - exit(EX_UNAVAILABLE); - } - break; - case 'c': - opt_check = 1; - break; - case 'd': - opt_debug++; /* Double -dd means ASN.1 debug */ - break; - case 'n': - number_of_iterations = atoi(optarg); - if(number_of_iterations < 1) { - fprintf(stderr, - "-n %s: Improper iterations count\n", optarg); - exit(EX_UNAVAILABLE); - } - break; - case 'p': - if(strcmp(optarg, "er-nopad") == 0) { - opt_nopad = 1; - break; - } -#ifdef ASN_PDU_COLLECTION - if(strcmp(optarg, "list") == 0) { - asn_TYPE_descriptor_t **pdu = asn_pdu_collection; - fprintf(stderr, "Available PDU types:\n"); - for(; *pdu; pdu++) printf("%s\n", (*pdu)->name); - exit(0); - } else if(optarg[0] >= 'A' && optarg[0] <= 'Z') { - asn_TYPE_descriptor_t **pdu = asn_pdu_collection; - while(*pdu && strcmp((*pdu)->name, optarg)) pdu++; - if(*pdu) { pduType = *pdu; break; } - fprintf(stderr, "-p %s: Unrecognized PDU\n", optarg); - } -#endif /* ASN_PDU_COLLECTION */ - fprintf(stderr, "-p %s: Unrecognized option\n", optarg); - exit(EX_UNAVAILABLE); - case 's': - opt_stack = atoi(optarg); - if(opt_stack < 0) { - fprintf(stderr, - "-s %s: Non-negative value expected\n", - optarg); - exit(EX_UNAVAILABLE); - } - break; -#ifdef JUNKTEST - case 'J': - opt_jprob = strtod(optarg, 0); - if(opt_jprob <= 0.0 || opt_jprob > 1.0) { - fprintf(stderr, - "-J %s: Probability range 0..1 expected \n", - optarg); - exit(EX_UNAVAILABLE); - } - break; -#endif /* JUNKTEST */ - case 'h': - default: -#ifdef ASN_CONVERTER_TITLE -#define _AXS(x) #x -#define _ASX(x) _AXS(x) - fprintf(stderr, "%s\n", _ASX(ASN_CONVERTER_TITLE)); + while ((ch = getopt(ac, av, "i:o:1b:cdn:p:hs:" JUNKOPT)) != -1) switch (ch) + { + case 'i': + if (optarg[0] == 'b') + { + iform = INP_BER; + break; + } + if (optarg[0] == 'x') + { + iform = INP_XER; + break; + } + if (pduType->uper_decoder && optarg[0] == 'p') + { + iform = INP_PER; + break; + } + fprintf(stderr, + "-i: '%s': improper format selector\n", + optarg); + exit(EX_UNAVAILABLE); + case 'o': + if (optarg[0] == 'd') + { + oform = OUT_DER; + break; + } + if (pduType->uper_encoder && optarg[0] == 'p') + { + oform = OUT_PER; + break; + } + if (optarg[0] == 'x') + { + oform = OUT_XER; + break; + } + if (optarg[0] == 't') + { + oform = OUT_TEXT; + break; + } + if (optarg[0] == 'n') + { + oform = OUT_NULL; + break; + } + fprintf(stderr, + "-o: '%s': improper format selector\n", + optarg); + exit(EX_UNAVAILABLE); + case '1': + opt_onepdu = 1; + break; + case 'b': + suggested_bufsize = atoi(optarg); + if (suggested_bufsize < 1 || + suggested_bufsize > 16 * 1024 * 1024) + { + fprintf(stderr, + "-b %s: Improper buffer size (1..16M)\n", + optarg); + exit(EX_UNAVAILABLE); + } + break; + case 'c': + opt_check = 1; + break; + case 'd': + opt_debug++; /* Double -dd means ASN.1 debug */ + break; + case 'n': + number_of_iterations = atoi(optarg); + if (number_of_iterations < 1) + { + fprintf(stderr, + "-n %s: Improper iterations count\n", + optarg); + exit(EX_UNAVAILABLE); + } + break; + case 'p': + if (strcmp(optarg, "er-nopad") == 0) + { + opt_nopad = 1; + break; + } +#ifdef ASN_PDU_COLLECTION + if (strcmp(optarg, "list") == 0) + { + asn_TYPE_descriptor_t **pdu = asn_pdu_collection; + fprintf(stderr, "Available PDU types:\n"); + for (; *pdu; pdu++) printf("%s\n", (*pdu)->name); + exit(0); + } + else if (optarg[0] >= 'A' && optarg[0] <= 'Z') + { + asn_TYPE_descriptor_t **pdu = asn_pdu_collection; + while (*pdu && strcmp((*pdu)->name, optarg)) pdu++; + if (*pdu) + { + pduType = *pdu; + break; + } + fprintf(stderr, "-p %s: Unrecognized PDU\n", + optarg); + } +#endif /* ASN_PDU_COLLECTION */ + fprintf(stderr, "-p %s: Unrecognized option\n", optarg); + exit(EX_UNAVAILABLE); + case 's': + opt_stack = atoi(optarg); + if (opt_stack < 0) + { + fprintf(stderr, + "-s %s: Non-negative value expected\n", + optarg); + exit(EX_UNAVAILABLE); + } + break; +#ifdef JUNKTEST + case 'J': + opt_jprob = strtod(optarg, 0); + if (opt_jprob <= 0.0 || opt_jprob > 1.0) + { + fprintf(stderr, + "-J %s: Probability range 0..1 expected \n", + optarg); + exit(EX_UNAVAILABLE); + } + break; +#endif /* JUNKTEST */ + case 'h': + default: +#ifdef ASN_CONVERTER_TITLE +#define _AXS(x) #x +#define _ASX(x) _AXS(x) + fprintf(stderr, "%s\n", _ASX(ASN_CONVERTER_TITLE)); #endif - fprintf(stderr, "Usage: %s [options] ...\n", av[0]); - fprintf(stderr, "Where options are:\n"); - if(pduType->uper_decoder) - fprintf(stderr, - " -iper Input is in Unaligned PER (Packed Encoding Rules) (DEFAULT)\n"); - fprintf(stderr, - " -iber Input is in BER (Basic Encoding Rules)%s\n", - iform == INP_PER ? "" : " (DEFAULT)"); - fprintf(stderr, - " -ixer Input is in XER (XML Encoding Rules)\n"); - if(pduType->uper_encoder) - fprintf(stderr, - " -oper Output in Unaligned PER (Packed Encoding Rules)\n"); - fprintf(stderr, - " -oder Output in DER (Distinguished Encoding Rules)\n" - " -oxer Output in XER (XML Encoding Rules) (DEFAULT)\n" - " -otext Output in plain semi-structured text (dump)\n" - " -onull Verify (decode) input, but do not output\n"); - if(pduType->uper_decoder) - fprintf(stderr, - " -per-nopad Assume PER PDUs are not padded (-iper)\n"); -#ifdef ASN_PDU_COLLECTION - fprintf(stderr, - " -p Specify PDU type to decode\n" - " -p list List available PDUs\n"); -#endif /* ASN_PDU_COLLECTION */ - fprintf(stderr, - " -1 Decode only the first PDU in file\n" - " -b Set the i/o buffer size (default is %ld)\n" - " -c Check ASN.1 constraints after decoding\n" - " -d Enable debugging (-dd is even better)\n" - " -n Process files times\n" - " -s Set the stack usage limit (default is %d)\n" -#ifdef JUNKTEST - " -J Set random junk test bit garbaging probability\n" + fprintf(stderr, "Usage: %s [options] ...\n", + av[0]); + fprintf(stderr, "Where options are:\n"); + if (pduType->uper_decoder) + fprintf( + stderr, + " -iper Input is in Unaligned PER (Packed " + "Encoding Rules) (DEFAULT)\n"); + fprintf(stderr, + " -iber Input is in BER (Basic Encoding " + "Rules)%s\n", + iform == INP_PER ? "" : " (DEFAULT)"); + fprintf(stderr, + " -ixer Input is in XER (XML Encoding " + "Rules)\n"); + if (pduType->uper_encoder) + fprintf( + stderr, + " -oper Output in Unaligned PER (Packed " + "Encoding " + "Rules)\n"); + fprintf( + stderr, + " -oder Output in DER (Distinguished Encoding " + "Rules)\n" + " -oxer Output in XER (XML Encoding Rules) " + "(DEFAULT)\n" + " -otext Output in plain semi-structured text " + "(dump)\n" + " -onull Verify (decode) input, but do not " + "output\n"); + if (pduType->uper_decoder) + fprintf(stderr, + " -per-nopad Assume PER PDUs are not padded " + "(-iper)\n"); +#ifdef ASN_PDU_COLLECTION + fprintf(stderr, + " -p Specify PDU type to decode\n" + " -p list List available PDUs\n"); +#endif /* ASN_PDU_COLLECTION */ + fprintf( + stderr, + " -1 Decode only the first PDU in file\n" + " -b Set the i/o buffer size (default is " + "%ld)\n" + " -c Check ASN.1 constraints after " + "decoding\n" + " -d Enable debugging (-dd is even better)\n" + " -n Process files times\n" + " -s Set the stack usage limit (default is " + "%d)\n" +#ifdef JUNKTEST + " -J Set random junk test bit garbaging " + "probability\n" #endif - , (long)suggested_bufsize, _ASN_DEFAULT_STACK_MAX); - exit(EX_USAGE); - } + , + (long)suggested_bufsize, _ASN_DEFAULT_STACK_MAX); + exit(EX_USAGE); + } ac -= optind; av += optind; - if(ac < 1) { - fprintf(stderr, "%s: No input files specified. " - "Try '-h' for more information\n", - av[-optind]); - exit(EX_USAGE); - } + if (ac < 1) + { + fprintf(stderr, + "%s: No input files specified. " + "Try '-h' for more information\n", + av[-optind]); + exit(EX_USAGE); + } setvbuf(stdout, 0, _IOLBF, 0); - for(num = 0; num < number_of_iterations; num++) { - int ac_i; - /* - * Process all files in turn. - */ - for(ac_i = 0; ac_i < ac; ac_i++) { - asn_enc_rval_t erv; - void *structure; /* Decoded structure */ - FILE *file = argument_to_file(av, ac_i); - char *name = argument_to_name(av, ac_i); - int first_pdu; + for (num = 0; num < number_of_iterations; num++) + { + int ac_i; + /* + * Process all files in turn. + */ + for (ac_i = 0; ac_i < ac; ac_i++) + { + asn_enc_rval_t erv; + void *structure; /* Decoded structure */ + FILE *file = argument_to_file(av, ac_i); + char *name = argument_to_name(av, ac_i); + int first_pdu; - for(first_pdu = 1; first_pdu || !opt_onepdu; first_pdu = 0) { - /* - * Decode the encoded structure from file. - */ - structure = data_decode_from_file(pduType, - file, name, suggested_bufsize, first_pdu); - if(!structure) { - if(errno) { - /* Error message is already printed */ - exit(EX_DATAERR); - } else { - /* EOF */ - break; - } - } + for (first_pdu = 1; first_pdu || !opt_onepdu; first_pdu = 0) + { + /* + * Decode the encoded structure from file. + */ + structure = data_decode_from_file( + pduType, file, name, suggested_bufsize, + first_pdu); + if (!structure) + { + if (errno) + { + /* Error message is already printed + */ + exit(EX_DATAERR); + } + else + { + /* EOF */ + break; + } + } - /* Check ASN.1 constraints */ - if(opt_check) { - char errbuf[128]; - size_t errlen = sizeof(errbuf); - if(asn_check_constraints(pduType, structure, - errbuf, &errlen)) { - fprintf(stderr, "%s: ASN.1 constraint " - "check failed: %s\n", name, errbuf); - exit(EX_DATAERR); - } - } + /* Check ASN.1 constraints */ + if (opt_check) + { + char errbuf[128]; + size_t errlen = sizeof(errbuf); + if (asn_check_constraints(pduType, + structure, errbuf, + &errlen)) + { + fprintf(stderr, + "%s: ASN.1 constraint " + "check failed: %s\n", + name, errbuf); + exit(EX_DATAERR); + } + } - switch(oform) { - case OUT_NULL: -#ifdef JUNKTEST - if(opt_jprob == 0.0) + switch (oform) + { + case OUT_NULL: +#ifdef JUNKTEST + if (opt_jprob == 0.0) #endif - fprintf(stderr, "%s: decoded successfully\n", name); - break; - case OUT_TEXT: /* -otext */ - asn_fprint(stdout, pduType, structure); - break; - case OUT_XER: /* -oxer */ - if(xer_fprint(stdout, pduType, structure)) { - fprintf(stderr, - "%s: Cannot convert %s into XML\n", - name, pduType->name); - exit(EX_UNAVAILABLE); - } - break; - case OUT_DER: - erv = der_encode(pduType, structure, write_out, stdout); - if(erv.encoded < 0) { - fprintf(stderr, - "%s: Cannot convert %s into DER\n", - name, pduType->name); - exit(EX_UNAVAILABLE); - } - DEBUG("Encoded in %ld bytes of DER", (long)erv.encoded); - break; - case OUT_PER: - erv = uper_encode(pduType, structure, write_out, stdout); - if(erv.encoded < 0) { - fprintf(stderr, - "%s: Cannot convert %s into Unaligned PER\n", - name, pduType->name); - exit(EX_UNAVAILABLE); - } - DEBUG("Encoded in %ld bits of UPER", (long)erv.encoded); - break; + fprintf( + stderr, + "%s: decoded successfully\n", + name); + break; + case OUT_TEXT: /* -otext */ + asn_fprint(stdout, pduType, structure); + break; + case OUT_XER: /* -oxer */ + if (xer_fprint(stdout, pduType, + structure)) + { + fprintf(stderr, + "%s: Cannot convert %s " + "into XML\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + break; + case OUT_DER: + erv = der_encode(pduType, structure, + write_out, stdout); + if (erv.encoded < 0) + { + fprintf(stderr, + "%s: Cannot convert %s " + "into DER\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + DEBUG("Encoded in %ld bytes of DER", + (long)erv.encoded); + break; + case OUT_PER: + erv = uper_encode(pduType, structure, + write_out, stdout); + if (erv.encoded < 0) + { + fprintf(stderr, + "%s: Cannot convert %s " + "into Unaligned PER\n", + name, pduType->name); + exit(EX_UNAVAILABLE); + } + DEBUG("Encoded in %ld bits of UPER", + (long)erv.encoded); + break; + } + + ASN_STRUCT_FREE(*pduType, structure); + } + + if (file && file != stdin) fclose(file); + } } - ASN_STRUCT_FREE(*pduType, structure); +#ifdef JUNKTEST + if (opt_jprob > 0.0) + { + fprintf(stderr, "Junked %f OK (%d/%d)\n", opt_jprob, junk_failures, + number_of_iterations); } - - if(file && file != stdin) - fclose(file); - } - } - -#ifdef JUNKTEST - if(opt_jprob > 0.0) { - fprintf(stderr, "Junked %f OK (%d/%d)\n", - opt_jprob, junk_failures, number_of_iterations); - } -#endif /* JUNKTEST */ +#endif /* JUNKTEST */ return 0; } -static struct dynamic_buffer { - uint8_t *data; /* Pointer to the data bytes */ - size_t offset; /* Offset from the start */ - size_t length; /* Length of meaningful contents */ - size_t unbits; /* Unused bits in the last byte */ +static struct dynamic_buffer +{ + uint8_t *data; /* Pointer to the data bytes */ + size_t offset; /* Offset from the start */ + size_t length; /* Length of meaningful contents */ + size_t unbits; /* Unused bits in the last byte */ size_t allocated; /* Allocated memory for data */ - int nreallocs; /* Number of data reallocations */ - off_t bytes_shifted; /* Number of bytes ever shifted */ + int nreallocs; /* Number of data reallocations */ + off_t bytes_shifted; /* Number of bytes ever shifted */ } DynamicBuffer; -static void -buffer_dump() { +static void buffer_dump() +{ uint8_t *p = DynamicBuffer.data + DynamicBuffer.offset; uint8_t *e = p + DynamicBuffer.length - (DynamicBuffer.unbits ? 1 : 0); - if(!opt_debug) return; + if (!opt_debug) return; DEBUG("Buffer: { d=%p, o=%ld, l=%ld, u=%ld, a=%ld, s=%ld }", - DynamicBuffer.data, - (long)DynamicBuffer.offset, - (long)DynamicBuffer.length, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.allocated, - (long)DynamicBuffer.bytes_shifted); - for(; p < e; p++) { - fprintf(stderr, " %c%c%c%c%c%c%c%c", - ((*p >> 7) & 1) ? '1' : '0', - ((*p >> 6) & 1) ? '1' : '0', - ((*p >> 5) & 1) ? '1' : '0', - ((*p >> 4) & 1) ? '1' : '0', - ((*p >> 3) & 1) ? '1' : '0', - ((*p >> 2) & 1) ? '1' : '0', - ((*p >> 1) & 1) ? '1' : '0', - ((*p >> 0) & 1) ? '1' : '0'); - } - if(DynamicBuffer.unbits) { - unsigned int shift; - fprintf(stderr, " "); - for(shift = 7; shift >= DynamicBuffer.unbits; shift--) - fprintf(stderr, "%c", ((*p >> shift) & 1) ? '1' : '0'); - fprintf(stderr, " %ld:%ld\n", - (long)DynamicBuffer.length - 1, - (long)8 - DynamicBuffer.unbits); - } else { - fprintf(stderr, " %ld\n", DynamicBuffer.length); - } + DynamicBuffer.data, (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated, (long)DynamicBuffer.bytes_shifted); + for (; p < e; p++) + { + fprintf(stderr, " %c%c%c%c%c%c%c%c", ((*p >> 7) & 1) ? '1' : '0', + ((*p >> 6) & 1) ? '1' : '0', ((*p >> 5) & 1) ? '1' : '0', + ((*p >> 4) & 1) ? '1' : '0', ((*p >> 3) & 1) ? '1' : '0', + ((*p >> 2) & 1) ? '1' : '0', ((*p >> 1) & 1) ? '1' : '0', + ((*p >> 0) & 1) ? '1' : '0'); + } + if (DynamicBuffer.unbits) + { + unsigned int shift; + fprintf(stderr, " "); + for (shift = 7; shift >= DynamicBuffer.unbits; shift--) + fprintf(stderr, "%c", ((*p >> shift) & 1) ? '1' : '0'); + fprintf(stderr, " %ld:%ld\n", (long)DynamicBuffer.length - 1, + (long)8 - DynamicBuffer.unbits); + } + else + { + fprintf(stderr, " %ld\n", DynamicBuffer.length); + } } /* * Move the buffer content left N bits, possibly joining it with * preceding content. */ -static void -buffer_shift_left(size_t offset, int bits) { +static void buffer_shift_left(size_t offset, int bits) +{ uint8_t *ptr = DynamicBuffer.data + DynamicBuffer.offset + offset; - uint8_t *end = DynamicBuffer.data + DynamicBuffer.offset - + DynamicBuffer.length - 1; + uint8_t *end = + DynamicBuffer.data + DynamicBuffer.offset + DynamicBuffer.length - 1; - if(!bits) return; + if (!bits) return; - DEBUG("Shifting left %d bits off %ld (o=%ld, u=%ld, l=%ld)", - bits, (long)offset, - (long)DynamicBuffer.offset, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.length); + DEBUG("Shifting left %d bits off %ld (o=%ld, u=%ld, l=%ld)", bits, + (long)offset, (long)DynamicBuffer.offset, (long)DynamicBuffer.unbits, + (long)DynamicBuffer.length); - if(offset) { - int right; - right = ptr[0] >> (8 - bits); + if (offset) + { + int right; + right = ptr[0] >> (8 - bits); - DEBUG("oleft: %c%c%c%c%c%c%c%c", - ((ptr[-1] >> 7) & 1) ? '1' : '0', - ((ptr[-1] >> 6) & 1) ? '1' : '0', - ((ptr[-1] >> 5) & 1) ? '1' : '0', - ((ptr[-1] >> 4) & 1) ? '1' : '0', - ((ptr[-1] >> 3) & 1) ? '1' : '0', - ((ptr[-1] >> 2) & 1) ? '1' : '0', - ((ptr[-1] >> 1) & 1) ? '1' : '0', - ((ptr[-1] >> 0) & 1) ? '1' : '0'); + DEBUG("oleft: %c%c%c%c%c%c%c%c", ((ptr[-1] >> 7) & 1) ? '1' : '0', + ((ptr[-1] >> 6) & 1) ? '1' : '0', + ((ptr[-1] >> 5) & 1) ? '1' : '0', + ((ptr[-1] >> 4) & 1) ? '1' : '0', + ((ptr[-1] >> 3) & 1) ? '1' : '0', + ((ptr[-1] >> 2) & 1) ? '1' : '0', + ((ptr[-1] >> 1) & 1) ? '1' : '0', + ((ptr[-1] >> 0) & 1) ? '1' : '0'); - DEBUG("oriht: %c%c%c%c%c%c%c%c", - ((ptr[0] >> 7) & 1) ? '1' : '0', - ((ptr[0] >> 6) & 1) ? '1' : '0', - ((ptr[0] >> 5) & 1) ? '1' : '0', - ((ptr[0] >> 4) & 1) ? '1' : '0', - ((ptr[0] >> 3) & 1) ? '1' : '0', - ((ptr[0] >> 2) & 1) ? '1' : '0', - ((ptr[0] >> 1) & 1) ? '1' : '0', - ((ptr[0] >> 0) & 1) ? '1' : '0'); + DEBUG("oriht: %c%c%c%c%c%c%c%c", ((ptr[0] >> 7) & 1) ? '1' : '0', + ((ptr[0] >> 6) & 1) ? '1' : '0', + ((ptr[0] >> 5) & 1) ? '1' : '0', + ((ptr[0] >> 4) & 1) ? '1' : '0', + ((ptr[0] >> 3) & 1) ? '1' : '0', + ((ptr[0] >> 2) & 1) ? '1' : '0', + ((ptr[0] >> 1) & 1) ? '1' : '0', + ((ptr[0] >> 0) & 1) ? '1' : '0'); - DEBUG("mriht: %c%c%c%c%c%c%c%c", - ((right >> 7) & 1) ? '1' : '0', - ((right >> 6) & 1) ? '1' : '0', - ((right >> 5) & 1) ? '1' : '0', - ((right >> 4) & 1) ? '1' : '0', - ((right >> 3) & 1) ? '1' : '0', - ((right >> 2) & 1) ? '1' : '0', - ((right >> 1) & 1) ? '1' : '0', - ((right >> 0) & 1) ? '1' : '0'); + DEBUG( + "mriht: %c%c%c%c%c%c%c%c", ((right >> 7) & 1) ? '1' : '0', + ((right >> 6) & 1) ? '1' : '0', ((right >> 5) & 1) ? '1' : '0', + ((right >> 4) & 1) ? '1' : '0', ((right >> 3) & 1) ? '1' : '0', + ((right >> 2) & 1) ? '1' : '0', ((right >> 1) & 1) ? '1' : '0', + ((right >> 0) & 1) ? '1' : '0'); - ptr[-1] = (ptr[-1] & (0xff << bits)) | right; + ptr[-1] = (ptr[-1] & (0xff << bits)) | right; - DEBUG("after: %c%c%c%c%c%c%c%c", - ((ptr[-1] >> 7) & 1) ? '1' : '0', - ((ptr[-1] >> 6) & 1) ? '1' : '0', - ((ptr[-1] >> 5) & 1) ? '1' : '0', - ((ptr[-1] >> 4) & 1) ? '1' : '0', - ((ptr[-1] >> 3) & 1) ? '1' : '0', - ((ptr[-1] >> 2) & 1) ? '1' : '0', - ((ptr[-1] >> 1) & 1) ? '1' : '0', - ((ptr[-1] >> 0) & 1) ? '1' : '0'); - } + DEBUG("after: %c%c%c%c%c%c%c%c", ((ptr[-1] >> 7) & 1) ? '1' : '0', + ((ptr[-1] >> 6) & 1) ? '1' : '0', + ((ptr[-1] >> 5) & 1) ? '1' : '0', + ((ptr[-1] >> 4) & 1) ? '1' : '0', + ((ptr[-1] >> 3) & 1) ? '1' : '0', + ((ptr[-1] >> 2) & 1) ? '1' : '0', + ((ptr[-1] >> 1) & 1) ? '1' : '0', + ((ptr[-1] >> 0) & 1) ? '1' : '0'); + } buffer_dump(); - for(; ptr < end; ptr++) { - int right = ptr[1] >> (8 - bits); - *ptr = (*ptr << bits) | right; - } + for (; ptr < end; ptr++) + { + int right = ptr[1] >> (8 - bits); + *ptr = (*ptr << bits) | right; + } *ptr <<= bits; DEBUG("Unbits [%d=>", (int)DynamicBuffer.unbits); - if(DynamicBuffer.unbits == 0) { - DynamicBuffer.unbits += bits; - } else { - DynamicBuffer.unbits += bits; - if(DynamicBuffer.unbits > 7) { - DynamicBuffer.unbits -= 8; - DynamicBuffer.length--; - DynamicBuffer.bytes_shifted++; + if (DynamicBuffer.unbits == 0) + { + DynamicBuffer.unbits += bits; + } + else + { + DynamicBuffer.unbits += bits; + if (DynamicBuffer.unbits > 7) + { + DynamicBuffer.unbits -= 8; + DynamicBuffer.length--; + DynamicBuffer.bytes_shifted++; + } } - } DEBUG("Unbits =>%d]", (int)DynamicBuffer.unbits); buffer_dump(); - DEBUG("Shifted. Now (o=%ld, u=%ld l=%ld)", - (long)DynamicBuffer.offset, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.length); - - + DEBUG("Shifted. Now (o=%ld, u=%ld l=%ld)", (long)DynamicBuffer.offset, + (long)DynamicBuffer.unbits, (long)DynamicBuffer.length); } /* * Ensure that the buffer contains at least this amount of free space. */ -static void add_bytes_to_buffer(const void *data2add, size_t bytes) { +static void add_bytes_to_buffer(const void *data2add, size_t bytes) +{ + if (bytes == 0) return; - if(bytes == 0) return; + DEBUG("=> add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", (long)bytes, + (long)DynamicBuffer.offset, (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated); - DEBUG("=> add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", - (long)bytes, - (long)DynamicBuffer.offset, - (long)DynamicBuffer.length, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.allocated); - - if(DynamicBuffer.allocated - >= (DynamicBuffer.offset + DynamicBuffer.length + bytes)) { - DEBUG("\tNo buffer reallocation is necessary"); - } else if(bytes <= DynamicBuffer.offset) { - DEBUG("\tContents shifted by %ld", DynamicBuffer.offset); - - /* Shift the buffer contents */ - memmove(DynamicBuffer.data, - DynamicBuffer.data + DynamicBuffer.offset, - DynamicBuffer.length); - DynamicBuffer.bytes_shifted += DynamicBuffer.offset; - DynamicBuffer.offset = 0; - } else { - size_t newsize = (DynamicBuffer.allocated << 2) + bytes; - void *p = MALLOC(newsize); - if(!p) { - perror("malloc()"); - exit(EX_OSERR); + if (DynamicBuffer.allocated >= + (DynamicBuffer.offset + DynamicBuffer.length + bytes)) + { + DEBUG("\tNo buffer reallocation is necessary"); } - memcpy(p, - DynamicBuffer.data + DynamicBuffer.offset, - DynamicBuffer.length); - FREEMEM(DynamicBuffer.data); - DynamicBuffer.data = (uint8_t *)p; - DynamicBuffer.offset = 0; - DynamicBuffer.allocated = newsize; - DynamicBuffer.nreallocs++; - DEBUG("\tBuffer reallocated to %ld (%d time)", - newsize, DynamicBuffer.nreallocs); - } + else if (bytes <= DynamicBuffer.offset) + { + DEBUG("\tContents shifted by %ld", DynamicBuffer.offset); - memcpy(DynamicBuffer.data - + DynamicBuffer.offset + DynamicBuffer.length, - data2add, bytes); + /* Shift the buffer contents */ + memmove(DynamicBuffer.data, + DynamicBuffer.data + DynamicBuffer.offset, + DynamicBuffer.length); + DynamicBuffer.bytes_shifted += DynamicBuffer.offset; + DynamicBuffer.offset = 0; + } + else + { + size_t newsize = (DynamicBuffer.allocated << 2) + bytes; + void *p = MALLOC(newsize); + if (!p) + { + perror("malloc()"); + exit(EX_OSERR); + } + memcpy(p, DynamicBuffer.data + DynamicBuffer.offset, + DynamicBuffer.length); + FREEMEM(DynamicBuffer.data); + DynamicBuffer.data = (uint8_t *)p; + DynamicBuffer.offset = 0; + DynamicBuffer.allocated = newsize; + DynamicBuffer.nreallocs++; + DEBUG("\tBuffer reallocated to %ld (%d time)", newsize, + DynamicBuffer.nreallocs); + } + + memcpy(DynamicBuffer.data + DynamicBuffer.offset + DynamicBuffer.length, + data2add, bytes); DynamicBuffer.length += bytes; - if(DynamicBuffer.unbits) { - int bits = DynamicBuffer.unbits; - DynamicBuffer.unbits = 0; - buffer_shift_left(DynamicBuffer.length - bytes, bits); - } + if (DynamicBuffer.unbits) + { + int bits = DynamicBuffer.unbits; + DynamicBuffer.unbits = 0; + buffer_shift_left(DynamicBuffer.length - bytes, bits); + } - DEBUG("<= add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", - (long)bytes, - (long)DynamicBuffer.offset, - (long)DynamicBuffer.length, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.allocated); + DEBUG("<= add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", (long)bytes, + (long)DynamicBuffer.offset, (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated); } -static void * -data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *name, ssize_t suggested_bufsize, int on_first_pdu) { +static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, + const char *name, ssize_t suggested_bufsize, + int on_first_pdu) +{ static uint8_t *fbuf; static ssize_t fbuf_size; static asn_codec_ctx_t s_codec_ctx; @@ -560,37 +649,42 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na int tolerate_eof; size_t rd; - if(!file) { - fprintf(stderr, "%s: %s\n", name, strerror(errno)); - errno = EINVAL; - return 0; - } + if (!file) + { + fprintf(stderr, "%s: %s\n", name, strerror(errno)); + errno = EINVAL; + return 0; + } - if(opt_stack) { - s_codec_ctx.max_stack_size = opt_stack; - opt_codec_ctx = &s_codec_ctx; - } + if (opt_stack) + { + s_codec_ctx.max_stack_size = opt_stack; + opt_codec_ctx = &s_codec_ctx; + } DEBUG("Processing %s", name); /* prepare the file buffer */ - if(fbuf_size != suggested_bufsize) { - fbuf = (uint8_t *)REALLOC(fbuf, suggested_bufsize); - if(!fbuf) { - perror("realloc()"); - exit(EX_OSERR); + if (fbuf_size != suggested_bufsize) + { + fbuf = (uint8_t *)REALLOC(fbuf, suggested_bufsize); + if (!fbuf) + { + perror("realloc()"); + exit(EX_OSERR); + } + fbuf_size = suggested_bufsize; } - fbuf_size = suggested_bufsize; - } - if(on_first_pdu) { - DynamicBuffer.offset = 0; - DynamicBuffer.length = 0; - DynamicBuffer.unbits = 0; - DynamicBuffer.allocated = 0; - DynamicBuffer.bytes_shifted = 0; - DynamicBuffer.nreallocs = 0; - } + if (on_first_pdu) + { + DynamicBuffer.offset = 0; + DynamicBuffer.length = 0; + DynamicBuffer.unbits = 0; + DynamicBuffer.allocated = 0; + DynamicBuffer.bytes_shifted = 0; + DynamicBuffer.nreallocs = 0; + } old_offset = DynamicBuffer.bytes_shifted + DynamicBuffer.offset; @@ -598,124 +692,135 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na rval.code = RC_WMORE; rval.consumed = 0; - for(tolerate_eof = 1; /* Allow EOF first time buffer is non-empty */ - (rd = fread(fbuf, 1, fbuf_size, file)) - || feof(file) == 0 - || (tolerate_eof && DynamicBuffer.length) - ;) { - int ecbits = 0; /* Extra consumed bits in case of PER */ - uint8_t *i_bptr; - size_t i_size; + for (tolerate_eof = 1; /* Allow EOF first time buffer is non-empty */ + (rd = fread(fbuf, 1, fbuf_size, file)) || feof(file) == 0 || + (tolerate_eof && DynamicBuffer.length);) + { + int ecbits = 0; /* Extra consumed bits in case of PER */ + uint8_t *i_bptr; + size_t i_size; - /* - * Copy the data over, or use the original buffer. - */ - if(DynamicBuffer.allocated) { - /* Append new data into the existing dynamic buffer */ - add_bytes_to_buffer(fbuf, rd); - i_bptr = DynamicBuffer.data + DynamicBuffer.offset; - i_size = DynamicBuffer.length; - } else { - i_bptr = fbuf; - i_size = rd; - } + /* + * Copy the data over, or use the original buffer. + */ + if (DynamicBuffer.allocated) + { + /* Append new data into the existing dynamic buffer */ + add_bytes_to_buffer(fbuf, rd); + i_bptr = DynamicBuffer.data + DynamicBuffer.offset; + i_size = DynamicBuffer.length; + } + else + { + i_bptr = fbuf; + i_size = rd; + } - DEBUG("Decoding %ld bytes", (long)i_size); + DEBUG("Decoding %ld bytes", (long)i_size); -#ifdef JUNKTEST - junk_bytes_with_probability(i_bptr, i_size, opt_jprob); +#ifdef JUNKTEST + junk_bytes_with_probability(i_bptr, i_size, opt_jprob); #endif - switch(iform) { - case INP_BER: - rval = ber_decode(opt_codec_ctx, pduType, - &structure, i_bptr, i_size); - break; - case INP_XER: - rval = xer_decode(opt_codec_ctx, pduType, - &structure, i_bptr, i_size); - break; - case INP_PER: - if(opt_nopad) - rval = uper_decode(opt_codec_ctx, pduType, - &structure, i_bptr, i_size, 0, - DynamicBuffer.unbits); - else - rval = uper_decode_complete(opt_codec_ctx, pduType, - &structure, i_bptr, i_size); - switch(rval.code) { - case RC_OK: - /* Fall through */ - case RC_FAIL: - if(opt_nopad) { - /* uper_decode() returns bits! */ - /* Extra bits */ - ecbits = rval.consumed % 8; - /* Convert into bytes! */ - rval.consumed /= 8; + switch (iform) + { + case INP_BER: + rval = ber_decode(opt_codec_ctx, pduType, &structure, + i_bptr, i_size); + break; + case INP_XER: + rval = xer_decode(opt_codec_ctx, pduType, &structure, + i_bptr, i_size); + break; + case INP_PER: + if (opt_nopad) + rval = uper_decode(opt_codec_ctx, pduType, + &structure, i_bptr, i_size, 0, + DynamicBuffer.unbits); + else + rval = uper_decode_complete(opt_codec_ctx, pduType, + &structure, i_bptr, + i_size); + switch (rval.code) + { + case RC_OK: + /* Fall through */ + case RC_FAIL: + if (opt_nopad) + { + /* uper_decode() returns bits! */ + /* Extra bits */ + ecbits = rval.consumed % 8; + /* Convert into bytes! */ + rval.consumed /= 8; + } + break; + case RC_WMORE: + /* PER does not support restartability */ + ASN_STRUCT_FREE(*pduType, structure); + structure = 0; + rval.consumed = 0; + /* Continue accumulating data */ + break; + } + break; + } + DEBUG("decode(%ld) consumed %ld+%db (%ld), code %d", + (long)DynamicBuffer.length, (long)rval.consumed, ecbits, + (long)i_size, rval.code); + + if (DynamicBuffer.allocated == 0) + { + /* + * Flush remainder into the intermediate buffer. + */ + if (rval.code != RC_FAIL && rval.consumed < rd) + { + add_bytes_to_buffer(fbuf + rval.consumed, + rd - rval.consumed); + buffer_shift_left(0, ecbits); + DynamicBuffer.bytes_shifted = rval.consumed; + rval.consumed = 0; + ecbits = 0; + } } - break; - case RC_WMORE: - /* PER does not support restartability */ - ASN_STRUCT_FREE(*pduType, structure); - structure = 0; - rval.consumed = 0; - /* Continue accumulating data */ - break; - } - break; - } - DEBUG("decode(%ld) consumed %ld+%db (%ld), code %d", - (long)DynamicBuffer.length, - (long)rval.consumed, ecbits, (long)i_size, - rval.code); - if(DynamicBuffer.allocated == 0) { /* - * Flush remainder into the intermediate buffer. + * Adjust position inside the source buffer. */ - if(rval.code != RC_FAIL && rval.consumed < rd) { - add_bytes_to_buffer(fbuf + rval.consumed, - rd - rval.consumed); - buffer_shift_left(0, ecbits); - DynamicBuffer.bytes_shifted = rval.consumed; - rval.consumed = 0; - ecbits = 0; - } - } + if (DynamicBuffer.allocated) + { + DynamicBuffer.offset += rval.consumed; + DynamicBuffer.length -= rval.consumed; + } + else + { + DynamicBuffer.bytes_shifted += rval.consumed; + } - /* - * Adjust position inside the source buffer. - */ - if(DynamicBuffer.allocated) { - DynamicBuffer.offset += rval.consumed; - DynamicBuffer.length -= rval.consumed; - } else { - DynamicBuffer.bytes_shifted += rval.consumed; - } - - switch(rval.code) { - case RC_OK: - if(ecbits) buffer_shift_left(0, ecbits); - DEBUG("RC_OK, finishing up with %ld+%d", - (long)rval.consumed, ecbits); - return structure; - case RC_WMORE: - DEBUG("RC_WMORE, continuing read=%ld, cons=%ld " - " with %ld..%ld-%ld..%ld", - (long)rd, - (long)rval.consumed, - (long)DynamicBuffer.offset, - (long)DynamicBuffer.length, - (long)DynamicBuffer.unbits, - (long)DynamicBuffer.allocated); - if(!rd) tolerate_eof--; - continue; - case RC_FAIL: + switch (rval.code) + { + case RC_OK: + if (ecbits) buffer_shift_left(0, ecbits); + DEBUG("RC_OK, finishing up with %ld+%d", + (long)rval.consumed, ecbits); + return structure; + case RC_WMORE: + DEBUG( + "RC_WMORE, continuing read=%ld, cons=%ld " + " with %ld..%ld-%ld..%ld", + (long)rd, (long)rval.consumed, + (long)DynamicBuffer.offset, + (long)DynamicBuffer.length, + (long)DynamicBuffer.unbits, + (long)DynamicBuffer.allocated); + if (!rd) tolerate_eof--; + continue; + case RC_FAIL: + break; + } break; } - break; - } DEBUG("Clean up partially decoded structure"); ASN_STRUCT_FREE(*pduType, structure); @@ -726,108 +831,116 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na * Print a message and return failure only if not EOF, * unless this is our first PDU (empty file). */ - if(on_first_pdu - || DynamicBuffer.length - || new_offset - old_offset > ((iform == INP_XER)?sizeof("\r\n")-1:0) - ) { + if (on_first_pdu || DynamicBuffer.length || + new_offset - old_offset > ((iform == INP_XER) ? sizeof("\r\n") - 1 : 0)) + { +#ifdef JUNKTEST + /* + * Nothing's wrong with being unable to decode junk. + * Simulate EOF. + */ + if (opt_jprob != 0.0) + { + junk_failures++; + errno = 0; + return 0; + } +#endif -#ifdef JUNKTEST - /* - * Nothing's wrong with being unable to decode junk. - * Simulate EOF. - */ - if(opt_jprob != 0.0) { - junk_failures++; - errno = 0; - return 0; + DEBUG("ofp %d, no=%ld, oo=%ld, dbl=%ld", on_first_pdu, + (long)new_offset, (long)old_offset, + (long)DynamicBuffer.length); + fprintf(stderr, + "%s: " + "Decode failed past byte %ld: %s\n", + name, (long)new_offset, + (rval.code == RC_WMORE) ? "Unexpected end of input" + : "Input processing error"); +#ifndef ENOMSG +#define ENOMSG EINVAL +#endif +#ifndef EBADMSG +#define EBADMSG EINVAL +#endif + errno = (rval.code == RC_WMORE) ? ENOMSG : EBADMSG; + } + else + { + /* Got EOF after a few successful PDUs */ + errno = 0; } -#endif - - DEBUG("ofp %d, no=%ld, oo=%ld, dbl=%ld", - on_first_pdu, (long)new_offset, (long)old_offset, - (long)DynamicBuffer.length); - fprintf(stderr, "%s: " - "Decode failed past byte %ld: %s\n", - name, (long)new_offset, - (rval.code == RC_WMORE) - ? "Unexpected end of input" - : "Input processing error"); -#ifndef ENOMSG -#define ENOMSG EINVAL -#endif -#ifndef EBADMSG -#define EBADMSG EINVAL -#endif - errno = (rval.code == RC_WMORE) ? ENOMSG : EBADMSG; - } else { - /* Got EOF after a few successful PDUs */ - errno = 0; - } return 0; } /* Dump the buffer out to the specified FILE */ -static int write_out(const void *buffer, size_t size, void *key) { +static int write_out(const void *buffer, size_t size, void *key) +{ FILE *fp = (FILE *)key; return (fwrite(buffer, 1, size, fp) == size) ? 0 : -1; } -static int argument_is_stdin(char *av[], int idx) { - if(strcmp(av[idx], "-") != 0) { - return 0; /* Certainly not */ - } else { - /* This might be , unless `./program -- -` */ - if(strcmp(av[-1], "--") != 0) - return 1; - else - return 0; - } +static int argument_is_stdin(char *av[], int idx) +{ + if (strcmp(av[idx], "-") != 0) + { + return 0; /* Certainly not */ + } + else + { + /* This might be , unless `./program -- -` */ + if (strcmp(av[-1], "--") != 0) + return 1; + else + return 0; + } } -static FILE *argument_to_file(char *av[], int idx) { - return argument_is_stdin(av, idx) - ? stdin - : fopen(av[idx], "re"); +static FILE *argument_to_file(char *av[], int idx) +{ + return argument_is_stdin(av, idx) ? stdin : fopen(av[idx], "re"); } -static char *argument_to_name(char *av[], int idx) { - return argument_is_stdin(av, idx) - ? "standard input" - : av[idx]; +static char *argument_to_name(char *av[], int idx) +{ + return argument_is_stdin(av, idx) ? "standard input" : av[idx]; } -#ifdef JUNKTEST +#ifdef JUNKTEST /* * Fill bytes with some garbage with specified probability (more or less). */ -static void -junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) { +static void junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) +{ static int junkmode; uint8_t *ptr; uint8_t *end; - if(opt_jprob <= 0.0) return; - for(ptr = buf, end = ptr + size; ptr < end; ptr++) { - int byte = *ptr; - if(junkmode++ & 1) { - if((((double)random() / RAND_MAX) < prob)) - byte = random() & 0xff; - } else { -#define BPROB(b) ((((double)random() / RAND_MAX) < prob) ? b : 0) - byte ^= BPROB(0x80); - byte ^= BPROB(0x40); - byte ^= BPROB(0x20); - byte ^= BPROB(0x10); - byte ^= BPROB(0x08); - byte ^= BPROB(0x04); - byte ^= BPROB(0x02); - byte ^= BPROB(0x01); + if (opt_jprob <= 0.0) return; + for (ptr = buf, end = ptr + size; ptr < end; ptr++) + { + int byte = *ptr; + if (junkmode++ & 1) + { + if ((((double)random() / RAND_MAX) < prob)) + byte = random() & 0xff; + } + else + { +#define BPROB(b) ((((double)random() / RAND_MAX) < prob) ? b : 0) + byte ^= BPROB(0x80); + byte ^= BPROB(0x40); + byte ^= BPROB(0x20); + byte ^= BPROB(0x10); + byte ^= BPROB(0x08); + byte ^= BPROB(0x04); + byte ^= BPROB(0x02); + byte ^= BPROB(0x01); + } + if (byte != *ptr) + { + DEBUG("Junk buf[%d] %02x -> %02x", ptr - buf, *ptr, byte); + *ptr = byte; + } } - if(byte != *ptr) { - DEBUG("Junk buf[%d] %02x -> %02x", - ptr - buf, *ptr, byte); - *ptr = byte; - } - } } -#endif /* JUNKTEST */ +#endif /* JUNKTEST */ diff --git a/src/core/libs/supl/asn-rrlp/der_encoder.c b/src/core/libs/supl/asn-rrlp/der_encoder.c index 7187e2923..5c6aeab10 100644 --- a/src/core/libs/supl/asn-rrlp/der_encoder.c +++ b/src/core/libs/supl/asn-rrlp/der_encoder.c @@ -6,39 +6,40 @@ #include static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, - asn_app_consume_bytes_f *cb, void *app_key, int constructed); + asn_app_consume_bytes_f *cb, void *app_key, + int constructed); /* * The DER encoder of any type. */ -asn_enc_rval_t -der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, - asn_app_consume_bytes_f *consume_bytes, void *app_key) { - - ASN_DEBUG("DER encoder invoked for %s", - type_descriptor->name); +asn_enc_rval_t der_encode(asn_TYPE_descriptor_t *type_descriptor, + void *struct_ptr, + asn_app_consume_bytes_f *consume_bytes, void *app_key) +{ + ASN_DEBUG("DER encoder invoked for %s", type_descriptor->name); /* * Invoke type-specific encoder. */ - return type_descriptor->der_encoder(type_descriptor, - struct_ptr, /* Pointer to the destination structure */ - 0, 0, - consume_bytes, app_key); + return type_descriptor->der_encoder( + type_descriptor, struct_ptr, /* Pointer to the destination structure */ + 0, 0, consume_bytes, app_key); } /* * Argument type and callback necessary for der_encode_to_buffer(). */ -typedef struct enc_to_buf_arg { +typedef struct enc_to_buf_arg +{ void *buffer; size_t left; } enc_to_buf_arg; -static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) +{ enc_to_buf_arg *arg = (enc_to_buf_arg *)key; - if(arg->left < size) - return -1; /* Data exceeds the available buffer size */ + if (arg->left < size) + return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; @@ -50,150 +51,153 @@ static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { /* * A variant of the der_encode() which encodes the data into the provided buffer */ -asn_enc_rval_t -der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, - void *buffer, size_t buffer_size) { +asn_enc_rval_t der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, + void *struct_ptr, void *buffer, + size_t buffer_size) +{ enc_to_buf_arg arg; asn_enc_rval_t ec; arg.buffer = buffer; arg.left = buffer_size; - ec = type_descriptor->der_encoder(type_descriptor, - struct_ptr, /* Pointer to the destination structure */ + ec = type_descriptor->der_encoder( + type_descriptor, struct_ptr, /* Pointer to the destination structure */ 0, 0, encode_to_buffer_cb, &arg); - if(ec.encoded != -1) { - assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); - /* Return the encoded contents size */ - } + if (ec.encoded != -1) + { + assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); + /* Return the encoded contents size */ + } return ec; } - /* * Write out leading TL[v] sequence according to the type definition. */ -ssize_t -der_write_tags(asn_TYPE_descriptor_t *sd, - size_t struct_length, - int tag_mode, int last_tag_form, - ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ - asn_app_consume_bytes_f *cb, - void *app_key) { - ber_tlv_tag_t *tags; /* Copy of tags stream */ - int tags_count; /* Number of tags */ +ssize_t der_write_tags(asn_TYPE_descriptor_t *sd, size_t struct_length, + int tag_mode, int last_tag_form, + ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ + asn_app_consume_bytes_f *cb, void *app_key) +{ + ber_tlv_tag_t *tags; /* Copy of tags stream */ + int tags_count; /* Number of tags */ size_t overall_length; ssize_t *lens; int i; - ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", - sd->name, tag_mode, sd->tags_count, - ber_tlv_tag_string(tag), - tag_mode - ?(sd->tags_count+1 - -((tag_mode == -1) && sd->tags_count)) - :sd->tags_count - ); + ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", sd->name, + tag_mode, sd->tags_count, ber_tlv_tag_string(tag), + tag_mode + ? (sd->tags_count + 1 - ((tag_mode == -1) && sd->tags_count)) + : sd->tags_count); - if(tag_mode) { - /* - * Instead of doing shaman dance like we do in ber_check_tags(), - * allocate a small array on the stack - * and initialize it appropriately. - */ - int stag_offset; - tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); - if(!tags) { /* Can fail on !x86 */ + if (tag_mode) + { + /* + * Instead of doing shaman dance like we do in ber_check_tags(), + * allocate a small array on the stack + * and initialize it appropriately. + */ + int stag_offset; + tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * + sizeof(ber_tlv_tag_t)); + if (!tags) + { /* Can fail on !x86 */ + errno = ENOMEM; + return -1; + } + tags_count = sd->tags_count + + 1 /* EXPLICIT or IMPLICIT tag is given */ + - ((tag_mode == -1) && sd->tags_count); + /* Copy tags over */ + tags[0] = tag; + stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); + for (i = 1; i < tags_count; i++) + tags[i] = sd->tags[i + stag_offset]; + } + else + { + tags = sd->tags; + tags_count = sd->tags_count; + } + + /* No tags to write */ + if (tags_count == 0) return 0; + + lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); + if (!lens) + { errno = ENOMEM; return -1; } - tags_count = sd->tags_count - + 1 /* EXPLICIT or IMPLICIT tag is given */ - - ((tag_mode == -1) && sd->tags_count); - /* Copy tags over */ - tags[0] = tag; - stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); - for(i = 1; i < tags_count; i++) - tags[i] = sd->tags[i + stag_offset]; - } else { - tags = sd->tags; - tags_count = sd->tags_count; - } - - /* No tags to write */ - if(tags_count == 0) - return 0; - - lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); - if(!lens) { - errno = ENOMEM; - return -1; - } /* * Array of tags is initialized. * Now, compute the size of the TLV pairs, from right to left. */ overall_length = struct_length; - for(i = tags_count - 1; i >= 0; --i) { - lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); - if(lens[i] == -1) return -1; - overall_length += lens[i]; - lens[i] = overall_length - lens[i]; - } + for (i = tags_count - 1; i >= 0; --i) + { + lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); + if (lens[i] == -1) return -1; + overall_length += lens[i]; + lens[i] = overall_length - lens[i]; + } - if(!cb) return overall_length - struct_length; + if (!cb) return overall_length - struct_length; - ASN_DEBUG("%s %s TL sequence (%d elements)", - cb?"Encoding":"Estimating", sd->name, tags_count); + ASN_DEBUG("%s %s TL sequence (%d elements)", cb ? "Encoding" : "Estimating", + sd->name, tags_count); /* * Encode the TL sequence for real. */ - for(i = 0; i < tags_count; i++) { - ssize_t len; - int _constr; + for (i = 0; i < tags_count; i++) + { + ssize_t len; + int _constr; - /* Check if this tag happens to be constructed */ - _constr = (last_tag_form || i < (tags_count - 1)); + /* Check if this tag happens to be constructed */ + _constr = (last_tag_form || i < (tags_count - 1)); - len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); - if(len == -1) return -1; - } + len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); + if (len == -1) return -1; + } return overall_length - struct_length; } -static ssize_t -der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, - asn_app_consume_bytes_f *cb, void *app_key, - int constructed) { +static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, + int constructed) +{ uint8_t buf[32]; size_t size = 0; - int buf_size = cb?sizeof(buf):0; + int buf_size = cb ? sizeof(buf) : 0; ssize_t tmp; /* Serialize tag (T from TLV) into possibly zero-length buffer */ tmp = ber_tlv_tag_serialize(tag, buf, buf_size); - if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; + if (tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; size += tmp; /* Serialize length (L from TLV) into possibly zero-length buffer */ - tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); - if(tmp == -1) return -1; + tmp = der_tlv_length_serialize(len, buf + size, + buf_size ? buf_size - size : 0); + if (tmp == -1) return -1; size += tmp; - if(size > sizeof(buf)) - return -1; + if (size > sizeof(buf)) return -1; /* * If callback is specified, invoke it, and check its return value. */ - if(cb) { - if(constructed) *buf |= 0x20; - if(cb(buf, size, app_key) < 0) - return -1; - } + if (cb) + { + if (constructed) *buf |= 0x20; + if (cb(buf, size, app_key) < 0) return -1; + } return size; } diff --git a/src/core/libs/supl/asn-rrlp/der_encoder.h b/src/core/libs/supl/asn-rrlp/der_encoder.h index 3eafbc281..4a8e6d001 100644 --- a/src/core/libs/supl/asn-rrlp/der_encoder.h +++ b/src/core/libs/supl/asn-rrlp/der_encoder.h @@ -15,16 +15,17 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * The DER encoder of any type. May be invoked by the application. - * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). - */ + * The DER encoder of any type. May be invoked by the application. + * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). + */ asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, - void *struct_ptr, /* Structure to be encoded */ - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key /* Arbitrary callback argument */ + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ ); - /* A variant of der_encode() which encodes data into the pre-allocated buffer */ + /* A variant of der_encode() which encodes data into the pre-allocated + * buffer */ asn_enc_rval_t der_encode_to_buffer( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ @@ -33,33 +34,31 @@ extern "C" ); /* - * Type of the generic DER encoder. - */ + * Type of the generic DER encoder. + */ typedef asn_enc_rval_t(der_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); - /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Write out leading TL[v] sequence according to the type definition. - */ - ssize_t der_write_tags( - struct asn_TYPE_descriptor_s *type_descriptor, - size_t struct_length, - int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ - int last_tag_form, /* {0,!0}: prim, constructed */ - ber_tlv_tag_t tag, - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key); + * Write out leading TL[v] sequence according to the type definition. + */ + ssize_t der_write_tags(struct asn_TYPE_descriptor_s *type_descriptor, + size_t struct_length, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {0,!0}: prim, constructed */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-rrlp/per_decoder.c b/src/core/libs/supl/asn-rrlp/per_decoder.c index 813d23ea6..b5dd27229 100644 --- a/src/core/libs/supl/asn-rrlp/per_decoder.c +++ b/src/core/libs/supl/asn-rrlp/per_decoder.c @@ -7,87 +7,104 @@ * The complete encoding contains at least one byte, and is an integral * multiple of 8 bytes. */ -asn_dec_rval_t -uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { +asn_dec_rval_t uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buffer, size_t size) +{ asn_dec_rval_t rval; rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); - if(rval.consumed) { - /* - * We've always given 8-aligned data, - * so convert bits to integral bytes. - */ - rval.consumed += 7; - rval.consumed >>= 3; - } else if(rval.code == RC_OK) { - if(size) { - if(((uint8_t *)buffer)[0] == 0) { - rval.consumed = 1; /* 1 byte */ - } else { - ASN_DEBUG("Expecting single zeroed byte"); - rval.code = RC_FAIL; - } - } else { - /* Must contain at least 8 bits. */ - rval.code = RC_WMORE; + if (rval.consumed) + { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } + else if (rval.code == RC_OK) + { + if (size) + { + if (((uint8_t *)buffer)[0] == 0) + { + rval.consumed = 1; /* 1 byte */ + } + else + { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } + else + { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } } - } return rval; } -asn_dec_rval_t -uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { +asn_dec_rval_t uper_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buffer, size_t size, int skip_bits, + int unused_bits) +{ asn_codec_ctx_t s_codec_ctx; asn_dec_rval_t rval; asn_per_data_t pd; - if(skip_bits < 0 || skip_bits > 7 - || unused_bits < 0 || unused_bits > 7 - || (unused_bits > 0 && !size)) + if (skip_bits < 0 || skip_bits > 7 || unused_bits < 0 || unused_bits > 7 || + (unused_bits > 0 && !size)) _ASN_DECODE_FAILED; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* Fill in the position indicator */ memset(&pd, 0, sizeof(pd)); pd.buffer = (const uint8_t *)buffer; pd.nboff = skip_bits; pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ - if(pd.nboff > pd.nbits) - _ASN_DECODE_FAILED; + if (pd.nboff > pd.nbits) _ASN_DECODE_FAILED; /* * Invoke type-specific decoder. */ - if(!td->uper_decoder) - _ASN_DECODE_FAILED; /* PER is not compiled in */ + if (!td->uper_decoder) _ASN_DECODE_FAILED; /* PER is not compiled in */ rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); - if(rval.code == RC_OK) { - /* Return the number of consumed bits */ - rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) - + pd.nboff - skip_bits; - ASN_DEBUG("PER decoding consumed %d, counted %d", - rval.consumed, pd.moved); - assert(rval.consumed == pd.moved); - } else { - /* PER codec is not a restartable */ - rval.consumed = 0; - } + if (rval.code == RC_OK) + { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %d, counted %d", rval.consumed, + pd.moved); + assert(rval.consumed == pd.moved); + } + else + { + /* PER codec is not a restartable */ + rval.consumed = 0; + } return rval; } - diff --git a/src/core/libs/supl/asn-rrlp/per_decoder.h b/src/core/libs/supl/asn-rrlp/per_decoder.h index a28509464..ecb3b52eb 100644 --- a/src/core/libs/supl/asn-rrlp/per_decoder.h +++ b/src/core/libs/supl/asn-rrlp/per_decoder.h @@ -16,37 +16,40 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. - * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. - */ - asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per + * X.691#10.1.3. + */ + asn_dec_rval_t uper_decode_complete( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ - void **struct_ptr, /* Pointer to a target structure's pointer */ - const void *buffer, /* Data to be decoded */ - size_t size /* Size of data buffer */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ ); /* - * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. - * WARNING: This call returns the number of BITS read from the stream. Beware. - */ - asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + * Unaligned PER decoder of any ASN.1 type. May be invoked by the + * application. WARNING: This call returns the number of BITS read from the + * stream. Beware. + */ + asn_dec_rval_t uper_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ - void **struct_ptr, /* Pointer to a target structure's pointer */ - const void *buffer, /* Data to be decoded */ - size_t size, /* Size of data buffer */ - int skip_bits, /* Number of unused leading bits, 0..7 */ - int unused_bits /* Number of unused tailing bits, 0..7 */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ ); - /* - * Type of the type-specific PER decoder function. - */ - typedef asn_dec_rval_t(per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + * Type of the type-specific PER decoder function. + */ + typedef asn_dec_rval_t(per_type_decoder_f)( + asn_codec_ctx_t *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, - asn_per_constraints_t *constraints, - void **struct_ptr, + asn_per_constraints_t *constraints, void **struct_ptr, asn_per_data_t *per_data); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/per_encoder.c b/src/core/libs/supl/asn-rrlp/per_encoder.c index 831caeaf1..af7678a8b 100644 --- a/src/core/libs/supl/asn-rrlp/per_encoder.c +++ b/src/core/libs/supl/asn-rrlp/per_encoder.c @@ -2,25 +2,30 @@ #include #include -static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); +static asn_enc_rval_t uper_encode_internal( + asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, + void *sptr, asn_app_consume_bytes_f *cb, void *app_key); -asn_enc_rval_t -uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t uper_encode(asn_TYPE_descriptor_t *td, void *sptr, + asn_app_consume_bytes_f *cb, void *app_key) +{ return uper_encode_internal(td, 0, sptr, cb, app_key); } /* * Argument type and callback necessary for uper_encode_to_buffer(). */ -typedef struct enc_to_buf_arg { +typedef struct enc_to_buf_arg +{ void *buffer; size_t left; } enc_to_buf_arg; -static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) +{ enc_to_buf_arg *arg = (enc_to_buf_arg *)key; - if(arg->left < size) - return -1; /* Data exceeds the available buffer size */ + if (arg->left < size) + return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; @@ -29,68 +34,78 @@ static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { return 0; } -asn_enc_rval_t -uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { +asn_enc_rval_t uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, + void *buffer, size_t buffer_size) +{ enc_to_buf_arg key; key.buffer = buffer; key.left = buffer_size; - if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); + if (td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); } -typedef struct enc_dyn_arg { +typedef struct enc_dyn_arg +{ void *buffer; size_t length; size_t allocated; } enc_dyn_arg; -static int -encode_dyn_cb(const void *buffer, size_t size, void *key) { +static int encode_dyn_cb(const void *buffer, size_t size, void *key) +{ enc_dyn_arg *arg = key; - if(arg->length + size >= arg->allocated) { - void *p; - arg->allocated = arg->allocated ? (arg->allocated << 2) : size; - p = REALLOC(arg->buffer, arg->allocated); - if(!p) { - FREEMEM(arg->buffer); - memset(arg, 0, sizeof(*arg)); - return -1; + if (arg->length + size >= arg->allocated) + { + void *p; + arg->allocated = arg->allocated ? (arg->allocated << 2) : size; + p = REALLOC(arg->buffer, arg->allocated); + if (!p) + { + FREEMEM(arg->buffer); + memset(arg, 0, sizeof(*arg)); + return -1; + } + arg->buffer = p; } - arg->buffer = p; - } memcpy(((char *)arg->buffer) + arg->length, buffer, size); arg->length += size; return 0; } -ssize_t -uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { +ssize_t uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, void **buffer_r) +{ asn_enc_rval_t er; enc_dyn_arg key; memset(&key, 0, sizeof(key)); er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); - switch(er.encoded) { - case -1: - FREEMEM(key.buffer); - return -1; - case 0: - FREEMEM(key.buffer); - key.buffer = MALLOC(1); - if(key.buffer) { - *(char *)key.buffer = '\0'; - *buffer_r = key.buffer; - return 1; - } else { - return -1; + switch (er.encoded) + { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if (key.buffer) + { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } + else + { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %d bits", er.encoded); + return ((er.encoded + 7) >> 3); } - default: - *buffer_r = key.buffer; - ASN_DEBUG("Complete encoded in %d bits", er.encoded); - return ((er.encoded + 7) >> 3); - } } /* @@ -98,33 +113,37 @@ uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons */ /* Flush partially filled buffer */ -static int -_uper_encode_flush_outp(asn_per_outp_t *po) { +static int _uper_encode_flush_outp(asn_per_outp_t *po) +{ uint8_t *buf; - if(po->nboff == 0 && po->buffer == po->tmpspace) - return 0; + if (po->nboff == 0 && po->buffer == po->tmpspace) return 0; buf = po->buffer + (po->nboff >> 3); /* Make sure we account for the last, partially filled */ - if(po->nboff & 0x07) { - buf[0] &= 0xff << (8 - (po->nboff & 0x07)); - buf++; - } + if (po->nboff & 0x07) + { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); } -static asn_enc_rval_t -uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_per_outp_t po; asn_enc_rval_t er; /* * Invoke type-specific encoder. */ - if(!td || !td->uper_encoder) - _ASN_ENCODE_FAILED; /* PER is not compiled in */ + if (!td || !td->uper_encoder) + _ASN_ENCODE_FAILED; /* PER is not compiled in */ po.buffer = po.tmpspace; po.nboff = 0; @@ -134,18 +153,17 @@ uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constrain po.flushed_bytes = 0; er = td->uper_encoder(td, constraints, sptr, &po); - if(er.encoded != -1) { - size_t bits_to_flush; + if (er.encoded != -1) + { + size_t bits_to_flush; - bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; - /* Set number of bits encoded to a firm value */ - er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; - if(_uper_encode_flush_outp(&po)) - _ASN_ENCODE_FAILED; - } + if (_uper_encode_flush_outp(&po)) _ASN_ENCODE_FAILED; + } return er; } - diff --git a/src/core/libs/supl/asn-rrlp/per_encoder.h b/src/core/libs/supl/asn-rrlp/per_encoder.h index 6b96d5607..3c1568595 100644 --- a/src/core/libs/supl/asn-rrlp/per_encoder.h +++ b/src/core/libs/supl/asn-rrlp/per_encoder.h @@ -16,22 +16,23 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. - * WARNING: This function returns the number of encoded bits in the .encoded - * field of the return value. Use the following formula to convert to bytes: - * bytes = ((.encoded + 7) / 8) - */ - asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, + * Unaligned PER encoder of any ASN.1 type. May be invoked by the + * application. WARNING: This function returns the number of encoded bits in + * the .encoded field of the return value. Use the following formula to + * convert to bytes: bytes = ((.encoded + 7) / 8) + */ + asn_enc_rval_t uper_encode( + struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); /* - * A variant of uper_encode() which encodes data into the existing buffer - * WARNING: This function returns the number of encoded bits in the .encoded - * field of the return value. - */ + * A variant of uper_encode() which encodes data into the existing buffer + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. + */ asn_enc_rval_t uper_encode_to_buffer( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ @@ -40,12 +41,12 @@ extern "C" ); /* - * A variant of uper_encode_to_buffer() which allocates buffer itself. - * Returns the number of bytes in the buffer or -1 in case of failure. - * WARNING: This function produces a "Production of the complete encoding", - * with length of at least one octet. Contrast this to precise bit-packing - * encoding of uper_encode() and uper_encode_to_buffer(). - */ + * A variant of uper_encode_to_buffer() which allocates buffer itself. + * Returns the number of bytes in the buffer or -1 in case of failure. + * WARNING: This function produces a "Production of the complete encoding", + * with length of at least one octet. Contrast this to precise bit-packing + * encoding of uper_encode() and uper_encode_to_buffer(). + */ ssize_t uper_encode_to_new_buffer( struct asn_TYPE_descriptor_s *type_descriptor, asn_per_constraints_t *constraints, @@ -54,12 +55,11 @@ extern "C" ); /* - * Type of the generic PER encoder function. - */ + * Type of the generic PER encoder function. + */ typedef asn_enc_rval_t(per_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, - asn_per_constraints_t *constraints, - void *struct_ptr, + asn_per_constraints_t *constraints, void *struct_ptr, asn_per_outp_t *per_output); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/per_opentype.c b/src/core/libs/supl/asn-rrlp/per_opentype.c index 580bacefb..5a2921406 100644 --- a/src/core/libs/supl/asn-rrlp/per_opentype.c +++ b/src/core/libs/supl/asn-rrlp/per_opentype.c @@ -17,7 +17,10 @@ typedef struct uper_ugot_key static int uper_ugot_refill(asn_per_data_t *pd); static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); -static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd); int asn_debug_indent; @@ -25,7 +28,9 @@ int asn_debug_indent; * Encode an "open type field". * #10.1, #10.2 */ -int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) +int uper_open_type_put(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, + asn_per_outp_t *po) { void *buf; void *bptr; @@ -49,14 +54,14 @@ int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constra FREEMEM(buf); if (toGo) return -1; - ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", - td->name, size); + ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", td->name, + size); return 0; } -static asn_dec_rval_t -uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, +static asn_dec_rval_t uper_open_type_get_simple( + asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; @@ -101,8 +106,7 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, } while (repeat); - ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, - bufLen); + ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, bufLen); memset(&spd, 0, sizeof(spd)); spd.buffer = buf; @@ -144,8 +148,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } -static asn_dec_rval_t GCC_NOTUSED -uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, +static asn_dec_rval_t GCC_NOTUSED uper_open_type_get_complex( + asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { uper_ugot_key arg; @@ -154,8 +158,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, _ASN_STACK_OVERFLOW_CHECK(ctx); - ASN_DEBUG("Getting open type %s from %s", td->name, - per_data_string(pd)); + ASN_DEBUG("Getting open type %s from %s", td->name, per_data_string(pd)); arg.oldpd = *pd; arg.unclaimed = 0; arg.ot_moved = 0; @@ -187,9 +190,8 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, } ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name, - per_data_string(pd), - per_data_string(&arg.oldpd), - arg.unclaimed, arg.repeat); + per_data_string(pd), per_data_string(&arg.oldpd), arg.unclaimed, + arg.repeat); padding = pd->moved % 8; if (padding) @@ -197,8 +199,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, int32_t pvalue; if (padding > 7) { - ASN_DEBUG("Too large padding %d in open type", - padding); + ASN_DEBUG("Too large padding %d in open type", padding); rv.code = RC_FAIL; UPDRESTOREPD; return rv; @@ -208,23 +209,23 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, pvalue = per_get_few_bits(pd, padding); switch (pvalue) { - case -1: - ASN_DEBUG("Padding skip failed"); - UPDRESTOREPD; - _ASN_DECODE_STARVED; - case 0: - break; - default: - ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", - padding, (int)pvalue); - UPDRESTOREPD; - _ASN_DECODE_FAILED; + case -1: + ASN_DEBUG("Padding skip failed"); + UPDRESTOREPD; + _ASN_DECODE_STARVED; + case 0: + break; + default: + ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", padding, + (int)pvalue); + UPDRESTOREPD; + _ASN_DECODE_FAILED; } } if (pd->nboff != pd->nbits) { ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, - per_data_string(pd), per_data_string(&arg.oldpd)); + per_data_string(pd), per_data_string(&arg.oldpd)); if (1) { UPDRESTOREPD; @@ -245,16 +246,16 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, { switch (per_skip_bits(pd, arg.unclaimed)) { - case -1: - ASN_DEBUG("Claim of %d failed", arg.unclaimed); - _ASN_DECODE_STARVED; - case 0: - ASN_DEBUG("Got claim of %d", arg.unclaimed); - break; - default: - /* Padding must be blank */ - ASN_DEBUG("Non-blank unconsumed padding"); - _ASN_DECODE_FAILED; + case -1: + ASN_DEBUG("Claim of %d failed", arg.unclaimed); + _ASN_DECODE_STARVED; + case 0: + ASN_DEBUG("Got claim of %d", arg.unclaimed); + break; + default: + /* Padding must be blank */ + ASN_DEBUG("Non-blank unconsumed padding"); + _ASN_DECODE_FAILED; } arg.unclaimed = 0; } @@ -269,13 +270,12 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } - -asn_dec_rval_t -uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) +asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { - return uper_open_type_get_simple(ctx, td, constraints, - sptr, pd); + return uper_open_type_get_simple(ctx, td, constraints, sptr, pd); } int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) @@ -297,9 +297,10 @@ int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) * Internal functions. */ -static asn_dec_rval_t -uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; @@ -317,8 +318,7 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } -static int -uper_ugot_refill(asn_per_data_t *pd) +static int uper_ugot_refill(asn_per_data_t *pd) { uper_ugot_key *arg = pd->refill_key; ssize_t next_chunk_bytes; @@ -327,8 +327,8 @@ uper_ugot_refill(asn_per_data_t *pd) asn_per_data_t *oldpd = &arg->oldpd; - ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", - pd->moved, oldpd->moved); + ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", pd->moved, + oldpd->moved); /* Advance our position to where pd is */ oldpd->buffer = pd->buffer; @@ -340,8 +340,7 @@ uper_ugot_refill(asn_per_data_t *pd) if (arg->unclaimed) { /* Refill the container */ - if (per_get_few_bits(oldpd, 1)) - return -1; + if (per_get_few_bits(oldpd, 1)) return -1; if (oldpd->nboff == 0) { assert(0); @@ -362,7 +361,7 @@ uper_ugot_refill(asn_per_data_t *pd) next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", - next_chunk_bytes, oldpd->moved, arg->repeat); + next_chunk_bytes, oldpd->moved, arg->repeat); if (next_chunk_bytes < 0) return -1; if (next_chunk_bytes == 0) { @@ -376,25 +375,24 @@ uper_ugot_refill(asn_per_data_t *pd) pd->nbits = oldpd->nboff + next_chunk_bits; arg->unclaimed = 0; ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", - next_chunk_bits, oldpd->moved, - oldpd->nboff, oldpd->nbits, - oldpd->nbits - oldpd->nboff); + next_chunk_bits, oldpd->moved, oldpd->nboff, oldpd->nbits, + oldpd->nbits - oldpd->nboff); } else { pd->nbits = oldpd->nbits; arg->unclaimed = next_chunk_bits - avail; - ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); + ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, + next_chunk_bits, arg->unclaimed); } pd->buffer = oldpd->buffer; pd->nboff = oldpd->nboff; - ASN_DEBUG("Refilled pd%s old%s", - per_data_string(pd), per_data_string(oldpd)); + ASN_DEBUG("Refilled pd%s old%s", per_data_string(pd), + per_data_string(oldpd)); return 0; } -static int -per_skip_bits(asn_per_data_t *pd, int skip_nbits) +static int per_skip_bits(asn_per_data_t *pd, int skip_nbits) { int hasNonZeroBits = 0; while (skip_nbits > 0) @@ -408,13 +406,13 @@ per_skip_bits(asn_per_data_t *pd, int skip_nbits) switch (per_get_few_bits(pd, skip)) { - case -1: - return -1; /* Starving */ - case 0: - continue; /* Skipped empty space */ - default: - hasNonZeroBits = 1; - continue; + case -1: + return -1; /* Starving */ + case 0: + continue; /* Skipped empty space */ + default: + hasNonZeroBits = 1; + continue; } } return hasNonZeroBits; diff --git a/src/core/libs/supl/asn-rrlp/per_opentype.h b/src/core/libs/supl/asn-rrlp/per_opentype.h index 2110a794a..1d1a7befa 100644 --- a/src/core/libs/supl/asn-rrlp/per_opentype.h +++ b/src/core/libs/supl/asn-rrlp/per_opentype.h @@ -10,11 +10,16 @@ extern "C" { #endif - asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd); int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); - int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + int uper_open_type_put(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, + asn_per_outp_t *po); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-rrlp/per_support.c b/src/core/libs/supl/asn-rrlp/per_support.c index 8cce5211c..936ac77cd 100644 --- a/src/core/libs/supl/asn-rrlp/per_support.c +++ b/src/core/libs/supl/asn-rrlp/per_support.c @@ -7,190 +7,200 @@ #include #include -char * -per_data_string(asn_per_data_t *pd) { - static char buf[2][32]; - static int n; - n = (n+1) % 2; - snprintf(buf[n], sizeof(buf[n]), - "{m=%ld span %+ld[%d..%d] (%d)}", - (long)pd->moved, - (((long)pd->buffer) & 0xf), - (int)pd->nboff, (int)pd->nbits, - (int)(pd->nbits - pd->nboff)); - return buf[n]; +char *per_data_string(asn_per_data_t *pd) +{ + static char buf[2][32]; + static int n; + n = (n + 1) % 2; + snprintf(buf[n], sizeof(buf[n]), "{m=%ld span %+ld[%d..%d] (%d)}", + (long)pd->moved, (((long)pd->buffer) & 0xf), (int)pd->nboff, + (int)pd->nbits, (int)(pd->nbits - pd->nboff)); + return buf[n]; } -void -per_get_undo(asn_per_data_t *pd, int nbits) { - if((ssize_t)pd->nboff < nbits) { - assert((ssize_t)pd->nboff < nbits); - } else { - pd->nboff -= nbits; - pd->moved -= nbits; +void per_get_undo(asn_per_data_t *pd, int nbits) +{ + if ((ssize_t)pd->nboff < nbits) + { + assert((ssize_t)pd->nboff < nbits); + } + else + { + pd->nboff -= nbits; + pd->moved -= nbits; } } /* * Extract a small number of bits (<= 31) from the specified PER data pointer. */ -int32_t -per_get_few_bits(asn_per_data_t *pd, int nbits) { - size_t off; /* Next after last bit offset */ - ssize_t nleft; /* Number of bits left in this stream */ - uint32_t accum; - const uint8_t *buf; +int32_t per_get_few_bits(asn_per_data_t *pd, int nbits) +{ + size_t off; /* Next after last bit offset */ + ssize_t nleft; /* Number of bits left in this stream */ + uint32_t accum; + const uint8_t *buf; - if(nbits < 0) - return -1; + if (nbits < 0) return -1; - nleft = pd->nbits - pd->nboff; - if(nbits > nleft) { - int32_t tailv; - int32_t vhead; - if(!pd->refill || nbits > 31) return -1; - /* Accumulate unused bytes before refill */ - ASN_DEBUG("Obtain the rest %d bits (want %d)", - (int)nleft, nbits); - tailv = per_get_few_bits(pd, nleft); - if(tailv < 0) return -1; - /* Refill (replace pd contents with new data) */ - if(pd->refill(pd)) - return -1; - nbits -= nleft; - vhead = per_get_few_bits(pd, nbits); - /* Combine the rest of previous pd with the head of new one */ - tailv = (tailv << nbits) | vhead; /* Could == -1 */ - return tailv; + nleft = pd->nbits - pd->nboff; + if (nbits > nleft) + { + int32_t tailv; + int32_t vhead; + if (!pd->refill || nbits > 31) return -1; + /* Accumulate unused bytes before refill */ + ASN_DEBUG("Obtain the rest %d bits (want %d)", (int)nleft, nbits); + tailv = per_get_few_bits(pd, nleft); + if (tailv < 0) return -1; + /* Refill (replace pd contents with new data) */ + if (pd->refill(pd)) return -1; + nbits -= nleft; + vhead = per_get_few_bits(pd, nbits); + /* Combine the rest of previous pd with the head of new one */ + tailv = (tailv << nbits) | vhead; /* Could == -1 */ + return tailv; } - /* - * Normalize position indicator. - */ - if(pd->nboff >= 8) { - pd->buffer += (pd->nboff >> 3); - pd->nbits -= (pd->nboff & ~0x07); - pd->nboff &= 0x07; + /* + * Normalize position indicator. + */ + if (pd->nboff >= 8) + { + pd->buffer += (pd->nboff >> 3); + pd->nbits -= (pd->nboff & ~0x07); + pd->nboff &= 0x07; } - pd->moved += nbits; - pd->nboff += nbits; - off = pd->nboff; - buf = pd->buffer; + pd->moved += nbits; + pd->nboff += nbits; + off = pd->nboff; + buf = pd->buffer; - /* - * Extract specified number of bits. - */ - if(off <= 8) - accum = nbits ? (buf[0]) >> (8 - off) : 0; - else if(off <= 16) - accum = ((buf[0] << 8) + buf[1]) >> (16 - off); - else if(off <= 24) - accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); - else if(off <= 31) - accum = ((buf[0] << 24) + (buf[1] << 16) - + (buf[2] << 8) + (buf[3])) >> (32 - off); - else if(nbits <= 31) { - asn_per_data_t tpd = *pd; - /* Here are we with our 31-bits limit plus 1..7 bits offset. */ - per_get_undo(&tpd, nbits); - /* The number of available bits in the stream allow - * for the following operations to take place without - * invoking the ->refill() function */ - uint32_t two_twentyfour = 16777216; - accum = per_get_few_bits(&tpd, nbits - 24) * two_twentyfour; - accum |= per_get_few_bits(&tpd, 24); - } else { - per_get_undo(pd, nbits); - return -1; + /* + * Extract specified number of bits. + */ + if (off <= 8) + accum = nbits ? (buf[0]) >> (8 - off) : 0; + else if (off <= 16) + accum = ((buf[0] << 8) + buf[1]) >> (16 - off); + else if (off <= 24) + accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); + else if (off <= 31) + accum = ((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3])) >> + (32 - off); + else if (nbits <= 31) + { + asn_per_data_t tpd = *pd; + /* Here are we with our 31-bits limit plus 1..7 bits offset. */ + per_get_undo(&tpd, nbits); + /* The number of available bits in the stream allow + * for the following operations to take place without + * invoking the ->refill() function */ + uint32_t two_twentyfour = 16777216; + accum = per_get_few_bits(&tpd, nbits - 24) * two_twentyfour; + accum |= per_get_few_bits(&tpd, 24); + } + else + { + per_get_undo(pd, nbits); + return -1; } - accum &= (((uint32_t)1 << nbits) - 1); + accum &= (((uint32_t)1 << nbits) - 1); - ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", - nbits, (int)nleft, - (int)pd->moved, - (((long)pd->buffer) & 0xf), - (int)pd->nboff, (int)pd->nbits, - ((pd->buffer != NULL)?pd->buffer[0]:0), - (int)(pd->nbits - pd->nboff), - (int)accum); + ASN_DEBUG( + " [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", + nbits, (int)nleft, (int)pd->moved, (((long)pd->buffer) & 0xf), + (int)pd->nboff, (int)pd->nbits, + ((pd->buffer != NULL) ? pd->buffer[0] : 0), + (int)(pd->nbits - pd->nboff), (int)accum); - return accum; + return accum; } /* * Extract a large number of bits from the specified PER data pointer. */ -int -per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { - int32_t value; +int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) +{ + int32_t value; - if(alright && (nbits & 7)) { - /* Perform right alignment of a first few bits */ - value = per_get_few_bits(pd, nbits & 0x07); - if(value < 0) return -1; - *dst++ = value; /* value is already right-aligned */ - nbits &= ~7; + if (alright && (nbits & 7)) + { + /* Perform right alignment of a first few bits */ + value = per_get_few_bits(pd, nbits & 0x07); + if (value < 0) return -1; + *dst++ = value; /* value is already right-aligned */ + nbits &= ~7; } - while(nbits) { - if(nbits >= 24) { - value = per_get_few_bits(pd, 24); - if(value < 0) return -1; - *(dst++) = value >> 16; - *(dst++) = value >> 8; - *(dst++) = value; - nbits -= 24; - } else { - value = per_get_few_bits(pd, nbits); - if(value < 0) return -1; - if(nbits & 7) { /* implies left alignment */ - value <<= 8 - (nbits & 7), - nbits += 8 - (nbits & 7); - if(nbits > 24) - *dst++ = value >> 24; + while (nbits) + { + if (nbits >= 24) + { + value = per_get_few_bits(pd, 24); + if (value < 0) return -1; + *(dst++) = value >> 16; + *(dst++) = value >> 8; + *(dst++) = value; + nbits -= 24; + } + else + { + value = per_get_few_bits(pd, nbits); + if (value < 0) return -1; + if (nbits & 7) + { /* implies left alignment */ + value <<= 8 - (nbits & 7), nbits += 8 - (nbits & 7); + if (nbits > 24) *dst++ = value >> 24; } - if(nbits > 16) - *dst++ = value >> 16; - if(nbits > 8) - *dst++ = value >> 8; - *dst++ = value; - break; + if (nbits > 16) *dst++ = value >> 16; + if (nbits > 8) *dst++ = value >> 8; + *dst++ = value; + break; } } - return 0; + return 0; } /* * X.691-201508 #10.9 General rules for encoding a length determinant. * Get the optionally constrained length "n" from the stream. */ -ssize_t -uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { +ssize_t uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) +{ ssize_t value; *repeat = 0; /* #11.9.4.1 Encoding if constrained (according to effective bits) */ - if(ebits >= 0 && ebits <= 16) { - return per_get_few_bits(pd, ebits); - } + if (ebits >= 0 && ebits <= 16) + { + return per_get_few_bits(pd, ebits); + } - value = per_get_few_bits(pd, 8); - if((value & 0x80) == 0) { /* #11.9.3.6 */ - return (value & 0x7F); - } else if((value & 0x40) == 0) { /* #11.9.3.7 */ - /* bit 8 ... set to 1 and bit 7 ... set to zero */ - value = ((value & 0x3f) << 8) | per_get_few_bits(pd, 8); - return value; /* potential -1 from per_get_few_bits passes through. */ - } else if(value < 0) { - return -1; - } + value = per_get_few_bits(pd, 8); + if ((value & 0x80) == 0) + { /* #11.9.3.6 */ + return (value & 0x7F); + } + else if ((value & 0x40) == 0) + { /* #11.9.3.7 */ + /* bit 8 ... set to 1 and bit 7 ... set to zero */ + value = ((value & 0x3f) << 8) | per_get_few_bits(pd, 8); + return value; /* potential -1 from per_get_few_bits passes through. + */ + } + else if (value < 0) + { + return -1; + } value &= 0x3f; /* this is "m" from X.691, #11.9.3.8 */ - if(value < 1 || value > 4) { - return -1; /* Prohibited by #11.9.3.8 */ - } + if (value < 1 || value > 4) + { + return -1; /* Prohibited by #11.9.3.8 */ + } *repeat = 1; return (16384 * value); } @@ -200,22 +210,25 @@ uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { * This procedure used to decode length of extensions bit-maps * for SET and SEQUENCE types. */ -ssize_t -uper_get_nslength(asn_per_data_t *pd) { - ssize_t length; +ssize_t uper_get_nslength(asn_per_data_t *pd) +{ + ssize_t length; - ASN_DEBUG("Getting normally small length"); + ASN_DEBUG("Getting normally small length"); - if(per_get_few_bits(pd, 1) == 0) { - length = per_get_few_bits(pd, 6) + 1; - if(length <= 0) return -1; - ASN_DEBUG("l=%d", (int)length); - return length; - } else { - int repeat; - length = uper_get_length(pd, -1, &repeat); - if(length >= 0 && !repeat) return length; - return -1; /* Error, or do not support >16K extensions */ + if (per_get_few_bits(pd, 1) == 0) + { + length = per_get_few_bits(pd, 6) + 1; + if (length <= 0) return -1; + ASN_DEBUG("l=%d", (int)length); + return length; + } + else + { + int repeat; + length = uper_get_length(pd, -1, &repeat); + if (length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ } } @@ -223,294 +236,289 @@ uper_get_nslength(asn_per_data_t *pd) { * Get the normally small non-negative whole number. * X.691, #10.6 */ -ssize_t -uper_get_nsnnwn(asn_per_data_t *pd) { - ssize_t value; +ssize_t uper_get_nsnnwn(asn_per_data_t *pd) +{ + ssize_t value; - value = per_get_few_bits(pd, 7); - if(value & 64) { /* implicit (value < 0) */ - value &= 63; - value <<= 2; - value |= per_get_few_bits(pd, 2); - if(value & 128) /* implicit (value < 0) */ - return -1; - if(value == 0) - return 0; - if(value >= 3) - return -1; - value = per_get_few_bits(pd, 8 * value); - return value; + value = per_get_few_bits(pd, 7); + if (value & 64) + { /* implicit (value < 0) */ + value &= 63; + value <<= 2; + value |= per_get_few_bits(pd, 2); + if (value & 128) /* implicit (value < 0) */ + return -1; + if (value == 0) return 0; + if (value >= 3) return -1; + value = per_get_few_bits(pd, 8 * value); + return value; } - return value; + return value; } /* * X.691-11/2008, #11.6 * Encoding of a normally small non-negative whole number */ -int -uper_put_nsnnwn(asn_per_outp_t *po, int n) { - int bytes; +int uper_put_nsnnwn(asn_per_outp_t *po, int n) +{ + int bytes; - if(n <= 63) { - if(n < 0) return -1; - return per_put_few_bits(po, n, 7); + if (n <= 63) + { + if (n < 0) return -1; + return per_put_few_bits(po, n, 7); } - if(n < 256) - bytes = 1; - else if(n < 65536) - bytes = 2; - else if(n < 256 * 65536) - bytes = 3; - else - return -1; /* This is not a "normally small" value */ - if(per_put_few_bits(po, bytes, 8)) - return -1; + if (n < 256) + bytes = 1; + else if (n < 65536) + bytes = 2; + else if (n < 256 * 65536) + bytes = 3; + else + return -1; /* This is not a "normally small" value */ + if (per_put_few_bits(po, bytes, 8)) return -1; - return per_put_few_bits(po, n, 8 * bytes); + return per_put_few_bits(po, n, 8 * bytes); } - /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { - unsigned long lhalf; /* Lower half of the number*/ - long half; +int uper_get_constrained_whole_number(asn_per_data_t *pd, + unsigned long *out_value, int nbits) +{ + unsigned long lhalf; /* Lower half of the number*/ + long half; - if(nbits <= 31) { - half = per_get_few_bits(pd, nbits); - if(half < 0) return -1; - *out_value = half; - return 0; + if (nbits <= 31) + { + half = per_get_few_bits(pd, nbits); + if (half < 0) return -1; + *out_value = half; + return 0; } - if((size_t)nbits > 8 * sizeof(*out_value)) - return -1; /* RANGE */ + if ((size_t)nbits > 8 * sizeof(*out_value)) return -1; /* RANGE */ - half = per_get_few_bits(pd, 31); - if(half < 0) return -1; + half = per_get_few_bits(pd, 31); + if (half < 0) return -1; - if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) - return -1; + if (uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) return -1; - *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; - return 0; + *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; + return 0; } - /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { - /* - * Assume signed number can be safely coerced into - * unsigned of the same range. - * The following testing code will likely be optimized out - * by compiler if it is true. - */ - unsigned long uvalue1 = ULONG_MAX; - long svalue = uvalue1; - unsigned long uvalue2 = svalue; - assert(uvalue1 == uvalue2); - return uper_put_constrained_whole_number_u(po, v, nbits); +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) +{ + /* + * Assume signed number can be safely coerced into + * unsigned of the same range. + * The following testing code will likely be optimized out + * by compiler if it is true. + */ + unsigned long uvalue1 = ULONG_MAX; + long svalue = uvalue1; + unsigned long uvalue2 = svalue; + assert(uvalue1 == uvalue2); + return uper_put_constrained_whole_number_u(po, v, nbits); } -int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { - if(nbits <= 31) { - return per_put_few_bits(po, v, nbits); - } else { - /* Put higher portion first, followed by lower 31-bit */ - if(uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) - return -1; - return per_put_few_bits(po, v, 31); +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, + int nbits) +{ + if (nbits <= 31) + { + return per_put_few_bits(po, v, nbits); + } + else + { + /* Put higher portion first, followed by lower 31-bit */ + if (uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) + return -1; + return per_put_few_bits(po, v, 31); } } -int -per_put_aligned_flush(asn_per_outp_t *po) { +int per_put_aligned_flush(asn_per_outp_t *po) +{ uint32_t unused_bits = (0x7 & (8 - (po->nboff & 0x07))); size_t complete_bytes = (po->buffer ? po->buffer - po->tmpspace : 0) + ((po->nboff + 7) >> 3); - if(unused_bits) { - po->buffer[po->nboff >> 3] &= ~0 << unused_bits; - } + if (unused_bits) + { + po->buffer[po->nboff >> 3] &= ~0 << unused_bits; + } - if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) { - return -1; - } else { - po->buffer = po->tmpspace; - po->nboff = 0; - po->nbits = 8 * sizeof(po->tmpspace); - po->flushed_bytes += complete_bytes; - return 0; - } + if (po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + { + return -1; + } + else + { + po->buffer = po->tmpspace; + po->nboff = 0; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; + return 0; + } } /* * Put a small number of bits (<= 31). */ -int -per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { - size_t off; /* Next after last bit offset */ - size_t omsk; /* Existing last byte meaningful bits mask */ - uint8_t *buf; +int per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) +{ + size_t off; /* Next after last bit offset */ + size_t omsk; /* Existing last byte meaningful bits mask */ + uint8_t *buf; - if(obits <= 0 || obits >= 32) return obits ? -1 : 0; + if (obits <= 0 || obits >= 32) return obits ? -1 : 0; - ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", - obits, (int)bits, po->buffer, (int)po->nboff); + ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", obits, (int)bits, + po->buffer, (int)po->nboff); - /* - * Normalize position indicator. - */ - if(po->nboff >= 8) { - po->buffer += (po->nboff >> 3); - po->nbits -= (po->nboff & ~0x07); - po->nboff &= 0x07; + /* + * Normalize position indicator. + */ + if (po->nboff >= 8) + { + po->buffer += (po->nboff >> 3); + po->nbits -= (po->nboff & ~0x07); + po->nboff &= 0x07; } - /* - * Flush whole-bytes output, if necessary. - */ - if(po->nboff + obits > po->nbits) { - size_t complete_bytes; - if(!po->buffer) po->buffer = po->tmpspace; - complete_bytes = (po->buffer - po->tmpspace); - ASN_DEBUG("[PER output %ld complete + %ld]", - (long)complete_bytes, (long)po->flushed_bytes); - if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) - return -1; - if(po->nboff) - po->tmpspace[0] = po->buffer[0]; - po->buffer = po->tmpspace; - po->nbits = 8 * sizeof(po->tmpspace); - po->flushed_bytes += complete_bytes; + /* + * Flush whole-bytes output, if necessary. + */ + if (po->nboff + obits > po->nbits) + { + size_t complete_bytes; + if (!po->buffer) po->buffer = po->tmpspace; + complete_bytes = (po->buffer - po->tmpspace); + ASN_DEBUG("[PER output %ld complete + %ld]", (long)complete_bytes, + (long)po->flushed_bytes); + if (po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + return -1; + if (po->nboff) po->tmpspace[0] = po->buffer[0]; + po->buffer = po->tmpspace; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; } - /* - * Now, due to sizeof(tmpspace), we are guaranteed large enough space. - */ - buf = po->buffer; - omsk = ~((1 << (8 - po->nboff)) - 1); - off = (po->nboff + obits); + /* + * Now, due to sizeof(tmpspace), we are guaranteed large enough space. + */ + buf = po->buffer; + omsk = ~((1 << (8 - po->nboff)) - 1); + off = (po->nboff + obits); - /* Clear data of debris before meaningful bits */ - bits &= (((uint32_t)1 << obits) - 1); + /* Clear data of debris before meaningful bits */ + bits &= (((uint32_t)1 << obits) - 1); - ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, - (int)bits, (int)bits, - (int)po->nboff, (int)off, - buf[0], (int)(omsk&0xff), - (int)(buf[0] & omsk)); + ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, (int)bits, + (int)bits, (int)po->nboff, (int)off, buf[0], (int)(omsk & 0xff), + (int)(buf[0] & omsk)); - if(off <= 8) /* Completely within 1 byte */ - po->nboff = off, - bits <<= (8 - off), - buf[0] = (buf[0] & omsk) | bits; - else if(off <= 16) - po->nboff = off, - bits <<= (16 - off), - buf[0] = (buf[0] & omsk) | (bits >> 8), - buf[1] = bits; - else if(off <= 24) - po->nboff = off, - bits <<= (24 - off), - buf[0] = (buf[0] & omsk) | (bits >> 16), - buf[1] = bits >> 8, - buf[2] = bits; - else if(off <= 31) - po->nboff = off, - bits <<= (32 - off), - buf[0] = (buf[0] & omsk) | (bits >> 24), - buf[1] = bits >> 16, - buf[2] = bits >> 8, - buf[3] = bits; - else { - if((obits - 24) > 0) + if (off <= 8) /* Completely within 1 byte */ + po->nboff = off, bits <<= (8 - off), buf[0] = (buf[0] & omsk) | bits; + else if (off <= 16) + po->nboff = off, bits <<= (16 - off), + buf[0] = (buf[0] & omsk) | (bits >> 8), buf[1] = bits; + else if (off <= 24) + po->nboff = off, bits <<= (24 - off), + buf[0] = (buf[0] & omsk) | (bits >> 16), buf[1] = bits >> 8, + buf[2] = bits; + else if (off <= 31) + po->nboff = off, bits <<= (32 - off), + buf[0] = (buf[0] & omsk) | (bits >> 24), buf[1] = bits >> 16, + buf[2] = bits >> 8, buf[3] = bits; + else + { + if ((obits - 24) > 0) { - if(per_put_few_bits(po, bits >> (obits - 24), 24)) return -1; + if (per_put_few_bits(po, bits >> (obits - 24), 24)) + return -1; } - if(per_put_few_bits(po, bits, obits - 24)) return -1; + if (per_put_few_bits(po, bits, obits - 24)) return -1; } - ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", - (int)bits, (int)bits, buf[0], - (po->buffer - po->tmpspace)); + ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", (int)bits, (int)bits, buf[0], + (po->buffer - po->tmpspace)); - return 0; + return 0; } - /* * Output a large number of bits. */ -int -per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) +{ + while (nbits) + { + uint32_t value; - while(nbits) { - uint32_t value; - - if(nbits >= 24) { - value = (src[0] << 16) | (src[1] << 8) | src[2]; - src += 3; - nbits -= 24; - if(per_put_few_bits(po, value, 24)) - return -1; - } else { - value = src[0]; - if(nbits > 8) - value = (value << 8) | src[1]; - if(nbits > 16) - value = (value << 8) | src[2]; - if(nbits & 0x07) - value >>= (8 - (nbits & 0x07)); - if(per_put_few_bits(po, value, nbits)) - return -1; - break; + if (nbits >= 24) + { + value = (src[0] << 16) | (src[1] << 8) | src[2]; + src += 3; + nbits -= 24; + if (per_put_few_bits(po, value, 24)) return -1; + } + else + { + value = src[0]; + if (nbits > 8) value = (value << 8) | src[1]; + if (nbits > 16) value = (value << 8) | src[2]; + if (nbits & 0x07) value >>= (8 - (nbits & 0x07)); + if (per_put_few_bits(po, value, nbits)) return -1; + break; } } - return 0; + return 0; } /* * Put the length "n" (or part of it) into the stream. */ -ssize_t -uper_put_length(asn_per_outp_t *po, size_t length) { +ssize_t uper_put_length(asn_per_outp_t *po, size_t length) +{ + if (length <= 127) /* #10.9.3.6 */ + return per_put_few_bits(po, length, 8) ? -1 : (ssize_t)length; + else if (length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length | 0x8000, 16) ? -1 : (ssize_t)length; - if(length <= 127) /* #10.9.3.6 */ - return per_put_few_bits(po, length, 8) - ? -1 : (ssize_t)length; - else if(length < 16384) /* #10.9.3.7 */ - return per_put_few_bits(po, length|0x8000, 16) - ? -1 : (ssize_t)length; + length >>= 14; + if (length > 4) length = 4; - length >>= 14; - if(length > 4) length = 4; - - return per_put_few_bits(po, 0xC0 | length, 8) - ? -1 : (ssize_t)(length << 14); + return per_put_few_bits(po, 0xC0 | length, 8) ? -1 + : (ssize_t)(length << 14); } - /* * Put the normally small length "n" into the stream. * This procedure used to encode length of extensions bit-maps * for SET and SEQUENCE types. */ -int -uper_put_nslength(asn_per_outp_t *po, size_t length) { - - if(length <= 64) { - /* #10.9.3.4 */ - if(length == 0) return -1; - return per_put_few_bits(po, length-1, 7) ? -1 : 0; - } else { - if(uper_put_length(po, length) != (ssize_t)length) { - /* This might happen in case of >16K extensions */ - return -1; +int uper_put_nslength(asn_per_outp_t *po, size_t length) +{ + if (length <= 64) + { + /* #10.9.3.4 */ + if (length == 0) return -1; + return per_put_few_bits(po, length - 1, 7) ? -1 : 0; + } + else + { + if (uper_put_length(po, length) != (ssize_t)length) + { + /* This might happen in case of >16K extensions */ + return -1; } } - return 0; + return 0; } diff --git a/src/core/libs/supl/asn-rrlp/per_support.h b/src/core/libs/supl/asn-rrlp/per_support.h index 321122b68..53a7a4d92 100644 --- a/src/core/libs/supl/asn-rrlp/per_support.h +++ b/src/core/libs/supl/asn-rrlp/per_support.h @@ -14,8 +14,8 @@ extern "C" #endif /* - * Pre-computed PER constraints. - */ + * Pre-computed PER constraints. + */ typedef const struct asn_per_constraint_s { enum asn_per_constraint_flags @@ -39,62 +39,62 @@ extern "C" } asn_per_constraints_t; /* - * This structure describes a position inside an incoming PER bit stream. - */ + * This structure describes a position inside an incoming PER bit stream. + */ typedef struct asn_per_data_s { const uint8_t *buffer; /* Pointer to the octet stream */ size_t nboff; /* Bit offset to the meaningful bit */ size_t nbits; /* Number of bits in the stream */ - size_t moved; /* Number of bits moved through this bit stream */ + size_t moved; /* Number of bits moved through this bit stream */ int (*refill)(struct asn_per_data_s *); void *refill_key; } asn_per_data_t; /* - * Extract a small number of bits (<= 31) from the specified PER data pointer. - * This function returns -1 if the specified number of bits could not be - * extracted due to EOD or other conditions. - */ + * Extract a small number of bits (<= 31) from the specified PER data + * pointer. This function returns -1 if the specified number of bits could + * not be extracted due to EOD or other conditions. + */ int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); /* Undo the immediately preceding "get_few_bits" operation */ void per_get_undo(asn_per_data_t *per_data, int get_nbits); /* - * Extract a large number of bits from the specified PER data pointer. - * This function returns -1 if the specified number of bits could not be - * extracted due to EOD or other conditions. - */ + * Extract a large number of bits from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, - int get_nbits); + int get_nbits); /* - * Get the length "n" from the Unaligned PER stream. - */ - ssize_t uper_get_length(asn_per_data_t *pd, - int effective_bound_bits, - int *repeat); + * Get the length "n" from the Unaligned PER stream. + */ + ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, + int *repeat); /* - * Get the normally small length "n". - */ + * Get the normally small length "n". + */ ssize_t uper_get_nslength(asn_per_data_t *pd); /* - * Get the normally small non-negative whole number. - */ + * Get the normally small non-negative whole number. + */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); /* X.691-2008/11, #11.5.6 */ - int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); + int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, + int nbits); /* Non-thread-safe debugging function, don't use it */ char *per_data_string(asn_per_data_t *pd); /* - * This structure supports forming PER output. - */ + * This structure supports forming PER output. + */ typedef struct asn_per_outp_s { uint8_t *buffer; /* Pointer into the (tmpspace) */ @@ -110,35 +110,38 @@ extern "C" int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); /* Output a large number of bits */ - int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, + int put_nbits); /* - * Flush whole bytes (0 or more) through (outper) member. - * The least significant bits which are not used are guaranteed to be set to 0. - * Returns -1 if callback returns -1. Otherwise, 0. - */ + * Flush whole bytes (0 or more) through (outper) member. + * The least significant bits which are not used are guaranteed to be set to + * 0. Returns -1 if callback returns -1. Otherwise, 0. + */ int per_put_aligned_flush(asn_per_outp_t *po); /* X.691-2008/11, #11.5 */ - int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); - int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); + int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, + int nbits); + int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, + int nbits); /* - * Put the length "n" to the Unaligned PER stream. - * This function returns the number of units which may be flushed - * in the next units saving iteration. - */ + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); /* - * Put the normally small length "n" to the Unaligned PER stream. - * Returns 0 or -1. - */ + * Put the normally small length "n" to the Unaligned PER stream. + * Returns 0 or -1. + */ int uper_put_nslength(asn_per_outp_t *po, size_t length); /* - * Put the normally small non-negative whole number. - */ + * Put the normally small non-negative whole number. + */ int uper_put_nsnnwn(asn_per_outp_t *po, int n); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/xer_decoder.c b/src/core/libs/supl/asn-rrlp/xer_decoder.c index 10e5d70c7..c7bc688bc 100644 --- a/src/core/libs/supl/asn-rrlp/xer_decoder.c +++ b/src/core/libs/supl/asn-rrlp/xer_decoder.c @@ -4,32 +4,36 @@ */ #include #include -#include /* XER/XML parsing support */ - +#include /* XER/XML parsing support */ /* * Decode the XER encoding of a given type. */ -asn_dec_rval_t -xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *buffer, size_t size) { +asn_dec_rval_t xer_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *buffer, size_t size) +{ asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* * Invoke type-specific decoder. @@ -37,179 +41,201 @@ xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); } - - -struct xer__cb_arg { - pxml_chunk_type_e chunk_type; - size_t chunk_size; - const void *chunk_buf; +struct xer__cb_arg +{ + pxml_chunk_type_e chunk_type; + size_t chunk_size; + const void *chunk_buf; int callback_not_invoked; }; -static int -xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { +static int xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, + size_t _chunk_size, void *key) +{ struct xer__cb_arg *arg = (struct xer__cb_arg *)key; arg->chunk_type = type; arg->chunk_size = _chunk_size; arg->chunk_buf = _chunk_data; arg->callback_not_invoked = 0; - return -1; /* Terminate the XML parsing */ + return -1; /* Terminate the XML parsing */ } /* * Fetch the next token from the XER/XML stream. */ -ssize_t -xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { +ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, + pxer_chunk_type_e *ch_type) +{ struct xer__cb_arg arg; int new_stateContext = *stateContext; ssize_t ret; arg.callback_not_invoked = 1; ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); - if(ret < 0) return -1; - if(arg.callback_not_invoked) { - assert(ret == 0); /* No data was consumed */ - return 0; /* Try again with more data */ - } else { - assert(arg.chunk_size); - assert(arg.chunk_buf == buffer); - } + if (ret < 0) return -1; + if (arg.callback_not_invoked) + { + assert(ret == 0); /* No data was consumed */ + return 0; /* Try again with more data */ + } + else + { + assert(arg.chunk_size); + assert(arg.chunk_buf == buffer); + } /* * Translate the XML chunk types into more convenient ones. */ - switch(arg.chunk_type) { - case PXML_TEXT: - *ch_type = PXER_TEXT; - break; - case PXML_TAG: return 0; /* Want more */ - case PXML_TAG_END: - *ch_type = PXER_TAG; - break; - case PXML_COMMENT: - case PXML_COMMENT_END: - *ch_type = PXER_COMMENT; - break; - } + switch (arg.chunk_type) + { + case PXML_TEXT: + *ch_type = PXER_TEXT; + break; + case PXML_TAG: + return 0; /* Want more */ + case PXML_TAG_END: + *ch_type = PXER_TAG; + break; + case PXML_COMMENT: + case PXML_COMMENT_END: + *ch_type = PXER_COMMENT; + break; + } *stateContext = new_stateContext; return arg.chunk_size; } -#define CSLASH 0x2f /* '/' */ -#define LANGLE 0x3c /* '<' */ -#define RANGLE 0x3e /* '>' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define RANGLE 0x3e /* '>' */ -xer_check_tag_e -xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { +xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, + const char *need_tag) +{ const char *buf = (const char *)buf_ptr; const char *end; xer_check_tag_e ct = XCT_OPENING; - if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { - if(size >= 2) - ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); - return XCT_BROKEN; - } + if (size < 2 || buf[0] != LANGLE || buf[size - 1] != RANGLE) + { + if (size >= 2) + ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); + return XCT_BROKEN; + } /* * Determine the tag class. */ - if(buf[1] == CSLASH) { - buf += 2; /* advance past "" */ - ct = XCT_CLOSING; - if(size > 0 && buf[size-1] == CSLASH) - return XCT_BROKEN; /* */ - } else { - buf++; /* advance past "<" */ - size -= 2; /* strip "<" and ">" */ - if(size > 0 && buf[size-1] == CSLASH) { - ct = XCT_BOTH; - size--; /* One more, for "/" */ + if (buf[1] == CSLASH) + { + buf += 2; /* advance past "" */ + ct = XCT_CLOSING; + if (size > 0 && buf[size - 1] == CSLASH) + return XCT_BROKEN; /* */ + } + else + { + buf++; /* advance past "<" */ + size -= 2; /* strip "<" and ">" */ + if (size > 0 && buf[size - 1] == CSLASH) + { + ct = XCT_BOTH; + size--; /* One more, for "/" */ + } } - } /* Sometimes we don't care about the tag */ - if(!need_tag || !*need_tag) - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (!need_tag || !*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); /* * Determine the tag name. */ - for(end = buf + size; buf < end; buf++, need_tag++) { - int b = *buf; - int n = *need_tag; - if(b != n) { - if(n == 0) { - switch(b) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* "": whitespace is normal */ - return ct; + for (end = buf + size; buf < end; buf++, need_tag++) + { + int b = *buf; + int n = *need_tag; + if (b != n) + { + if (n == 0) + { + switch (b) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* "": whitespace is normal */ + return ct; + } + } + return (xer_check_tag_e)(XCT__UNK__MASK | ct); } - } - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (b == 0) return XCT_BROKEN; /* Embedded 0 in buf?! */ } - if(b == 0) - return XCT_BROKEN; /* Embedded 0 in buf?! */ - } - if(*need_tag) - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); return ct; } +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = (num_bytes); \ - buf_ptr = ((const char *)buf_ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + if (rval.code != RC_OK) ASN_DEBUG("Failed with %d", rval.code); \ + return rval; \ + } \ + while (0) -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself; \ - if(rval.code != RC_OK) \ - ASN_DEBUG("Failed with %d", rval.code); \ - return rval; \ - } while(0) - -#define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ - ssize_t converted_size = body_receiver \ - (struct_key, chunk_buf, chunk_size, \ - (size_t)(chunk_size) < (size)); \ - if(converted_size == -1) RETURN(RC_FAIL); \ - if(converted_size == 0 \ - && (size) == (size_t)(chunk_size)) \ - RETURN(RC_WMORE); \ - (chunk_size) = converted_size; \ - } while(0) -#define XER_GOT_EMPTY() do { \ - if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ - RETURN(RC_FAIL); \ - } while(0) +#define XER_GOT_BODY(chunk_buf, chunk_size, size) \ + do \ + { \ + ssize_t converted_size = \ + body_receiver(struct_key, chunk_buf, chunk_size, \ + (size_t)(chunk_size) < (size)); \ + if (converted_size == -1) RETURN(RC_FAIL); \ + if (converted_size == 0 && (size) == (size_t)(chunk_size)) \ + RETURN(RC_WMORE); \ + (chunk_size) = converted_size; \ + } \ + while (0) +#define XER_GOT_EMPTY() \ + do \ + { \ + if (body_receiver(struct_key, 0, 0, size > 0) == -1) \ + RETURN(RC_FAIL); \ + } \ + while (0) /* * Generalized function for decoding the primitive values. */ -asn_dec_rval_t -xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, - asn_struct_ctx_t *ctx, /* Type decoder context */ - void *struct_key, - const char *xml_tag, /* Expected XML tag */ +asn_dec_rval_t xer_decode_general( + asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, const char *xml_tag, /* Expected XML tag */ const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder) - (void *struct_key, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver) - (void *struct_key, const void *chunk_buf, size_t chunk_size, - int have_more) - ) { - + int (*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, + size_t chunk_size, int have_more)) +{ asn_dec_rval_t rval; ssize_t consumed_myself = 0; @@ -220,145 +246,160 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. */ - if(ctx->phase > 1) RETURN(RC_FAIL); - for(;;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ + if (ctx->phase > 1) RETURN(RC_FAIL); + for (;;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, - &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: - RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TEXT: - if(ctx->phase == 0) { - /* - * We have to ignore whitespace here, - * but in order to be forward compatible - * with EXTENDED-XER (EMBED-VALUES, #25) - * any text is just ignored here. - */ - } else { - XER_GOT_BODY(buf_ptr, ch_size, size); - } - ADVANCE(ch_size); - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - assert(ch_type == PXER_TAG && size); - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - /* - * Phase 0: - * Expecting the opening tag - * for the type being processed. - * Phase 1: - * Waiting for the closing XML tag. - */ - switch(tcv) { - case XCT_BOTH: - if(ctx->phase) break; - /* Finished decoding of an empty element */ - XER_GOT_EMPTY(); - ADVANCE(ch_size); - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); - case XCT_OPENING: - if(ctx->phase) break; - ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - case XCT_CLOSING: - if(!ctx->phase) break; - ADVANCE(ch_size); - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); - case XCT_UNKNOWN_BO: /* - * Certain tags in the body may be expected. + * Get the next part of the XML stream. */ - if(opt_unexpected_tag_decoder - && opt_unexpected_tag_decoder(struct_key, - buf_ptr, ch_size) >= 0) { - /* Tag's processed fine */ - ADVANCE(ch_size); - if(!ctx->phase) { - /* We are not expecting - * the closing tag anymore. */ - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TEXT: + if (ctx->phase == 0) + { + /* + * We have to ignore whitespace + * here, but in order to be forward + * compatible with EXTENDED-XER + * (EMBED-VALUES, #25) any text is + * just ignored here. + */ + } + else + { + XER_GOT_BODY(buf_ptr, ch_size, + size); + } + ADVANCE(ch_size); + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } } - continue; - } - /* Fall through */ - default: - break; /* Unexpected tag */ - } - ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); - break; /* Dark and mysterious things have just happened */ - } + assert(ch_type == PXER_TAG && size); + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + /* + * Phase 0: + * Expecting the opening tag + * for the type being processed. + * Phase 1: + * Waiting for the closing XML tag. + */ + switch (tcv) + { + case XCT_BOTH: + if (ctx->phase) break; + /* Finished decoding of an empty element */ + XER_GOT_EMPTY(); + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if (ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + case XCT_CLOSING: + if (!ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_UNKNOWN_BO: + /* + * Certain tags in the body may be expected. + */ + if (opt_unexpected_tag_decoder && + opt_unexpected_tag_decoder(struct_key, buf_ptr, + ch_size) >= 0) + { + /* Tag's processed fine */ + ADVANCE(ch_size); + if (!ctx->phase) + { + /* We are not expecting + * the closing tag anymore. */ + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + } + continue; + } + /* Fall through */ + default: + break; /* Unexpected tag */ + } + + ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); + break; /* Dark and mysterious things have just happened */ + } RETURN(RC_FAIL); } - -int -xer_is_whitespace(const void *chunk_buf, size_t chunk_size) { +int xer_is_whitespace(const void *chunk_buf, size_t chunk_size) +{ const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; - for(; p < pend; p++) { - switch(*p) { - /* X.693, #8.1.4 - * HORISONTAL TAB (9) - * LINE FEED (10) - * CARRIAGE RETURN (13) - * SPACE (32) - */ - case 0x09: case 0x0a: case 0x0d: case 0x20: - break; - default: - return 0; + for (; p < pend; p++) + { + switch (*p) + { + /* X.693, #8.1.4 + * HORISONTAL TAB (9) + * LINE FEED (10) + * CARRIAGE RETURN (13) + * SPACE (32) + */ + case 0x09: + case 0x0a: + case 0x0d: + case 0x20: + break; + default: + return 0; + } } - } - return 1; /* All whitespace */ + return 1; /* All whitespace */ } /* * This is a vastly simplified, non-validating XML tree skipper. */ -int -xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { +int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) +{ assert(*depth > 0); - switch(tcv) { - case XCT_BOTH: - case XCT_UNKNOWN_BO: - /* These negate each other. */ - return 0; - case XCT_OPENING: - case XCT_UNKNOWN_OP: - ++(*depth); - return 0; - case XCT_CLOSING: - case XCT_UNKNOWN_CL: - if(--(*depth) == 0) - return (tcv == XCT_CLOSING) ? 2 : 1; - return 0; - default: - return -1; - } + switch (tcv) + { + case XCT_BOTH: + case XCT_UNKNOWN_BO: + /* These negate each other. */ + return 0; + case XCT_OPENING: + case XCT_UNKNOWN_OP: + ++(*depth); + return 0; + case XCT_CLOSING: + case XCT_UNKNOWN_CL: + if (--(*depth) == 0) return (tcv == XCT_CLOSING) ? 2 : 1; + return 0; + default: + return -1; + } } diff --git a/src/core/libs/supl/asn-rrlp/xer_decoder.h b/src/core/libs/supl/asn-rrlp/xer_decoder.h index 1033e9e44..7ea7e5570 100644 --- a/src/core/libs/supl/asn-rrlp/xer_decoder.h +++ b/src/core/libs/supl/asn-rrlp/xer_decoder.h @@ -15,9 +15,10 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * The XER decoder of any ASN.1 type. May be invoked by the application. - */ - asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, + * The XER decoder of any ASN.1 type. May be invoked by the application. + */ + asn_dec_rval_t xer_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ @@ -25,52 +26,55 @@ extern "C" ); /* - * Type of the type-specific XER decoder function. - */ - typedef asn_dec_rval_t(xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, - struct asn_TYPE_descriptor_s *type_descriptor, - void **struct_ptr, + * Type of the type-specific XER decoder function. + */ + typedef asn_dec_rval_t(xer_type_decoder_f)( + asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, const char *opt_mname, /* Member name */ const void *buf_ptr, size_t size); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Generalized function for decoding the primitive values. - * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 - * and others. This function should not be used by applications, as its API - * is subject to changes. - */ - asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + * Generalized function for decoding the primitive values. + * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 + * and others. This function should not be used by applications, as its API + * is subject to changes. + */ + asn_dec_rval_t xer_decode_general( + asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, /* Type decoder context */ void *struct_key, /* Treated as opaque pointer */ const char *xml_tag, /* Expected XML tag name */ const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, size_t chunk_size, - int have_more)); - + int (*opt_unexpected_tag_decoder)(void *struct_key, + const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, + size_t chunk_size, int have_more)); /* - * Fetch the next XER (XML) token from the stream. - * The function returns the number of bytes occupied by the chunk type, - * returned in the _ch_type. The _ch_type is only set (and valid) when - * the return value is greater than 0. - */ + * Fetch the next XER (XML) token from the stream. + * The function returns the number of bytes occupied by the chunk type, + * returned in the _ch_type. The _ch_type is only set (and valid) when + * the return value is greater than 0. + */ typedef enum pxer_chunk_type { PXER_TAG, /* Complete XER tag */ PXER_TEXT, /* Plain text between XER tags */ PXER_COMMENT /* A comment, may be part of */ } pxer_chunk_type_e; - ssize_t xer_next_token(int *stateContext, - const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); + ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, + pxer_chunk_type_e *_ch_type); /* - * This function checks the buffer against the tag name is expected to occur. - */ + * This function checks the buffer against the tag name is expected to + * occur. + */ typedef enum xer_check_tag { XCT_BROKEN = 0, /* The tag is broken */ @@ -83,19 +87,19 @@ extern "C" XCT_UNKNOWN_BO = 7 /* Unexpected tag */ } xer_check_tag_e; xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, - const char *need_tag); + const char *need_tag); /* - * Check whether this buffer consists of entirely XER whitespace characters. - * RETURN VALUES: - * 1: Whitespace or empty string - * 0: Non-whitespace - */ + * Check whether this buffer consists of entirely XER whitespace characters. + * RETURN VALUES: + * 1: Whitespace or empty string + * 0: Non-whitespace + */ int xer_is_whitespace(const void *chunk_buf, size_t chunk_size); /* - * Skip the series of anticipated extensions. - */ + * Skip the series of anticipated extensions. + */ int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/xer_encoder.c b/src/core/libs/supl/asn-rrlp/xer_encoder.c index c7df92060..e723695ae 100644 --- a/src/core/libs/supl/asn-rrlp/xer_encoder.c +++ b/src/core/libs/supl/asn-rrlp/xer_encoder.c @@ -9,17 +9,17 @@ /* * The XER encoder of any type. May be invoked by the application. */ -asn_enc_rval_t -xer_encode(asn_TYPE_descriptor_t *td, void *sptr, - enum xer_encoder_flags_e xer_flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t xer_encode(asn_TYPE_descriptor_t *td, void *sptr, + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; asn_enc_rval_t tmper; const char *mname; size_t mlen; int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; - if(!td || !sptr) goto cb_failed; + if (!td || !sptr) goto cb_failed; mname = td->xml_tag; mlen = strlen(mname); @@ -27,7 +27,7 @@ xer_encode(asn_TYPE_descriptor_t *td, void *sptr, _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); - if(tmper.encoded == -1) return tmper; + if (tmper.encoded == -1) return tmper; _ASN_CALLBACK3("\n", xcan); @@ -42,27 +42,24 @@ cb_failed: * This is a helper function for xer_fprint, which directs all incoming data * into the provided file descriptor. */ -static int -xer__print2fp(const void *buffer, size_t size, void *app_key) { +static int xer__print2fp(const void *buffer, size_t size, void *app_key) +{ FILE *stream = (FILE *)app_key; - if(fwrite(buffer, 1, size, stream) != size) - return -1; + if (fwrite(buffer, 1, size, stream) != size) return -1; return 0; } -int -xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { +int xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) +{ asn_enc_rval_t er; - if(!stream) stream = stdout; - if(!td || !sptr) - return -1; + if (!stream) stream = stdout; + if (!td || !sptr) return -1; er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); - if(er.encoded == -1) - return -1; + if (er.encoded == -1) return -1; return fflush(stream); } diff --git a/src/core/libs/supl/asn-rrlp/xer_encoder.h b/src/core/libs/supl/asn-rrlp/xer_encoder.h index 49ed16a3c..e39f0740e 100644 --- a/src/core/libs/supl/asn-rrlp/xer_encoder.h +++ b/src/core/libs/supl/asn-rrlp/xer_encoder.h @@ -14,7 +14,8 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ - /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ + /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below + */ enum xer_encoder_flags_e { /* Mode of encoding */ @@ -23,35 +24,35 @@ extern "C" }; /* - * The XER encoder of any type. May be invoked by the application. - */ + * The XER encoder of any type. May be invoked by the application. + */ asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, - void *struct_ptr, /* Structure to be encoded */ - enum xer_encoder_flags_e xer_flags, - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key /* Arbitrary callback argument */ + void *struct_ptr, /* Structure to be encoded */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ ); /* - * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) - * output into the chosen file pointer. - * RETURN VALUES: - * 0: The structure is printed. - * -1: Problem printing the structure. - * WARNING: No sensible errno value is returned. - */ + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen file pointer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); /* - * Type of the generic XER encoder. - */ + * Type of the generic XER encoder. + */ typedef asn_enc_rval_t(xer_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int ilevel, /* Level of indentation */ enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-rrlp/xer_support.c b/src/core/libs/supl/asn-rrlp/xer_support.c index 96e3d9e51..fca8b4fac 100644 --- a/src/core/libs/supl/asn-rrlp/xer_support.c +++ b/src/core/libs/supl/asn-rrlp/xer_support.c @@ -8,226 +8,253 @@ #include /* Parser states */ -typedef enum { +typedef enum +{ ST_TEXT, ST_TAG_START, ST_TAG_BODY, ST_TAG_QUOTE_WAIT, ST_TAG_QUOTED_STRING, ST_TAG_UNQUOTED_STRING, - ST_COMMENT_WAIT_DASH1, /* ""[0] */ - ST_COMMENT_CLO_RT /* "-->"[1] */ + ST_COMMENT_CLO_DASH2, /* "-->"[0] */ + ST_COMMENT_CLO_RT /* "-->"[1] */ } pstate_e; static pxml_chunk_type_e final_chunk_type[] = { - PXML_TEXT, - PXML_TAG_END, - PXML_COMMENT_END, - PXML_TAG_END, - PXML_COMMENT_END, + PXML_TEXT, PXML_TAG_END, PXML_COMMENT_END, PXML_TAG_END, PXML_COMMENT_END, }; - -static int -_charclass[256] = { - 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, - 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, - 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, - 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ - 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ - 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ - 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ - 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ +static int _charclass[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, /* 01234567 89 + */ + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* ABCDEFG HIJKLMNO */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, /* PQRSTUVW XYZ */ + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* abcdefg hijklmno */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0 /* pqrstuvw xyz */ }; -#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) -#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) -#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) +#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) +#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) +#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) /* Aliases for characters, ASCII/UTF-8 */ -#define EXCLAM 0x21 /* '!' */ -#define CQUOTE 0x22 /* '"' */ -#define CDASH 0x2d /* '-' */ -#define CSLASH 0x2f /* '/' */ -#define LANGLE 0x3c /* '<' */ -#define CEQUAL 0x3d /* '=' */ -#define RANGLE 0x3e /* '>' */ -#define CQUEST 0x3f /* '?' */ +#define EXCLAM 0x21 /* '!' */ +#define CQUOTE 0x22 /* '"' */ +#define CDASH 0x2d /* '-' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define CEQUAL 0x3d /* '=' */ +#define RANGLE 0x3e /* '>' */ +#define CQUEST 0x3f /* '?' */ /* Invoke token callback */ -#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ - int _ret; \ - pstate_e ns = _ns; \ - ssize_t _sz = (p - chunk_start) + (_current_too); \ - if (!_sz) { \ - /* Shortcut */ \ - state = _ns; \ - break; \ - } \ - _ret = cb(type, chunk_start, _sz, key); \ - if(_ret < _sz) { \ - if((_current_too) && _ret == -1) \ - state = ns; \ - goto finish; \ - } \ - chunk_start = p + (_current_too); \ - state = ns; \ - } while(0) +#define TOKEN_CB_CALL(type, _ns, _current_too, _final) \ + do \ + { \ + int _ret; \ + pstate_e ns = _ns; \ + ssize_t _sz = (p - chunk_start) + (_current_too); \ + if (!_sz) \ + { \ + /* Shortcut */ \ + state = _ns; \ + break; \ + } \ + _ret = cb(type, chunk_start, _sz, key); \ + if (_ret < _sz) \ + { \ + if ((_current_too) && _ret == -1) state = ns; \ + goto finish; \ + } \ + chunk_start = p + (_current_too); \ + state = ns; \ + } \ + while (0) -#define TOKEN_CB(_type, _ns, _current_too) \ +#define TOKEN_CB(_type, _ns, _current_too) \ TOKEN_CB_CALL(_type, _ns, _current_too, 0) -#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ +#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1) /* * Parser itself */ -ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { +ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, + pxml_callback_f *cb, void *key) +{ pstate_e state = (pstate_e)*stateContext; const char *chunk_start = (const char *)xmlbuf; const char *p = chunk_start; const char *end = p + size; - for(; p < end; p++) { - int C = *(const unsigned char *)p; - switch(state) { - case ST_TEXT: - /* - * Initial state: we're in the middle of some text, - * or just have started. - */ - if (C == LANGLE) - /* We're now in the tag, probably */ - TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); - break; - case ST_TAG_START: - if (ALPHA(C) || (C == CSLASH)) - state = ST_TAG_BODY; - else if (C == EXCLAM) - state = ST_COMMENT_WAIT_DASH1; - else - /* - * Not characters and not whitespace. - * Must be something like "3 < 4". - */ - TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ - break; - case ST_TAG_BODY: - switch(C) { - case RANGLE: - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - break; - case LANGLE: - /* - * The previous tag wasn't completed, but still - * recognized as valid. (Mozilla-compatible) - */ - TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); - break; - case CEQUAL: - state = ST_TAG_QUOTE_WAIT; - break; - } - break; - case ST_TAG_QUOTE_WAIT: - /* - * State after the equal sign ("=") in the tag. - */ - switch(C) { - case CQUOTE: - state = ST_TAG_QUOTED_STRING; - break; - case RANGLE: - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - break; - default: - if(!WHITESPACE(C)) - /* Unquoted string value */ - state = ST_TAG_UNQUOTED_STRING; - } - break; - case ST_TAG_QUOTED_STRING: - /* - * Tag attribute's string value in quotes. - */ - if(C == CQUOTE) { - /* Return back to the tag state */ - state = ST_TAG_BODY; - } - break; - case ST_TAG_UNQUOTED_STRING: - if(C == RANGLE) { - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - } else if(WHITESPACE(C)) { - /* Return back to the tag state */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT_WAIT_DASH1: - if(C == CDASH) { - state = ST_COMMENT_WAIT_DASH2; - } else { - /* Some ordinary tag. */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT_WAIT_DASH2: - if(C == CDASH) { - /* Seen "<--" */ - state = ST_COMMENT; - } else { - /* Some ordinary tag */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT: - if(C == CDASH) { - state = ST_COMMENT_CLO_DASH2; - } - break; - case ST_COMMENT_CLO_DASH2: - if(C == CDASH) { - state = ST_COMMENT_CLO_RT; - } else { - /* This is not an end of a comment */ - state = ST_COMMENT; - } - break; - case ST_COMMENT_CLO_RT: - if(C == RANGLE) { - TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); - } else if(C == CDASH) { - /* Maintain current state, still waiting for '>' */ - } else { - state = ST_COMMENT; - } - break; - } /* switch(*ptr) */ - } /* for() */ + for (; p < end; p++) + { + int C = *(const unsigned char *)p; + switch (state) + { + case ST_TEXT: + /* + * Initial state: we're in the middle of some text, + * or just have started. + */ + if (C == LANGLE) /* We're now in the tag, probably */ + TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); + break; + case ST_TAG_START: + if (ALPHA(C) || (C == CSLASH)) + state = ST_TAG_BODY; + else if (C == EXCLAM) + state = ST_COMMENT_WAIT_DASH1; + else + /* + * Not characters and not whitespace. + * Must be something like "3 < 4". + */ + TOKEN_CB(PXML_TEXT, ST_TEXT, 1); /* Flush as data */ + break; + case ST_TAG_BODY: + switch (C) + { + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + case LANGLE: + /* + * The previous tag wasn't completed, but + * still recognized as valid. + * (Mozilla-compatible) + */ + TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); + break; + case CEQUAL: + state = ST_TAG_QUOTE_WAIT; + break; + } + break; + case ST_TAG_QUOTE_WAIT: + /* + * State after the equal sign ("=") in the tag. + */ + switch (C) + { + case CQUOTE: + state = ST_TAG_QUOTED_STRING; + break; + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + default: + if (!WHITESPACE( + C)) /* Unquoted string value */ + state = ST_TAG_UNQUOTED_STRING; + } + break; + case ST_TAG_QUOTED_STRING: + /* + * Tag attribute's string value in quotes. + */ + if (C == CQUOTE) + { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_TAG_UNQUOTED_STRING: + if (C == RANGLE) + { + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + } + else if (WHITESPACE(C)) + { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH1: + if (C == CDASH) + { + state = ST_COMMENT_WAIT_DASH2; + } + else + { + /* Some ordinary tag. */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH2: + if (C == CDASH) + { + /* Seen "<--" */ + state = ST_COMMENT; + } + else + { + /* Some ordinary tag */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT: + if (C == CDASH) + { + state = ST_COMMENT_CLO_DASH2; + } + break; + case ST_COMMENT_CLO_DASH2: + if (C == CDASH) + { + state = ST_COMMENT_CLO_RT; + } + else + { + /* This is not an end of a comment */ + state = ST_COMMENT; + } + break; + case ST_COMMENT_CLO_RT: + if (C == RANGLE) + { + TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); + } + else if (C == CDASH) + { + /* Maintain current state, still waiting for '>' + */ + } + else + { + state = ST_COMMENT; + } + break; + } /* switch(*ptr) */ + } /* for() */ /* * Flush the partially processed chunk, state permitting. */ - if(p - chunk_start) { - switch (state) { - case ST_COMMENT: - TOKEN_CB(PXML_COMMENT, state, 0); - break; - case ST_TEXT: - TOKEN_CB(PXML_TEXT, state, 0); - break; - default: break; /* a no-op */ + if (p - chunk_start) + { + switch (state) + { + case ST_COMMENT: + TOKEN_CB(PXML_COMMENT, state, 0); + break; + case ST_TEXT: + TOKEN_CB(PXML_TEXT, state, 0); + break; + default: + break; /* a no-op */ + } } - } finish: *stateContext = (int)state; return chunk_start - (const char *)xmlbuf; } - diff --git a/src/core/libs/supl/asn-rrlp/xer_support.h b/src/core/libs/supl/asn-rrlp/xer_support.h index b6c7fc4be..927092c01 100644 --- a/src/core/libs/supl/asn-rrlp/xer_support.h +++ b/src/core/libs/supl/asn-rrlp/xer_support.h @@ -14,41 +14,42 @@ extern "C" #endif /* - * Types of data transferred to the application. - */ + * Types of data transferred to the application. + */ typedef enum { PXML_TEXT, /* Plain text between XML tags. */ PXML_TAG, /* A tag, starting with '<'. */ PXML_COMMENT, /* An XML comment, including "". */ /* - * The following chunk types are reported if the chunk - * terminates the specified XML element. - */ + * The following chunk types are reported if the chunk + * terminates the specified XML element. + */ PXML_TAG_END, /* Tag ended */ PXML_COMMENT_END /* Comment ended */ } pxml_chunk_type_e; /* - * Callback function that is called by the parser when parsed data is - * available. The _opaque is the pointer to a field containing opaque user - * data specified in pxml_create() call. The chunk type is _type and the text - * data is the piece of buffer identified by _bufid (as supplied to - * pxml_feed() call) starting at offset _offset and of _size bytes size. - * The chunk is NOT '\0'-terminated. - */ + * Callback function that is called by the parser when parsed data is + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the + * text data is the piece of buffer identified by _bufid (as supplied to + * pxml_feed() call) starting at offset _offset and of _size bytes size. + * The chunk is NOT '\0'-terminated. + */ typedef int(pxml_callback_f)(pxml_chunk_type_e _type, - const void *_chunk_data, size_t _chunk_size, void *_key); + const void *_chunk_data, size_t _chunk_size, + void *_key); /* - * Parse the given buffer as it were a chunk of XML data. - * Invoke the specified callback each time the meaningful data is found. - * This function returns number of bytes consumed from the buffer. - * It will always be lesser than or equal to the specified _size. - * The next invocation of this function must account the difference. - */ + * Parse the given buffer as it were a chunk of XML data. + * Invoke the specified callback each time the meaningful data is found. + * This function returns number of bytes consumed from the buffer. + * It will always be lesser than or equal to the specified _size. + * The next invocation of this function must account the difference. + */ ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, - pxml_callback_f *cb, void *_key); + pxml_callback_f *cb, void *_key); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/AltitudeInfo.c b/src/core/libs/supl/asn-supl/AltitudeInfo.c index f457978c5..0da8ee698 100644 --- a/src/core/libs/supl/asn-supl/AltitudeInfo.c +++ b/src/core/libs/supl/asn-supl/AltitudeInfo.c @@ -6,9 +6,11 @@ #include "AltitudeInfo.h" -static int -altitudeDirection_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int altitudeDirection_2_constraint(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,238 +20,244 @@ altitudeDirection_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -altitudeDirection_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void altitudeDirection_2_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -static void -altitudeDirection_2_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +static void altitudeDirection_2_free(asn_TYPE_descriptor_t *td, + void *struct_ptr, int contents_only) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -static int -altitudeDirection_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +static int altitudeDirection_2_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -static asn_dec_rval_t -altitudeDirection_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +static asn_dec_rval_t altitudeDirection_2_decode_ber( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -static asn_enc_rval_t -altitudeDirection_2_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t altitudeDirection_2_encode_der( + asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -static asn_dec_rval_t -altitudeDirection_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +static asn_dec_rval_t altitudeDirection_2_decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, size_t size) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -static asn_enc_rval_t -altitudeDirection_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t altitudeDirection_2_encode_xer( + asn_TYPE_descriptor_t *td, void *structure, int ilevel, + enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static asn_dec_rval_t -altitudeDirection_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +static asn_dec_rval_t altitudeDirection_2_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -static asn_enc_rval_t -altitudeDirection_2_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +static asn_enc_rval_t altitudeDirection_2_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ altitudeDirection_2_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static int -memb_altitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_altitude_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_altUncertainty_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_altUncertainty_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_TYPE_ALTITUDE_DIRECTION_CONSTR_2 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALTITUDE_CONSTR_5 = { - { APC_CONSTRAINED, 15, 15, 0, 32767 } /* (0..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 15, 15, 0, 32767} /* (0..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ALT_UNCERTAINTY_CONSTR_6 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_altitudeDirection_value2enum_2[] = { - { 0, 6, "height" }, - { 1, 5, "depth" } -}; + {0, 6, "height"}, {1, 5, "depth"}}; static unsigned int asn_MAP_altitudeDirection_enum2value_2[] = { - 1, /* depth(1) */ - 0 /* height(0) */ + 1, /* depth(1) */ + 0 /* height(0) */ }; static asn_INTEGER_specifics_t asn_SPC_altitudeDirection_specs_2 = { - asn_MAP_altitudeDirection_value2enum_2, /* "tag" => N; sorted by tag */ - asn_MAP_altitudeDirection_enum2value_2, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_altitudeDirection_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_altitudeDirection_enum2value_2, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_altitudeDirection_tags_2[] = { - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2 = { - "altitudeDirection", - "altitudeDirection", - altitudeDirection_2_free, - altitudeDirection_2_print, - altitudeDirection_2_constraint, - altitudeDirection_2_decode_ber, - altitudeDirection_2_encode_der, - altitudeDirection_2_decode_xer, - altitudeDirection_2_encode_xer, - altitudeDirection_2_decode_uper, - altitudeDirection_2_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_altitudeDirection_tags_2, - sizeof(asn_DEF_altitudeDirection_tags_2) - /sizeof(asn_DEF_altitudeDirection_tags_2[0]) - 1, /* 1 */ - asn_DEF_altitudeDirection_tags_2, /* Same as above */ - sizeof(asn_DEF_altitudeDirection_tags_2) - /sizeof(asn_DEF_altitudeDirection_tags_2[0]), /* 2 */ - &ASN_PER_TYPE_ALTITUDE_DIRECTION_CONSTR_2, - 0, 0, /* Defined elsewhere */ - &asn_SPC_altitudeDirection_specs_2 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2 = { + "altitudeDirection", + "altitudeDirection", + altitudeDirection_2_free, + altitudeDirection_2_print, + altitudeDirection_2_constraint, + altitudeDirection_2_decode_ber, + altitudeDirection_2_encode_der, + altitudeDirection_2_decode_xer, + altitudeDirection_2_encode_xer, + altitudeDirection_2_decode_uper, + altitudeDirection_2_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_altitudeDirection_tags_2, + sizeof(asn_DEF_altitudeDirection_tags_2) / + sizeof(asn_DEF_altitudeDirection_tags_2[0]) - + 1, /* 1 */ + asn_DEF_altitudeDirection_tags_2, /* Same as above */ + sizeof(asn_DEF_altitudeDirection_tags_2) / + sizeof(asn_DEF_altitudeDirection_tags_2[0]), /* 2 */ + &ASN_PER_TYPE_ALTITUDE_DIRECTION_CONSTR_2, + 0, + 0, /* Defined elsewhere */ + &asn_SPC_altitudeDirection_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_AltitudeInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitudeDirection), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_altitudeDirection_2, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "altitudeDirection" - }, - { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitude), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_altitude_constraint_1, - &ASN_PER_MEMB_ALTITUDE_CONSTR_5, - 0, - "altitude" - }, - { ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altUncertainty), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_altUncertainty_constraint_1, - &ASN_PER_MEMB_ALT_UNCERTAINTY_CONSTR_6, - 0, - "altUncertainty" - }, + {ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitudeDirection), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_altitudeDirection_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "altitudeDirection"}, + {ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_altitude_constraint_1, + &ASN_PER_MEMB_ALTITUDE_CONSTR_5, 0, "altitude"}, + {ATF_NOFLAGS, 0, offsetof(struct AltitudeInfo, altUncertainty), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_altUncertainty_constraint_1, + &ASN_PER_MEMB_ALT_UNCERTAINTY_CONSTR_6, 0, "altUncertainty"}, }; static ber_tlv_tag_t asn_DEF_AltitudeInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_AltitudeInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* altitudeDirection at 86 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* altitude at 87 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* altUncertainty at 88 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* altitudeDirection at 86 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* altitude at 87 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* altUncertainty at 88 */ }; static asn_SEQUENCE_specifics_t asn_SPC_AltitudeInfo_specs_1 = { sizeof(struct AltitudeInfo), offsetof(struct AltitudeInfo, _asn_ctx), asn_MAP_AltitudeInfo_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AltitudeInfo = { "AltitudeInfo", @@ -263,15 +271,15 @@ asn_TYPE_descriptor_t asn_DEF_AltitudeInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_AltitudeInfo_tags_1, - sizeof(asn_DEF_AltitudeInfo_tags_1) - /sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ - asn_DEF_AltitudeInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_AltitudeInfo_tags_1) - /sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_AltitudeInfo_tags_1) / + sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ + asn_DEF_AltitudeInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_AltitudeInfo_tags_1) / + sizeof(asn_DEF_AltitudeInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_AltitudeInfo_1, - 3, /* Elements count */ - &asn_SPC_AltitudeInfo_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_AltitudeInfo_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/AltitudeInfo.h b/src/core/libs/supl/asn-supl/AltitudeInfo.h index a9aa25744..e64a077c1 100644 --- a/src/core/libs/supl/asn-supl/AltitudeInfo.h +++ b/src/core/libs/supl/asn-supl/AltitudeInfo.h @@ -7,7 +7,6 @@ #ifndef _AltitudeInfo_H_ #define _AltitudeInfo_H_ - #include /* Including external dependencies */ @@ -34,16 +33,17 @@ extern "C" long altitude; long altUncertainty; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AltitudeInfo_t; /* Implementation */ - /* extern asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2; // (Use -fall-defs-global to expose) */ + /* extern asn_TYPE_descriptor_t asn_DEF_altitudeDirection_2; // (Use + * -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_AltitudeInfo; #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/BIT_STRING.c b/src/core/libs/supl/asn-supl/BIT_STRING.c index d74d70f3a..8439afc33 100644 --- a/src/core/libs/supl/asn-supl/BIT_STRING.c +++ b/src/core/libs/supl/asn-supl/BIT_STRING.c @@ -10,72 +10,68 @@ * BIT STRING basic type description. */ static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { - sizeof(BIT_STRING_t), - offsetof(BIT_STRING_t, _asn_ctx), - ASN_OSUBV_BIT -}; + sizeof(BIT_STRING_t), offsetof(BIT_STRING_t, _asn_ctx), ASN_OSUBV_BIT}; asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { "BIT STRING", "BIT_STRING", - OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ BIT_STRING_print, BIT_STRING_constraint, - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ - OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ OCTET_STRING_decode_xer_binary, BIT_STRING_encode_xer, - OCTET_STRING_decode_uper, /* Unaligned PER decoder */ - OCTET_STRING_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BIT_STRING_tags, - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - asn_DEF_BIT_STRING_tags, /* Same as above */ - sizeof(asn_DEF_BIT_STRING_tags) - / sizeof(asn_DEF_BIT_STRING_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - &asn_DEF_BIT_STRING_specs -}; + sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), + asn_DEF_BIT_STRING_tags, /* Same as above */ + sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + &asn_DEF_BIT_STRING_specs}; /* * BIT STRING generic constraint. */ -int -BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - if(st && st->buf) { - if((st->size == 0 && st->bits_unused) - || st->bits_unused < 0 || st->bits_unused > 7) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: invalid padding byte (%s:%d)", - td->name, __FILE__, __LINE__); + if (st && st->buf) + { + if ((st->size == 0 && st->bits_unused) || st->bits_unused < 0 || + st->bits_unused > 7) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: invalid padding byte (%s:%d)", td->name, + __FILE__, __LINE__); + return -1; + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } return 0; } -static char *_bit_pattern[16] = { - "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", - "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" -}; +static char *_bit_pattern[16] = {"0000", "0001", "0010", "0011", "0100", "0101", + "0110", "0111", "1000", "1001", "1010", "1011", + "1100", "1101", "1110", "1111"}; -asn_enc_rval_t -BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; char scratch[128]; char *p = scratch; @@ -85,61 +81,60 @@ BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, uint8_t *buf; uint8_t *end; - if(!st || !st->buf) - _ASN_ENCODE_FAILED; + if (!st || !st->buf) _ASN_ENCODE_FAILED; er.encoded = 0; buf = st->buf; - end = buf + st->size - 1; /* Last byte is special */ + end = buf + st->size - 1; /* Last byte is special */ /* * Binary dump */ - for(; buf < end; buf++) { - int v = *buf; - int nline = xcan?0:(((buf - st->buf) % 8) == 0); - if(p >= scend || nline) { - er.encoded += p - scratch; - _ASN_CALLBACK(scratch, p - scratch); - p = scratch; - if(nline) _i_ASN_TEXT_INDENT(1, ilevel); + for (; buf < end; buf++) + { + int v = *buf; + int nline = xcan ? 0 : (((buf - st->buf) % 8) == 0); + if (p >= scend || nline) + { + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + p = scratch; + if (nline) _i_ASN_TEXT_INDENT(1, ilevel); + } + memcpy(p + 0, _bit_pattern[v >> 4], 4); + memcpy(p + 4, _bit_pattern[v & 0x0f], 4); + p += 8; } - memcpy(p + 0, _bit_pattern[v >> 4], 4); - memcpy(p + 4, _bit_pattern[v & 0x0f], 4); - p += 8; - } - if(!xcan && ((buf - st->buf) % 8) == 0) - _i_ASN_TEXT_INDENT(1, ilevel); + if (!xcan && ((buf - st->buf) % 8) == 0) _i_ASN_TEXT_INDENT(1, ilevel); er.encoded += p - scratch; _ASN_CALLBACK(scratch, p - scratch); p = scratch; - if(buf == end) { - int v = *buf; - int ubits = st->bits_unused; - int i; - for(i = 7; i >= ubits; i--) - *p++ = (v & (1 << i)) ? 0x31 : 0x30; - er.encoded += p - scratch; - _ASN_CALLBACK(scratch, p - scratch); - } + if (buf == end) + { + int v = *buf; + int ubits = st->bits_unused; + int i; + for (i = 7; i >= ubits; i--) *p++ = (v & (1 << i)) ? 0x31 : 0x30; + er.encoded += p - scratch; + _ASN_CALLBACK(scratch, p - scratch); + } - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } - /* * BIT STRING specific contents printer. */ -int -BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; char scratch[64]; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; @@ -147,10 +142,9 @@ BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, uint8_t *end; char *p = scratch; - (void)td; /* Unused argument */ + (void)td; /* Unused argument */ - if(!st || !st->buf) - return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; ilevel++; buf = st->buf; @@ -159,30 +153,32 @@ BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, /* * Hexadecimal dump. */ - for(; buf < end; buf++) { - if((buf - st->buf) % 16 == 0 && (st->size > 16) - && buf != st->buf) { - _i_INDENT(1); - /* Dump the string */ - if(cb(scratch, p - scratch, app_key) < 0) return -1; - p = scratch; - } - *p++ = h2c[*buf >> 4]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - - if(p > scratch) { - p--; /* Eat the tailing space */ - - if((st->size > 16)) { - _i_INDENT(1); + for (; buf < end; buf++) + { + if ((buf - st->buf) % 16 == 0 && (st->size > 16) && buf != st->buf) + { + _i_INDENT(1); + /* Dump the string */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; } - /* Dump the incomplete 16-bytes row */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - } + if (p > scratch) + { + p--; /* Eat the tailing space */ + + if ((st->size > 16)) + { + _i_INDENT(1); + } + + /* Dump the incomplete 16-bytes row */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + } return 0; } diff --git a/src/core/libs/supl/asn-supl/BOOLEAN.c b/src/core/libs/supl/asn-supl/BOOLEAN.c index c2288b767..985f2638e 100644 --- a/src/core/libs/supl/asn-supl/BOOLEAN.c +++ b/src/core/libs/supl/asn-supl/BOOLEAN.c @@ -10,8 +10,7 @@ * BOOLEAN basic type description. */ static ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (1 << 2))}; asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { "BOOLEAN", "BOOLEAN", @@ -22,243 +21,272 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { BOOLEAN_encode_der, BOOLEAN_decode_xer, BOOLEAN_encode_xer, - BOOLEAN_decode_uper, /* Unaligned PER decoder */ - BOOLEAN_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + BOOLEAN_decode_uper, /* Unaligned PER decoder */ + BOOLEAN_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_BOOLEAN_tags, sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - asn_DEF_BOOLEAN_tags, /* Same as above */ + asn_DEF_BOOLEAN_tags, /* Same as above */ sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Decode BOOLEAN type. */ -asn_dec_rval_t -BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **bool_value, const void *buf_ptr, size_t size, - int tag_mode) { +asn_dec_rval_t BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **bool_value, + const void *buf_ptr, size_t size, + int tag_mode) +{ BOOLEAN_t *st = (BOOLEAN_t *)*bool_value; asn_dec_rval_t rval; ber_tlv_len_t length; ber_tlv_len_t lidx; - if(st == NULL) { - st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); - if(st == NULL) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; + if (st == NULL) + { + st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); + if (st == NULL) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } } - } - ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", td->name, tag_mode); /* * Check tags. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("Boolean length is %d bytes", (int)length); buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } /* * Compute boolean value. */ - for(*st = 0, lidx = 0; - (lidx < length) && *st == 0; lidx++) { - /* - * Very simple approach: read bytes until the end or - * value is already TRUE. - * BOOLEAN is not supposed to contain meaningful data anyway. - */ - *st |= ((const uint8_t *)buf_ptr)[lidx]; - } + for (*st = 0, lidx = 0; (lidx < length) && *st == 0; lidx++) + { + /* + * Very simple approach: read bytes until the end or + * value is already TRUE. + * BOOLEAN is not supposed to contain meaningful data anyway. + */ + *st |= ((const uint8_t *)buf_ptr)[lidx]; + } rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", - (long)rval.consumed, (long)length, - td->name, *st); + ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", (long)rval.consumed, + (long)length, td->name, *st); return rval; } -asn_enc_rval_t -BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t erval; BOOLEAN_t *st = (BOOLEAN_t *)sptr; erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - - if(cb) { - uint8_t bool_value; - - bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ - - if(cb(&bool_value, 1, app_key) < 0) { - erval.encoded = -1; + if (erval.encoded == -1) + { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } - } + + if (cb) + { + uint8_t bool_value; + + bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ + + if (cb(&bool_value, 1, app_key) < 0) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } erval.encoded += 1; _ASN_ENCODED_OK(erval); } - /* * Decode the chunk of XML text encoding INTEGER. */ -static enum xer_pbd_rval -BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { +static enum xer_pbd_rval BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, + void *sptr, + const void *chunk_buf, + size_t chunk_size) +{ BOOLEAN_t *st = (BOOLEAN_t *)sptr; const char *p = (const char *)chunk_buf; (void)td; - if(chunk_size && p[0] == 0x3c /* '<' */) { - switch(xer_check_tag(chunk_buf, chunk_size, "false")) { - case XCT_BOTH: - /* "" */ - *st = 0; - break; - case XCT_UNKNOWN_BO: - if(xer_check_tag(chunk_buf, chunk_size, "true") - != XCT_BOTH) - return XPBD_BROKEN_ENCODING; - /* "" */ - *st = 1; /* Or 0xff as in DER?.. */ - break; - default: - return XPBD_BROKEN_ENCODING; + if (chunk_size && p[0] == 0x3c /* '<' */) + { + switch (xer_check_tag(chunk_buf, chunk_size, "false")) + { + case XCT_BOTH: + /* "" */ + *st = 0; + break; + case XCT_UNKNOWN_BO: + if (xer_check_tag(chunk_buf, chunk_size, "true") != + XCT_BOTH) + return XPBD_BROKEN_ENCODING; + /* "" */ + *st = 1; /* Or 0xff as in DER?.. */ + break; + default: + return XPBD_BROKEN_ENCODING; + } + return XPBD_BODY_CONSUMED; + } + else + { + if (xer_is_whitespace(chunk_buf, chunk_size)) + return XPBD_NOT_BODY_IGNORE; + else + return XPBD_BROKEN_ENCODING; } - return XPBD_BODY_CONSUMED; - } else { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return XPBD_NOT_BODY_IGNORE; - else - return XPBD_BROKEN_ENCODING; - } } - -asn_dec_rval_t -BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size, - BOOLEAN__xer_body_decode); +asn_dec_rval_t BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ + return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(BOOLEAN_t), + opt_mname, buf_ptr, size, + BOOLEAN__xer_body_decode); } -asn_enc_rval_t -BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; - if(!st) _ASN_ENCODE_FAILED; + if (!st) _ASN_ENCODE_FAILED; - if(*st) { - _ASN_CALLBACK("", 7); - er.encoded = 7; - } else { - _ASN_CALLBACK("", 8); - er.encoded = 8; - } + if (*st) + { + _ASN_CALLBACK("", 7); + er.encoded = 7; + } + else + { + _ASN_CALLBACK("", 8); + er.encoded = 8; + } _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -int -BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; const char *buf; size_t buflen; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st) { - if(*st) { - buf = "TRUE"; - buflen = 4; - } else { - buf = "FALSE"; - buflen = 5; + if (st) + { + if (*st) + { + buf = "TRUE"; + buflen = 4; + } + else + { + buf = "FALSE"; + buflen = 5; + } + } + else + { + buf = ""; + buflen = 8; } - } else { - buf = ""; - buflen = 8; - } return (cb(buf, buflen, app_key) < 0) ? -1 : 0; } -void -BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { - if(td && ptr && !contents_only) { - FREEMEM(ptr); - } +void BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (td && ptr && !contents_only) + { + FREEMEM(ptr); + } } -asn_dec_rval_t -BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rv; BOOLEAN_t *st = (BOOLEAN_t *)*sptr; (void)opt_codec_ctx; (void)constraints; - if(!st) { - st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } /* * Extract a single bit */ - switch(per_get_few_bits(pd, 1)) { - case 1: *st = 1; break; - case 0: *st = 0; break; - case -1: default: _ASN_DECODE_STARVED; - } + switch (per_get_few_bits(pd, 1)) + { + case 1: + *st = 1; + break; + case 0: + *st = 0; + break; + case -1: + default: + _ASN_DECODE_STARVED; + } ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); @@ -267,16 +295,16 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } - -asn_enc_rval_t -BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er; (void)constraints; - if(!st) _ASN_ENCODE_FAILED; + if (!st) _ASN_ENCODE_FAILED; per_put_few_bits(po, *st ? 1 : 0, 1); diff --git a/src/core/libs/supl/asn-supl/BOOLEAN.h b/src/core/libs/supl/asn-supl/BOOLEAN.h index b74f2b430..b99faaa4a 100644 --- a/src/core/libs/supl/asn-supl/BOOLEAN.h +++ b/src/core/libs/supl/asn-supl/BOOLEAN.h @@ -13,10 +13,10 @@ extern "C" #endif /* - * The underlying integer may contain various values, but everything - * non-zero is capped to 0xff by the DER encoder. The BER decoder may - * yield non-zero values different from 1, beware. - */ + * The underlying integer may contain various values, but everything + * non-zero is capped to 0xff by the DER encoder. The BER decoder may + * yield non-zero values different from 1, beware. + */ typedef int BOOLEAN_t; extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; diff --git a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c index 6c92f10c7..59325b204 100644 --- a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c +++ b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.c @@ -6,119 +6,135 @@ #include "CPICH-Ec-N0.h" -int -CPICH_Ec_N0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CPICH_Ec_N0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -CPICH_Ec_N0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void CPICH_Ec_N0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -CPICH_Ec_N0_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void CPICH_Ec_N0_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -CPICH_Ec_N0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int CPICH_Ec_N0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -CPICH_Ec_N0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t CPICH_Ec_N0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -CPICH_Ec_N0_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CPICH_Ec_N0_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -CPICH_Ec_N0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t CPICH_Ec_N0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -CPICH_Ec_N0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CPICH_Ec_N0_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -CPICH_Ec_N0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t CPICH_Ec_N0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -CPICH_Ec_N0_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t CPICH_Ec_N0_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ CPICH_Ec_N0_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_CPICH_EC_N0_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_CPICH_Ec_N0_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_CPICH_Ec_N0 = { "CPICH-Ec-N0", "CPICH-Ec-N0", @@ -131,14 +147,15 @@ asn_TYPE_descriptor_t asn_DEF_CPICH_Ec_N0 = { CPICH_Ec_N0_encode_xer, CPICH_Ec_N0_decode_uper, CPICH_Ec_N0_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CPICH_Ec_N0_tags_1, - sizeof(asn_DEF_CPICH_Ec_N0_tags_1) - /sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ - asn_DEF_CPICH_Ec_N0_tags_1, /* Same as above */ - sizeof(asn_DEF_CPICH_Ec_N0_tags_1) - /sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ + sizeof(asn_DEF_CPICH_Ec_N0_tags_1) / + sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ + asn_DEF_CPICH_Ec_N0_tags_1, /* Same as above */ + sizeof(asn_DEF_CPICH_Ec_N0_tags_1) / + sizeof(asn_DEF_CPICH_Ec_N0_tags_1[0]), /* 1 */ &ASN_PER_TYPE_CPICH_EC_N0_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h index 1aa7b5fc2..827030673 100644 --- a/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h +++ b/src/core/libs/supl/asn-supl/CPICH-Ec-N0.h @@ -7,7 +7,6 @@ #ifndef _CPICH_Ec_N0_H_ #define _CPICH_Ec_N0_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/CPICH-RSCP.c b/src/core/libs/supl/asn-supl/CPICH-RSCP.c index 35f716155..b91af81fa 100644 --- a/src/core/libs/supl/asn-supl/CPICH-RSCP.c +++ b/src/core/libs/supl/asn-supl/CPICH-RSCP.c @@ -6,119 +6,131 @@ #include "CPICH-RSCP.h" -int -CPICH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CPICH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -CPICH_RSCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void CPICH_RSCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -CPICH_RSCP_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void CPICH_RSCP_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -CPICH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int CPICH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -CPICH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t CPICH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -CPICH_RSCP_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CPICH_RSCP_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -CPICH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t CPICH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -CPICH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CPICH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -CPICH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t CPICH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -CPICH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t CPICH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ CPICH_RSCP_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_CPICH_RSCP_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_CPICH_RSCP_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_CPICH_RSCP = { "CPICH-RSCP", "CPICH-RSCP", @@ -131,14 +143,15 @@ asn_TYPE_descriptor_t asn_DEF_CPICH_RSCP = { CPICH_RSCP_encode_xer, CPICH_RSCP_decode_uper, CPICH_RSCP_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CPICH_RSCP_tags_1, - sizeof(asn_DEF_CPICH_RSCP_tags_1) - /sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ - asn_DEF_CPICH_RSCP_tags_1, /* Same as above */ - sizeof(asn_DEF_CPICH_RSCP_tags_1) - /sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ + sizeof(asn_DEF_CPICH_RSCP_tags_1) / + sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ + asn_DEF_CPICH_RSCP_tags_1, /* Same as above */ + sizeof(asn_DEF_CPICH_RSCP_tags_1) / + sizeof(asn_DEF_CPICH_RSCP_tags_1[0]), /* 1 */ &ASN_PER_TYPE_CPICH_RSCP_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/CPICH-RSCP.h b/src/core/libs/supl/asn-supl/CPICH-RSCP.h index 832582052..42f96bd4c 100644 --- a/src/core/libs/supl/asn-supl/CPICH-RSCP.h +++ b/src/core/libs/supl/asn-supl/CPICH-RSCP.h @@ -7,7 +7,6 @@ #ifndef _CPICH_RSCP_H_ #define _CPICH_RSCP_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/CdmaCellInformation.c b/src/core/libs/supl/asn-supl/CdmaCellInformation.c index 7e3023d03..ea6f78e86 100644 --- a/src/core/libs/supl/asn-supl/CdmaCellInformation.c +++ b/src/core/libs/supl/asn-supl/CdmaCellInformation.c @@ -6,341 +6,339 @@ #include "CdmaCellInformation.h" -static int -memb_refNID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refNID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refSID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refSID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 32767)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 32767)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refBASEID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refBASEID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refBASELAT_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refBASELAT_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 4194303)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 4194303)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_reBASELONG_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_reBASELONG_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refREFPN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refREFPN_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refWeekNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refWeekNumber_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refSeconds_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refSeconds_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 4194303)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 4194303)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_NID_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_SID_CONSTR_3 = { - { APC_CONSTRAINED, 15, 15, 0, 32767 } /* (0..32767) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 15, 15, 0, 32767} /* (0..32767) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_BASEID_CONSTR_4 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_BASELAT_CONSTR_5 = { - { APC_CONSTRAINED, 22, -1, 0, 4194303 } /* (0..4194303) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 22, -1, 0, 4194303} /* (0..4194303) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RE_BASELONG_CONSTR_6 = { - { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 23, -1, 0, 8388607} /* (0..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_REFPN_CONSTR_7 = { - { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 9, 9, 0, 511} /* (0..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_WEEK_NUMBER_CONSTR_8 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_SECONDS_CONSTR_9 = { - { APC_CONSTRAINED, 22, -1, 0, 4194303 } /* (0..4194303) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 22, -1, 0, 4194303} /* (0..4194303) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_CdmaCellInformation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refNID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refNID_constraint_1, - &ASN_PER_MEMB_REF_NID_CONSTR_2, - 0, - "refNID" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSID), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refSID_constraint_1, - &ASN_PER_MEMB_REF_SID_CONSTR_3, - 0, - "refSID" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASEID), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refBASEID_constraint_1, - &ASN_PER_MEMB_REF_BASEID_CONSTR_4, - 0, - "refBASEID" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASELAT), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refBASELAT_constraint_1, - &ASN_PER_MEMB_REF_BASELAT_CONSTR_5, - 0, - "refBASELAT" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, reBASELONG), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_reBASELONG_constraint_1, - &ASN_PER_MEMB_RE_BASELONG_CONSTR_6, - 0, - "reBASELONG" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refREFPN), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refREFPN_constraint_1, - &ASN_PER_MEMB_REF_REFPN_CONSTR_7, - 0, - "refREFPN" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refWeekNumber), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refWeekNumber_constraint_1, - &ASN_PER_MEMB_REF_WEEK_NUMBER_CONSTR_8, - 0, - "refWeekNumber" - }, - { ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSeconds), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refSeconds_constraint_1, - &ASN_PER_MEMB_REF_SECONDS_CONSTR_9, - 0, - "refSeconds" - }, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refNID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refNID_constraint_1, + &ASN_PER_MEMB_REF_NID_CONSTR_2, 0, "refNID"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refSID_constraint_1, + &ASN_PER_MEMB_REF_SID_CONSTR_3, 0, "refSID"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASEID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refBASEID_constraint_1, + &ASN_PER_MEMB_REF_BASEID_CONSTR_4, 0, "refBASEID"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refBASELAT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refBASELAT_constraint_1, + &ASN_PER_MEMB_REF_BASELAT_CONSTR_5, 0, "refBASELAT"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, reBASELONG), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_reBASELONG_constraint_1, + &ASN_PER_MEMB_RE_BASELONG_CONSTR_6, 0, "reBASELONG"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refREFPN), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refREFPN_constraint_1, + &ASN_PER_MEMB_REF_REFPN_CONSTR_7, 0, "refREFPN"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refWeekNumber), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refWeekNumber_constraint_1, + &ASN_PER_MEMB_REF_WEEK_NUMBER_CONSTR_8, 0, "refWeekNumber"}, + {ATF_NOFLAGS, 0, offsetof(struct CdmaCellInformation, refSeconds), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refSeconds_constraint_1, + &ASN_PER_MEMB_REF_SECONDS_CONSTR_9, 0, "refSeconds"}, }; static ber_tlv_tag_t asn_DEF_CdmaCellInformation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_CdmaCellInformation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refNID at 92 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refSID at 93 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refBASEID at 94 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* refBASELAT at 95 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* reBASELONG at 96 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* refREFPN at 97 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* refWeekNumber at 98 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* refSeconds at 99 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refNID at 92 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* refSID at 93 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* refBASEID at 94 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* refBASELAT at 95 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* reBASELONG at 96 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* refREFPN at 97 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* refWeekNumber at 98 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0} /* refSeconds at 99 */ }; static asn_SEQUENCE_specifics_t asn_SPC_CdmaCellInformation_specs_1 = { sizeof(struct CdmaCellInformation), offsetof(struct CdmaCellInformation, _asn_ctx), asn_MAP_CdmaCellInformation_tag2el_1, - 8, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 7, /* Start extensions */ - 9 /* Stop extensions */ + 8, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 7, /* Start extensions */ + 9 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_CdmaCellInformation = { "CdmaCellInformation", @@ -354,15 +352,15 @@ asn_TYPE_descriptor_t asn_DEF_CdmaCellInformation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CdmaCellInformation_tags_1, - sizeof(asn_DEF_CdmaCellInformation_tags_1) - /sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ - asn_DEF_CdmaCellInformation_tags_1, /* Same as above */ - sizeof(asn_DEF_CdmaCellInformation_tags_1) - /sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_CdmaCellInformation_tags_1) / + sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ + asn_DEF_CdmaCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_CdmaCellInformation_tags_1) / + sizeof(asn_DEF_CdmaCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_CdmaCellInformation_1, - 8, /* Elements count */ - &asn_SPC_CdmaCellInformation_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_CdmaCellInformation_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/CdmaCellInformation.h b/src/core/libs/supl/asn-supl/CdmaCellInformation.h index 7cb6b36ec..1765c96a9 100644 --- a/src/core/libs/supl/asn-supl/CdmaCellInformation.h +++ b/src/core/libs/supl/asn-supl/CdmaCellInformation.h @@ -7,7 +7,6 @@ #ifndef _CdmaCellInformation_H_ #define _CdmaCellInformation_H_ - #include /* Including external dependencies */ @@ -31,9 +30,9 @@ extern "C" long refWeekNumber; long refSeconds; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/CellInfo.c b/src/core/libs/supl/asn-supl/CellInfo.c index 8afe49910..f8c0de7e3 100644 --- a/src/core/libs/supl/asn-supl/CellInfo.c +++ b/src/core/libs/supl/asn-supl/CellInfo.c @@ -7,43 +7,35 @@ #include "CellInfo.h" static asn_per_constraints_t ASN_PER_TYPE_CELL_INFO_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_CellInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.gsmCell), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_GsmCellInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "gsmCell" - }, - { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.wcdmaCell), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_WcdmaCellInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "wcdmaCell" - }, - { ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.cdmaCell), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CdmaCellInformation, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cdmaCell" - }, + {ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.gsmCell), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_GsmCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "gsmCell"}, + {ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.wcdmaCell), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_WcdmaCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "wcdmaCell"}, + {ATF_NOFLAGS, 0, offsetof(struct CellInfo, choice.cdmaCell), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CdmaCellInformation, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cdmaCell"}, }; static asn_TYPE_tag2member_t asn_MAP_CellInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gsmCell at 61 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* wcdmaCell at 62 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cdmaCell at 63 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gsmCell at 61 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* wcdmaCell at 62 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* cdmaCell at 63 */ }; static asn_CHOICE_specifics_t asn_SPC_CellInfo_specs_1 = { sizeof(struct CellInfo), @@ -51,9 +43,9 @@ static asn_CHOICE_specifics_t asn_SPC_CellInfo_specs_1 = { offsetof(struct CellInfo, present), sizeof(((struct CellInfo *)0)->present), asn_MAP_CellInfo_tag2el_1, - 3, /* Count of tags in the map */ + 3, /* Count of tags in the map */ 0, - 3 /* Extensions start */ + 3 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_CellInfo = { "CellInfo", @@ -68,12 +60,12 @@ asn_TYPE_descriptor_t asn_DEF_CellInfo = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_CELL_INFO_CONSTR_1, asn_MBR_CellInfo_1, - 3, /* Elements count */ - &asn_SPC_CellInfo_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_CellInfo_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/CellInfo.h b/src/core/libs/supl/asn-supl/CellInfo.h index ad059ba51..f688eb7ae 100644 --- a/src/core/libs/supl/asn-supl/CellInfo.h +++ b/src/core/libs/supl/asn-supl/CellInfo.h @@ -7,7 +7,6 @@ #ifndef _CellInfo_H_ #define _CellInfo_H_ - #include /* Including external dependencies */ @@ -41,9 +40,9 @@ extern "C" WcdmaCellInformation_t wcdmaCell; CdmaCellInformation_t cdmaCell; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResults.c b/src/core/libs/supl/asn-supl/CellMeasuredResults.c index dfc335eda..e27f43322 100644 --- a/src/core/libs/supl/asn-supl/CellMeasuredResults.c +++ b/src/core/libs/supl/asn-supl/CellMeasuredResults.c @@ -6,244 +6,207 @@ #include "CellMeasuredResults.h" -static int -memb_cellIdentity_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_cellIdentity_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 268435455)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 268435455)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_TYPE_MODE_SPECIFIC_INFO_CONSTR_3 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CELL_IDENTITY_CONSTR_2 = { - { APC_CONSTRAINED, 28, -1, 0, 268435455 } /* (0..268435455) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 28, -1, 0, 268435455} /* (0..268435455) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_fdd_4[] = { - { ATF_NOFLAGS, 0, offsetof(struct fdd, primaryCPICH_Info), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PrimaryCPICH_Info, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "primaryCPICH-Info" - }, - { ATF_POINTER, 3, offsetof(struct fdd, cpich_Ec_N0), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CPICH_Ec_N0, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cpich-Ec-N0" - }, - { ATF_POINTER, 2, offsetof(struct fdd, cpich_RSCP), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CPICH_RSCP, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cpich-RSCP" - }, - { ATF_POINTER, 1, offsetof(struct fdd, pathloss), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Pathloss, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "pathloss" - }, + {ATF_NOFLAGS, 0, offsetof(struct fdd, primaryCPICH_Info), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrimaryCPICH_Info, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "primaryCPICH-Info"}, + {ATF_POINTER, 3, offsetof(struct fdd, cpich_Ec_N0), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CPICH_Ec_N0, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cpich-Ec-N0"}, + {ATF_POINTER, 2, offsetof(struct fdd, cpich_RSCP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CPICH_RSCP, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cpich-RSCP"}, + {ATF_POINTER, 1, offsetof(struct fdd, pathloss), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Pathloss, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "pathloss"}, }; -static int asn_MAP_fdd_oms_4[] = { 1, 2, 3 }; +static int asn_MAP_fdd_oms_4[] = {1, 2, 3}; static ber_tlv_tag_t asn_DEF_fdd_tags_4[] = { - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_fdd_tag2el_4[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* primaryCPICH-Info at 163 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cpich-Ec-N0 at 164 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* cpich-RSCP at 165 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pathloss at 166 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* primaryCPICH-Info at 163 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* cpich-Ec-N0 at 164 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* cpich-RSCP at 165 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* pathloss at 166 */ }; static asn_SEQUENCE_specifics_t asn_SPC_fdd_specs_4 = { sizeof(struct fdd), offsetof(struct fdd, _asn_ctx), asn_MAP_fdd_tag2el_4, - 4, /* Count of tags in the map */ - asn_MAP_fdd_oms_4, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_fdd_oms_4, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_fdd_4 = { - "fdd", - "fdd", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - SEQUENCE_decode_uper, - SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_fdd_tags_4, - sizeof(asn_DEF_fdd_tags_4) - /sizeof(asn_DEF_fdd_tags_4[0]) - 1, /* 1 */ - asn_DEF_fdd_tags_4, /* Same as above */ - sizeof(asn_DEF_fdd_tags_4) - /sizeof(asn_DEF_fdd_tags_4[0]), /* 2 */ - 0, /* No PER visible constraints */ - asn_MBR_fdd_4, - 4, /* Elements count */ - &asn_SPC_fdd_specs_4 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_fdd_4 = { + "fdd", + "fdd", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_fdd_tags_4, + sizeof(asn_DEF_fdd_tags_4) / sizeof(asn_DEF_fdd_tags_4[0]) - 1, /* 1 */ + asn_DEF_fdd_tags_4, /* Same as above */ + sizeof(asn_DEF_fdd_tags_4) / sizeof(asn_DEF_fdd_tags_4[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_fdd_4, + 4, /* Elements count */ + &asn_SPC_fdd_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_tdd_9[] = { - { ATF_NOFLAGS, 0, offsetof(struct tdd, cellParametersID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellParametersID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cellParametersID" - }, - { ATF_POINTER, 4, offsetof(struct tdd, proposedTGSN), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TGSN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "proposedTGSN" - }, - { ATF_POINTER, 3, offsetof(struct tdd, primaryCCPCH_RSCP), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PrimaryCCPCH_RSCP, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "primaryCCPCH-RSCP" - }, - { ATF_POINTER, 2, offsetof(struct tdd, pathloss), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Pathloss, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "pathloss" - }, - { ATF_POINTER, 1, offsetof(struct tdd, timeslotISCP_List), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_TimeslotISCP_List, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timeslotISCP-List" - }, + {ATF_NOFLAGS, 0, offsetof(struct tdd, cellParametersID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellParametersID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cellParametersID"}, + {ATF_POINTER, 4, offsetof(struct tdd, proposedTGSN), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TGSN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "proposedTGSN"}, + {ATF_POINTER, 3, offsetof(struct tdd, primaryCCPCH_RSCP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrimaryCCPCH_RSCP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "primaryCCPCH-RSCP"}, + {ATF_POINTER, 2, offsetof(struct tdd, pathloss), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Pathloss, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "pathloss"}, + {ATF_POINTER, 1, offsetof(struct tdd, timeslotISCP_List), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_TimeslotISCP_List, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timeslotISCP-List"}, }; -static int asn_MAP_tdd_oms_9[] = { 1, 2, 3, 4 }; +static int asn_MAP_tdd_oms_9[] = {1, 2, 3, 4}; static ber_tlv_tag_t asn_DEF_tdd_tags_9[] = { - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_tdd_tag2el_9[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellParametersID at 168 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* proposedTGSN at 169 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* primaryCCPCH-RSCP at 170 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pathloss at 171 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* timeslotISCP-List at 172 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* cellParametersID at 168 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* proposedTGSN at 169 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* primaryCCPCH-RSCP at 170 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* pathloss at 171 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* timeslotISCP-List at 172 */ }; static asn_SEQUENCE_specifics_t asn_SPC_tdd_specs_9 = { sizeof(struct tdd), offsetof(struct tdd, _asn_ctx), asn_MAP_tdd_tag2el_9, - 5, /* Count of tags in the map */ - asn_MAP_tdd_oms_9, /* Optional members */ - 4, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_tdd_oms_9, /* Optional members */ + 4, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_tdd_9 = { - "tdd", - "tdd", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - SEQUENCE_decode_uper, - SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_tdd_tags_9, - sizeof(asn_DEF_tdd_tags_9) - /sizeof(asn_DEF_tdd_tags_9[0]) - 1, /* 1 */ - asn_DEF_tdd_tags_9, /* Same as above */ - sizeof(asn_DEF_tdd_tags_9) - /sizeof(asn_DEF_tdd_tags_9[0]), /* 2 */ - 0, /* No PER visible constraints */ - asn_MBR_tdd_9, - 5, /* Elements count */ - &asn_SPC_tdd_specs_9 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_tdd_9 = { + "tdd", + "tdd", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_tdd_tags_9, + sizeof(asn_DEF_tdd_tags_9) / sizeof(asn_DEF_tdd_tags_9[0]) - 1, /* 1 */ + asn_DEF_tdd_tags_9, /* Same as above */ + sizeof(asn_DEF_tdd_tags_9) / sizeof(asn_DEF_tdd_tags_9[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_tdd_9, + 5, /* Elements count */ + &asn_SPC_tdd_specs_9 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_modeSpecificInfo_3[] = { - { ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.fdd), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - 0, - &asn_DEF_fdd_4, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fdd" - }, - { ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.tdd), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - 0, - &asn_DEF_tdd_9, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tdd" - }, + {ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.fdd), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, &asn_DEF_fdd_4, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fdd"}, + {ATF_NOFLAGS, 0, offsetof(struct modeSpecificInfo, choice.tdd), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, &asn_DEF_tdd_9, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tdd"}, }; static asn_TYPE_tag2member_t asn_MAP_modeSpecificInfo_tag2el_3[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fdd at 163 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* tdd at 168 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* fdd at 163 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* tdd at 168 */ }; static asn_CHOICE_specifics_t asn_SPC_modeSpecificInfo_specs_3 = { sizeof(struct modeSpecificInfo), @@ -251,71 +214,63 @@ static asn_CHOICE_specifics_t asn_SPC_modeSpecificInfo_specs_3 = { offsetof(struct modeSpecificInfo, present), sizeof(((struct modeSpecificInfo *)0)->present), asn_MAP_modeSpecificInfo_tag2el_3, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - -1 /* Extensions start */ + -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_modeSpecificInfo_3 = { - "modeSpecificInfo", - "modeSpecificInfo", - CHOICE_free, - CHOICE_print, - CHOICE_constraint, - CHOICE_decode_ber, - CHOICE_encode_der, - CHOICE_decode_xer, - CHOICE_encode_xer, - CHOICE_decode_uper, - CHOICE_encode_uper, - CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ - &ASN_PER_TYPE_MODE_SPECIFIC_INFO_CONSTR_3, - asn_MBR_modeSpecificInfo_3, - 2, /* Elements count */ - &asn_SPC_modeSpecificInfo_specs_3 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_modeSpecificInfo_3 = { + "modeSpecificInfo", + "modeSpecificInfo", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &ASN_PER_TYPE_MODE_SPECIFIC_INFO_CONSTR_3, + asn_MBR_modeSpecificInfo_3, + 2, /* Elements count */ + &asn_SPC_modeSpecificInfo_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_CellMeasuredResults_1[] = { - { ATF_POINTER, 1, offsetof(struct CellMeasuredResults, cellIdentity), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_cellIdentity_constraint_1, - &ASN_PER_MEMB_CELL_IDENTITY_CONSTR_2, - 0, - "cellIdentity" - }, - { ATF_NOFLAGS, 0, offsetof(struct CellMeasuredResults, modeSpecificInfo), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_modeSpecificInfo_3, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "modeSpecificInfo" - }, + {ATF_POINTER, 1, offsetof(struct CellMeasuredResults, cellIdentity), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_cellIdentity_constraint_1, + &ASN_PER_MEMB_CELL_IDENTITY_CONSTR_2, 0, "cellIdentity"}, + {ATF_NOFLAGS, 0, offsetof(struct CellMeasuredResults, modeSpecificInfo), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_modeSpecificInfo_3, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "modeSpecificInfo"}, }; -static int asn_MAP_CellMeasuredResults_oms_1[] = { 0 }; +static int asn_MAP_CellMeasuredResults_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_CellMeasuredResults_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_CellMeasuredResults_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellIdentity at 160 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* modeSpecificInfo at 166 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* cellIdentity at 160 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* modeSpecificInfo at 166 */ }; static asn_SEQUENCE_specifics_t asn_SPC_CellMeasuredResults_specs_1 = { sizeof(struct CellMeasuredResults), offsetof(struct CellMeasuredResults, _asn_ctx), asn_MAP_CellMeasuredResults_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_CellMeasuredResults_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_CellMeasuredResults_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults = { "CellMeasuredResults", @@ -329,15 +284,15 @@ asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CellMeasuredResults_tags_1, - sizeof(asn_DEF_CellMeasuredResults_tags_1) - /sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ - asn_DEF_CellMeasuredResults_tags_1, /* Same as above */ - sizeof(asn_DEF_CellMeasuredResults_tags_1) - /sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_CellMeasuredResults_tags_1) / + sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ + asn_DEF_CellMeasuredResults_tags_1, /* Same as above */ + sizeof(asn_DEF_CellMeasuredResults_tags_1) / + sizeof(asn_DEF_CellMeasuredResults_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_CellMeasuredResults_1, - 2, /* Elements count */ - &asn_SPC_CellMeasuredResults_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_CellMeasuredResults_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResults.h b/src/core/libs/supl/asn-supl/CellMeasuredResults.h index 0d157c5e4..62c0be629 100644 --- a/src/core/libs/supl/asn-supl/CellMeasuredResults.h +++ b/src/core/libs/supl/asn-supl/CellMeasuredResults.h @@ -7,7 +7,6 @@ #ifndef _CellMeasuredResults_H_ #define _CellMeasuredResults_H_ - #include /* Including external dependencies */ @@ -27,59 +26,59 @@ extern "C" { #endif - /* Dependencies */ - typedef enum modeSpecificInfo_PR - { - modeSpecificInfo_PR_NOTHING, /* No components present */ - modeSpecificInfo_PR_fdd, - modeSpecificInfo_PR_tdd - } modeSpecificInfo_PR; + /* Dependencies */ + typedef enum modeSpecificInfo_PR + { + modeSpecificInfo_PR_NOTHING, /* No components present */ + modeSpecificInfo_PR_fdd, + modeSpecificInfo_PR_tdd + } modeSpecificInfo_PR; - /* Forward declarations */ - struct TimeslotISCP_List; + /* Forward declarations */ + struct TimeslotISCP_List; - /* CellMeasuredResults */ - typedef struct CellMeasuredResults - { - long *cellIdentity /* OPTIONAL */; - struct modeSpecificInfo - { - modeSpecificInfo_PR present; - union CellMeasuredResults__modeSpecificInfo_u + /* CellMeasuredResults */ + typedef struct CellMeasuredResults + { + long *cellIdentity /* OPTIONAL */; + struct modeSpecificInfo + { + modeSpecificInfo_PR present; + union CellMeasuredResults__modeSpecificInfo_u + { + struct fdd { - struct fdd - { - PrimaryCPICH_Info_t primaryCPICH_Info; - CPICH_Ec_N0_t *cpich_Ec_N0 /* OPTIONAL */; - CPICH_RSCP_t *cpich_RSCP /* OPTIONAL */; - Pathloss_t *pathloss /* OPTIONAL */; + PrimaryCPICH_Info_t primaryCPICH_Info; + CPICH_Ec_N0_t *cpich_Ec_N0 /* OPTIONAL */; + CPICH_RSCP_t *cpich_RSCP /* OPTIONAL */; + Pathloss_t *pathloss /* OPTIONAL */; - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } fdd; - struct tdd - { - CellParametersID_t cellParametersID; - TGSN_t *proposedTGSN /* OPTIONAL */; - PrimaryCCPCH_RSCP_t *primaryCCPCH_RSCP /* OPTIONAL */; - Pathloss_t *pathloss /* OPTIONAL */; - struct TimeslotISCP_List *timeslotISCP_List /* OPTIONAL */; + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } fdd; + struct tdd + { + CellParametersID_t cellParametersID; + TGSN_t *proposedTGSN /* OPTIONAL */; + PrimaryCCPCH_RSCP_t *primaryCCPCH_RSCP /* OPTIONAL */; + Pathloss_t *pathloss /* OPTIONAL */; + struct TimeslotISCP_List *timeslotISCP_List /* OPTIONAL */; - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } tdd; - } choice; + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } tdd; + } choice; - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } modeSpecificInfo; + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } modeSpecificInfo; - /* Context for parsing across buffer boundaries */ - asn_struct_ctx_t _asn_ctx; - } CellMeasuredResults_t; + /* Context for parsing across buffer boundaries */ + asn_struct_ctx_t _asn_ctx; + } CellMeasuredResults_t; - /* Implementation */ - extern asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults; + /* Implementation */ + extern asn_TYPE_descriptor_t asn_DEF_CellMeasuredResults; #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c index 33a6c3568..21cd4707e 100644 --- a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c +++ b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.c @@ -6,29 +6,26 @@ #include "CellMeasuredResultsList.h" -static asn_per_constraints_t ASN_PER_TYPE_CELL_MEASURED_RESULTS_LIST_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, - 0, 0 /* No PER value map */ +static asn_per_constraints_t ASN_PER_TYPE_CELL_MEASURED_RESULTS_LIST_CONSTR_1 = + { + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 32} /* (SIZE(1..32)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_CellMeasuredResultsList_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_CellMeasuredResults, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_CellMeasuredResults, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_CellMeasuredResultsList_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_CellMeasuredResultsList_specs_1 = { sizeof(struct CellMeasuredResultsList), offsetof(struct CellMeasuredResultsList, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_CellMeasuredResultsList = { "CellMeasuredResultsList", @@ -42,15 +39,15 @@ asn_TYPE_descriptor_t asn_DEF_CellMeasuredResultsList = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CellMeasuredResultsList_tags_1, - sizeof(asn_DEF_CellMeasuredResultsList_tags_1) - /sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ - asn_DEF_CellMeasuredResultsList_tags_1, /* Same as above */ - sizeof(asn_DEF_CellMeasuredResultsList_tags_1) - /sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ + sizeof(asn_DEF_CellMeasuredResultsList_tags_1) / + sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ + asn_DEF_CellMeasuredResultsList_tags_1, /* Same as above */ + sizeof(asn_DEF_CellMeasuredResultsList_tags_1) / + sizeof(asn_DEF_CellMeasuredResultsList_tags_1[0]), /* 1 */ &ASN_PER_TYPE_CELL_MEASURED_RESULTS_LIST_CONSTR_1, asn_MBR_CellMeasuredResultsList_1, - 1, /* Single element */ - &asn_SPC_CellMeasuredResultsList_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_CellMeasuredResultsList_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h index 8d40ac826..cb8354e9a 100644 --- a/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h +++ b/src/core/libs/supl/asn-supl/CellMeasuredResultsList.h @@ -7,7 +7,6 @@ #ifndef _CellMeasuredResultsList_H_ #define _CellMeasuredResultsList_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/CellParametersID.c b/src/core/libs/supl/asn-supl/CellParametersID.c index 2c26de607..b5944f61a 100644 --- a/src/core/libs/supl/asn-supl/CellParametersID.c +++ b/src/core/libs/supl/asn-supl/CellParametersID.c @@ -6,119 +6,140 @@ #include "CellParametersID.h" -int -CellParametersID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CellParametersID_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } value = *(const long *)sptr; - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -CellParametersID_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void CellParametersID_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -CellParametersID_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void CellParametersID_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ CellParametersID_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -CellParametersID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int CellParametersID_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ CellParametersID_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -CellParametersID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t CellParametersID_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ CellParametersID_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -CellParametersID_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CellParametersID_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ CellParametersID_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -CellParametersID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t CellParametersID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ CellParametersID_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -CellParametersID_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CellParametersID_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ CellParametersID_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -CellParametersID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t CellParametersID_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ CellParametersID_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -CellParametersID_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t CellParametersID_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ CellParametersID_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_CELL_PARAMETERS_ID_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_CellParametersID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_CellParametersID = { "CellParametersID", "CellParametersID", @@ -131,14 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_CellParametersID = { CellParametersID_encode_xer, CellParametersID_decode_uper, CellParametersID_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_CellParametersID_tags_1, - sizeof(asn_DEF_CellParametersID_tags_1) - /sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ - asn_DEF_CellParametersID_tags_1, /* Same as above */ - sizeof(asn_DEF_CellParametersID_tags_1) - /sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ + sizeof(asn_DEF_CellParametersID_tags_1) / + sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ + asn_DEF_CellParametersID_tags_1, /* Same as above */ + sizeof(asn_DEF_CellParametersID_tags_1) / + sizeof(asn_DEF_CellParametersID_tags_1[0]), /* 1 */ &ASN_PER_TYPE_CELL_PARAMETERS_ID_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/CellParametersID.h b/src/core/libs/supl/asn-supl/CellParametersID.h index d2b02e7df..86c429861 100644 --- a/src/core/libs/supl/asn-supl/CellParametersID.h +++ b/src/core/libs/supl/asn-supl/CellParametersID.h @@ -7,7 +7,6 @@ #ifndef _CellParametersID_H_ #define _CellParametersID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/DUMMY.c b/src/core/libs/supl/asn-supl/DUMMY.c index 65e4afaed..fcc981928 100644 --- a/src/core/libs/supl/asn-supl/DUMMY.c +++ b/src/core/libs/supl/asn-supl/DUMMY.c @@ -6,9 +6,9 @@ #include "DUMMY.h" -int -DUMMY_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int DUMMY_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,85 +18,91 @@ DUMMY_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ -static void -DUMMY_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_INTEGER.free_struct; - td->print_struct = asn_DEF_INTEGER.print_struct; - td->ber_decoder = asn_DEF_INTEGER.ber_decoder; - td->der_encoder = asn_DEF_INTEGER.der_encoder; - td->xer_decoder = asn_DEF_INTEGER.xer_decoder; - td->xer_encoder = asn_DEF_INTEGER.xer_encoder; - td->uper_decoder = asn_DEF_INTEGER.uper_decoder; - td->uper_encoder = asn_DEF_INTEGER.uper_encoder; - if(!td->per_constraints) +static void DUMMY_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_INTEGER.free_struct; + td->print_struct = asn_DEF_INTEGER.print_struct; + td->ber_decoder = asn_DEF_INTEGER.ber_decoder; + td->der_encoder = asn_DEF_INTEGER.der_encoder; + td->xer_decoder = asn_DEF_INTEGER.xer_decoder; + td->xer_encoder = asn_DEF_INTEGER.xer_encoder; + td->uper_decoder = asn_DEF_INTEGER.uper_decoder; + td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; - td->elements = asn_DEF_INTEGER.elements; + td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; - td->specifics = asn_DEF_INTEGER.specifics; + td->specifics = asn_DEF_INTEGER.specifics; } -void -DUMMY_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void DUMMY_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ DUMMY_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -DUMMY_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int DUMMY_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ DUMMY_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -DUMMY_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t DUMMY_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ DUMMY_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -DUMMY_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t DUMMY_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ DUMMY_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -DUMMY_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t DUMMY_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ DUMMY_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -DUMMY_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t DUMMY_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ DUMMY_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -DUMMY_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t DUMMY_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ DUMMY_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -DUMMY_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t DUMMY_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ DUMMY_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static ber_tlv_tag_t asn_DEF_DUMMY_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_DUMMY = { "DUMMY", "DUMMY", @@ -109,14 +115,13 @@ asn_TYPE_descriptor_t asn_DEF_DUMMY = { DUMMY_encode_xer, DUMMY_decode_uper, DUMMY_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_DUMMY_tags_1, - sizeof(asn_DEF_DUMMY_tags_1) - /sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ - asn_DEF_DUMMY_tags_1, /* Same as above */ - sizeof(asn_DEF_DUMMY_tags_1) - /sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_DUMMY_tags_1) / sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ + asn_DEF_DUMMY_tags_1, /* Same as above */ + sizeof(asn_DEF_DUMMY_tags_1) / sizeof(asn_DEF_DUMMY_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/DUMMY.h b/src/core/libs/supl/asn-supl/DUMMY.h index ef8e52cc3..5994ff1b8 100644 --- a/src/core/libs/supl/asn-supl/DUMMY.h +++ b/src/core/libs/supl/asn-supl/DUMMY.h @@ -7,7 +7,6 @@ #ifndef _DUMMY_H_ #define _DUMMY_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/ENUMERATED.c b/src/core/libs/supl/asn-supl/ENUMERATED.c index 1e5a3055f..b41f70a42 100644 --- a/src/core/libs/supl/asn-supl/ENUMERATED.c +++ b/src/core/libs/supl/asn-supl/ENUMERATED.c @@ -6,65 +6,67 @@ #include #include #include -#include /* Encoder and decoder of a primitive type */ +#include /* Encoder and decoder of a primitive type */ /* * ENUMERATED basic type description. */ static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { "ENUMERATED", "ENUMERATED", ASN__PRIMITIVE_TYPE_free, - INTEGER_print, /* Implemented in terms of INTEGER */ + INTEGER_print, /* Implemented in terms of INTEGER */ asn_generic_no_constraint, ber_decode_primitive, - INTEGER_encode_der, /* Implemented in terms of INTEGER */ - INTEGER_decode_xer, /* This is temporary! */ + INTEGER_encode_der, /* Implemented in terms of INTEGER */ + INTEGER_decode_xer, /* This is temporary! */ INTEGER_encode_xer, - ENUMERATED_decode_uper, /* Unaligned PER decoder */ - ENUMERATED_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + ENUMERATED_decode_uper, /* Unaligned PER decoder */ + ENUMERATED_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ENUMERATED_tags, sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), - asn_DEF_ENUMERATED_tags, /* Same as above */ + asn_DEF_ENUMERATED_tags, /* Same as above */ sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -asn_dec_rval_t -ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rval; ENUMERATED_t *st = (ENUMERATED_t *)*sptr; long value; void *vptr = &value; - if(!st) { - st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } - rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, - &vptr, pd); - if(rval.code == RC_OK) - if(asn_long2INTEGER(st, value)) - rval.code = RC_FAIL; + rval = + NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, &vptr, pd); + if (rval.code == RC_OK) + if (asn_long2INTEGER(st, value)) rval.code = RC_FAIL; return rval; } -asn_enc_rval_t -ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ ENUMERATED_t *st = (ENUMERATED_t *)sptr; int64_t value; - if(asn_INTEGER2long(st, &value)) - _ASN_ENCODE_FAILED; + if (asn_INTEGER2long(st, &value)) _ASN_ENCODE_FAILED; return NativeEnumerated_encode_uper(td, constraints, &value, po); } diff --git a/src/core/libs/supl/asn-supl/EncodingType.c b/src/core/libs/supl/asn-supl/EncodingType.c index 9fa97c475..a5f8e9bbd 100644 --- a/src/core/libs/supl/asn-supl/EncodingType.c +++ b/src/core/libs/supl/asn-supl/EncodingType.c @@ -6,9 +6,10 @@ #include "EncodingType.h" -int -EncodingType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int EncodingType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,111 +19,125 @@ EncodingType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -EncodingType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void EncodingType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -EncodingType_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void EncodingType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ EncodingType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -EncodingType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int EncodingType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ EncodingType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -EncodingType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t EncodingType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ EncodingType_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -EncodingType_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t EncodingType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ EncodingType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -EncodingType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t EncodingType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ EncodingType_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -EncodingType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t EncodingType_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ EncodingType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -EncodingType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t EncodingType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ EncodingType_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -EncodingType_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t EncodingType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ EncodingType_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_ENCODING_TYPE_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_EncodingType_value2enum_1[] = { - { 0, 4, "ucs2" }, - { 1, 10, "gsmDefault" }, - { 2, 4, "utf8" } + {0, 4, "ucs2"}, {1, 10, "gsmDefault"}, {2, 4, "utf8"} /* This list is extensible */ }; static unsigned int asn_MAP_EncodingType_enum2value_1[] = { - 1, /* gsmDefault(1) */ - 0, /* ucs2(0) */ - 2 /* utf8(2) */ - /* This list is extensible */ + 1, /* gsmDefault(1) */ + 0, /* ucs2(0) */ + 2 /* utf8(2) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_EncodingType_specs_1 = { - asn_MAP_EncodingType_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_EncodingType_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 4, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_EncodingType_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_EncodingType_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_EncodingType_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_EncodingType = { "EncodingType", "EncodingType", @@ -135,14 +150,15 @@ asn_TYPE_descriptor_t asn_DEF_EncodingType = { EncodingType_encode_xer, EncodingType_decode_uper, EncodingType_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_EncodingType_tags_1, - sizeof(asn_DEF_EncodingType_tags_1) - /sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ - asn_DEF_EncodingType_tags_1, /* Same as above */ - sizeof(asn_DEF_EncodingType_tags_1) - /sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ + sizeof(asn_DEF_EncodingType_tags_1) / + sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ + asn_DEF_EncodingType_tags_1, /* Same as above */ + sizeof(asn_DEF_EncodingType_tags_1) / + sizeof(asn_DEF_EncodingType_tags_1[0]), /* 1 */ &ASN_PER_TYPE_ENCODING_TYPE_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_EncodingType_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_EncodingType_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/EncodingType.h b/src/core/libs/supl/asn-supl/EncodingType.h index 07e078428..22c6a355d 100644 --- a/src/core/libs/supl/asn-supl/EncodingType.h +++ b/src/core/libs/supl/asn-supl/EncodingType.h @@ -7,7 +7,6 @@ #ifndef _EncodingType_H_ #define _EncodingType_H_ - #include /* Including external dependencies */ @@ -25,8 +24,8 @@ extern "C" EncodingType_gsmDefault = 1, EncodingType_utf8 = 2 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_EncodingType; /* EncodingType */ diff --git a/src/core/libs/supl/asn-supl/FQDN.c b/src/core/libs/supl/asn-supl/FQDN.c index 9c8be34af..9cd5ddb73 100644 --- a/src/core/libs/supl/asn-supl/FQDN.c +++ b/src/core/libs/supl/asn-supl/FQDN.c @@ -7,71 +7,86 @@ #include "FQDN.h" static int permitted_alphabet_table_1[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, /* -. */ - 3, 4, 5, 6, 7, 8, 9,10,11,12, 0, 0, 0, 0, 0, 0, /* 0123456789 */ - 0,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, /* ABCDEFGHIJKLMNO */ -28,29,30,31,32,33,34,35,36,37,38, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ - 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ -54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 0, /* -. */ + 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 0, 0, 0, 0, 0, 0, /* 0123456789 */ + 0, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, /* ABCDEFGHIJKLMNO */ + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ + 0, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, /* abcdefghijklmno */ + 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int permitted_alphabet_code2value_1[64] = { -45,46,48,49,50,51,52,53,54,55,56,57,65,66,67,68, -69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84, -85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106, -107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, + 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, }; - -static int check_permitted_alphabet_1(const void *sptr) { +static int check_permitted_alphabet_1(const void *sptr) +{ int *table = permitted_alphabet_table_1; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; - - for(; ch < end; ch++) { - uint8_t cv = *ch; - if(!table[cv]) return -1; - } + + for (; ch < end; ch++) + { + uint8_t cv = *ch; + if (!table[cv]) return -1; + } return 0; } -int -FQDN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FQDN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const VisibleString_t *st = (const VisibleString_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 255) - && !check_permitted_alphabet_1(st)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 255) && !check_permitted_alphabet_1(st)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int asn_PER_MAP_FQDN_1_v2c(unsigned int value) { - if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) +static int asn_PER_MAP_FQDN_1_v2c(unsigned int value) +{ + if (value >= sizeof(permitted_alphabet_table_1) / + sizeof(permitted_alphabet_table_1[0])) return -1; return permitted_alphabet_table_1[value] - 1; } -static int asn_PER_MAP_FQDN_1_c2v(unsigned int code) { - if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) +static int asn_PER_MAP_FQDN_1_c2v(unsigned int code) +{ + if (code >= sizeof(permitted_alphabet_code2value_1) / + sizeof(permitted_alphabet_code2value_1[0])) return -1; return permitted_alphabet_code2value_1[code]; } @@ -79,91 +94,97 @@ static int asn_PER_MAP_FQDN_1_c2v(unsigned int code) { * This type is implemented using VisibleString, * so here we adjust the DEF accordingly. */ -static void -FQDN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_VisibleString.free_struct; - td->print_struct = asn_DEF_VisibleString.print_struct; - td->ber_decoder = asn_DEF_VisibleString.ber_decoder; - td->der_encoder = asn_DEF_VisibleString.der_encoder; - td->xer_decoder = asn_DEF_VisibleString.xer_decoder; - td->xer_encoder = asn_DEF_VisibleString.xer_encoder; - td->uper_decoder = asn_DEF_VisibleString.uper_decoder; - td->uper_encoder = asn_DEF_VisibleString.uper_encoder; - if(!td->per_constraints) +static void FQDN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_VisibleString.free_struct; + td->print_struct = asn_DEF_VisibleString.print_struct; + td->ber_decoder = asn_DEF_VisibleString.ber_decoder; + td->der_encoder = asn_DEF_VisibleString.der_encoder; + td->xer_decoder = asn_DEF_VisibleString.xer_decoder; + td->xer_encoder = asn_DEF_VisibleString.xer_encoder; + td->uper_decoder = asn_DEF_VisibleString.uper_decoder; + td->uper_encoder = asn_DEF_VisibleString.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_VisibleString.per_constraints; - td->elements = asn_DEF_VisibleString.elements; + td->elements = asn_DEF_VisibleString.elements; td->elements_count = asn_DEF_VisibleString.elements_count; - td->specifics = asn_DEF_VisibleString.specifics; + td->specifics = asn_DEF_VisibleString.specifics; } -void -FQDN_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FQDN_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ FQDN_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FQDN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FQDN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ FQDN_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FQDN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FQDN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ FQDN_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FQDN_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FQDN_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ FQDN_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FQDN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FQDN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ FQDN_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FQDN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FQDN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ FQDN_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FQDN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FQDN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ FQDN_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FQDN_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FQDN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ FQDN_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FQDN_CONSTR_1 = { - { APC_CONSTRAINED, 6, 6, 45, 122 } /* (45..122) */, - { APC_CONSTRAINED, 8, 8, 1, 255 } /* (SIZE(1..255)) */, - asn_PER_MAP_FQDN_1_v2c, /* Value to PER code map */ - asn_PER_MAP_FQDN_1_c2v /* PER code to value map */ + {APC_CONSTRAINED, 6, 6, 45, 122} /* (45..122) */, + {APC_CONSTRAINED, 8, 8, 1, 255} /* (SIZE(1..255)) */, + asn_PER_MAP_FQDN_1_v2c, /* Value to PER code map */ + asn_PER_MAP_FQDN_1_c2v /* PER code to value map */ }; static ber_tlv_tag_t asn_DEF_FQDN_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2))}; asn_TYPE_descriptor_t asn_DEF_FQDN = { "FQDN", "FQDN", @@ -176,15 +197,13 @@ asn_TYPE_descriptor_t asn_DEF_FQDN = { FQDN_encode_xer, FQDN_decode_uper, FQDN_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FQDN_tags_1, - sizeof(asn_DEF_FQDN_tags_1) - /sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ - asn_DEF_FQDN_tags_1, /* Same as above */ - sizeof(asn_DEF_FQDN_tags_1) - /sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FQDN_tags_1) / sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ + asn_DEF_FQDN_tags_1, /* Same as above */ + sizeof(asn_DEF_FQDN_tags_1) / sizeof(asn_DEF_FQDN_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FQDN_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/FQDN.h b/src/core/libs/supl/asn-supl/FQDN.h index d0f65146e..48d0379bc 100644 --- a/src/core/libs/supl/asn-supl/FQDN.h +++ b/src/core/libs/supl/asn-supl/FQDN.h @@ -7,7 +7,6 @@ #ifndef _FQDN_H_ #define _FQDN_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/FormatIndicator.c b/src/core/libs/supl/asn-supl/FormatIndicator.c index 948c291ca..737637e21 100644 --- a/src/core/libs/supl/asn-supl/FormatIndicator.c +++ b/src/core/libs/supl/asn-supl/FormatIndicator.c @@ -6,9 +6,10 @@ #include "FormatIndicator.h" -int -FormatIndicator_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int FormatIndicator_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,121 +19,139 @@ FormatIndicator_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -FormatIndicator_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void FormatIndicator_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -FormatIndicator_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void FormatIndicator_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -FormatIndicator_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int FormatIndicator_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -FormatIndicator_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t FormatIndicator_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -FormatIndicator_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FormatIndicator_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -FormatIndicator_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t FormatIndicator_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -FormatIndicator_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t FormatIndicator_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -FormatIndicator_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t FormatIndicator_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -FormatIndicator_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t FormatIndicator_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ FormatIndicator_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_FORMAT_INDICATOR_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7 } /* (0..7,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7} /* (0..7,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_FormatIndicator_value2enum_1[] = { - { 0, 11, "logicalName" }, - { 1, 13, "e-mailAddress" }, - { 2, 6, "msisdn" }, - { 3, 3, "url" }, - { 4, 6, "sipUrl" }, - { 5, 3, "min" }, - { 6, 3, "mdn" }, - { 7, 17, "imsPublicIdentity" } + {0, 11, "logicalName"}, + {1, 13, "e-mailAddress"}, + {2, 6, "msisdn"}, + {3, 3, "url"}, + {4, 6, "sipUrl"}, + {5, 3, "min"}, + {6, 3, "mdn"}, + {7, 17, "imsPublicIdentity"} /* This list is extensible */ }; static unsigned int asn_MAP_FormatIndicator_enum2value_1[] = { - 1, /* e-mailAddress(1) */ - 7, /* imsPublicIdentity(7) */ - 0, /* logicalName(0) */ - 6, /* mdn(6) */ - 5, /* min(5) */ - 2, /* msisdn(2) */ - 4, /* sipUrl(4) */ - 3 /* url(3) */ - /* This list is extensible */ + 1, /* e-mailAddress(1) */ + 7, /* imsPublicIdentity(7) */ + 0, /* logicalName(0) */ + 6, /* mdn(6) */ + 5, /* min(5) */ + 2, /* msisdn(2) */ + 4, /* sipUrl(4) */ + 3 /* url(3) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_FormatIndicator_specs_1 = { - asn_MAP_FormatIndicator_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_FormatIndicator_enum2value_1, /* N => "tag"; sorted by N */ - 8, /* Number of elements in the maps */ - 9, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_FormatIndicator_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_FormatIndicator_enum2value_1, /* N => "tag"; sorted by N */ + 8, /* Number of elements in the maps */ + 9, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_FormatIndicator_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_FormatIndicator = { "FormatIndicator", "FormatIndicator", @@ -145,14 +164,15 @@ asn_TYPE_descriptor_t asn_DEF_FormatIndicator = { FormatIndicator_encode_xer, FormatIndicator_decode_uper, FormatIndicator_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FormatIndicator_tags_1, - sizeof(asn_DEF_FormatIndicator_tags_1) - /sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ - asn_DEF_FormatIndicator_tags_1, /* Same as above */ - sizeof(asn_DEF_FormatIndicator_tags_1) - /sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ + sizeof(asn_DEF_FormatIndicator_tags_1) / + sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ + asn_DEF_FormatIndicator_tags_1, /* Same as above */ + sizeof(asn_DEF_FormatIndicator_tags_1) / + sizeof(asn_DEF_FormatIndicator_tags_1[0]), /* 1 */ &ASN_PER_TYPE_FORMAT_INDICATOR_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_FormatIndicator_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_FormatIndicator_specs_1 /* Additional specs */ }; diff --git a/src/core/libs/supl/asn-supl/FormatIndicator.h b/src/core/libs/supl/asn-supl/FormatIndicator.h index 347199dd2..2f31263eb 100644 --- a/src/core/libs/supl/asn-supl/FormatIndicator.h +++ b/src/core/libs/supl/asn-supl/FormatIndicator.h @@ -7,7 +7,6 @@ #ifndef _FormatIndicator_H_ #define _FormatIndicator_H_ - #include /* Including external dependencies */ @@ -30,8 +29,8 @@ extern "C" FormatIndicator_mdn = 6, FormatIndicator_imsPublicIdentity = 7 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_FormatIndicator; /* FormatIndicator */ diff --git a/src/core/libs/supl/asn-supl/FrequencyInfo.c b/src/core/libs/supl/asn-supl/FrequencyInfo.c index 84676294a..f23e82b6c 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfo.c +++ b/src/core/libs/supl/asn-supl/FrequencyInfo.c @@ -7,33 +7,28 @@ #include "FrequencyInfo.h" static asn_per_constraints_t ASN_PER_TYPE_FMODE_SPECIFIC_INFO_CONSTR_2 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1} /* (0..1,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_fmodeSpecificInfo_2[] = { - { ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.fdd), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrequencyInfoFDD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fdd" - }, - { ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.tdd), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrequencyInfoTDD, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tdd" - }, + {ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.fdd), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoFDD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fdd"}, + {ATF_NOFLAGS, 0, offsetof(struct fmodeSpecificInfo, choice.tdd), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfoTDD, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tdd"}, }; static asn_TYPE_tag2member_t asn_MAP_fmodeSpecificInfo_tag2el_2[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fdd at 122 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* tdd at 123 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* fdd at 122 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* tdd at 123 */ }; static asn_CHOICE_specifics_t asn_SPC_fmodeSpecificInfo_specs_2 = { sizeof(struct fmodeSpecificInfo), @@ -41,59 +36,57 @@ static asn_CHOICE_specifics_t asn_SPC_fmodeSpecificInfo_specs_2 = { offsetof(struct fmodeSpecificInfo, present), sizeof(((struct fmodeSpecificInfo *)0)->present), asn_MAP_fmodeSpecificInfo_tag2el_2, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - 2 /* Extensions start */ + 2 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_fmodeSpecificInfo_2 = { - "fmodeSpecificInfo", - "fmodeSpecificInfo", - CHOICE_free, - CHOICE_print, - CHOICE_constraint, - CHOICE_decode_ber, - CHOICE_encode_der, - CHOICE_decode_xer, - CHOICE_encode_xer, - CHOICE_decode_uper, - CHOICE_encode_uper, - CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ - &ASN_PER_TYPE_FMODE_SPECIFIC_INFO_CONSTR_2, - asn_MBR_fmodeSpecificInfo_2, - 2, /* Elements count */ - &asn_SPC_fmodeSpecificInfo_specs_2 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_fmodeSpecificInfo_2 = { + "fmodeSpecificInfo", + "fmodeSpecificInfo", + CHOICE_free, + CHOICE_print, + CHOICE_constraint, + CHOICE_decode_ber, + CHOICE_encode_der, + CHOICE_decode_xer, + CHOICE_encode_xer, + CHOICE_decode_uper, + CHOICE_encode_uper, + CHOICE_outmost_tag, + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ + &ASN_PER_TYPE_FMODE_SPECIFIC_INFO_CONSTR_2, + asn_MBR_fmodeSpecificInfo_2, + 2, /* Elements count */ + &asn_SPC_fmodeSpecificInfo_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_FrequencyInfo_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfo, fmodeSpecificInfo), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_fmodeSpecificInfo_2, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fmodeSpecificInfo" - }, + {ATF_NOFLAGS, 0, offsetof(struct FrequencyInfo, fmodeSpecificInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_fmodeSpecificInfo_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fmodeSpecificInfo"}, }; static ber_tlv_tag_t asn_DEF_FrequencyInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_FrequencyInfo_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* fmodeSpecificInfo at 122 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* fmodeSpecificInfo at 122 */ }; static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfo_specs_1 = { sizeof(struct FrequencyInfo), offsetof(struct FrequencyInfo, _asn_ctx), asn_MAP_FrequencyInfo_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 0, /* Start extensions */ - 2 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_FrequencyInfo = { "FrequencyInfo", @@ -107,16 +100,15 @@ asn_TYPE_descriptor_t asn_DEF_FrequencyInfo = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FrequencyInfo_tags_1, - sizeof(asn_DEF_FrequencyInfo_tags_1) - /sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ - asn_DEF_FrequencyInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_FrequencyInfo_tags_1) - /sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_FrequencyInfo_tags_1) / + sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfo_tags_1) / + sizeof(asn_DEF_FrequencyInfo_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_FrequencyInfo_1, - 1, /* Elements count */ - &asn_SPC_FrequencyInfo_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_FrequencyInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/FrequencyInfo.h b/src/core/libs/supl/asn-supl/FrequencyInfo.h index 70d07ddb5..d10ca97b0 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfo.h +++ b/src/core/libs/supl/asn-supl/FrequencyInfo.h @@ -7,7 +7,6 @@ #ifndef _FrequencyInfo_H_ #define _FrequencyInfo_H_ - #include /* Including external dependencies */ @@ -41,18 +40,18 @@ extern "C" FrequencyInfoFDD_t fdd; FrequencyInfoTDD_t tdd; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } fmodeSpecificInfo; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c index 1bc85ce6f..c76dbcad6 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c +++ b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.c @@ -7,42 +7,34 @@ #include "FrequencyInfoFDD.h" static asn_TYPE_member_t asn_MBR_FrequencyInfoFDD_1[] = { - { ATF_POINTER, 1, offsetof(struct FrequencyInfoFDD, uarfcn_UL), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UARFCN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "uarfcn-UL" - }, - { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoFDD, uarfcn_DL), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UARFCN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "uarfcn-DL" - }, + {ATF_POINTER, 1, offsetof(struct FrequencyInfoFDD, uarfcn_UL), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "uarfcn-UL"}, + {ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoFDD, uarfcn_DL), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "uarfcn-DL"}, }; -static int asn_MAP_FrequencyInfoFDD_oms_1[] = { 0 }; +static int asn_MAP_FrequencyInfoFDD_oms_1[] = {0}; static ber_tlv_tag_t asn_DEF_FrequencyInfoFDD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_FrequencyInfoFDD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uarfcn-UL at 128 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* uarfcn-DL at 129 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* uarfcn-UL at 128 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* uarfcn-DL at 129 */ }; static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoFDD_specs_1 = { sizeof(struct FrequencyInfoFDD), offsetof(struct FrequencyInfoFDD, _asn_ctx), asn_MAP_FrequencyInfoFDD_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_FrequencyInfoFDD_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_FrequencyInfoFDD_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_FrequencyInfoFDD = { "FrequencyInfoFDD", @@ -56,16 +48,15 @@ asn_TYPE_descriptor_t asn_DEF_FrequencyInfoFDD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FrequencyInfoFDD_tags_1, - sizeof(asn_DEF_FrequencyInfoFDD_tags_1) - /sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ - asn_DEF_FrequencyInfoFDD_tags_1, /* Same as above */ - sizeof(asn_DEF_FrequencyInfoFDD_tags_1) - /sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_FrequencyInfoFDD_tags_1) / + sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoFDD_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoFDD_tags_1) / + sizeof(asn_DEF_FrequencyInfoFDD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_FrequencyInfoFDD_1, - 2, /* Elements count */ - &asn_SPC_FrequencyInfoFDD_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_FrequencyInfoFDD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h index 2682f6b88..806772737 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h +++ b/src/core/libs/supl/asn-supl/FrequencyInfoFDD.h @@ -7,7 +7,6 @@ #ifndef _FrequencyInfoFDD_H_ #define _FrequencyInfoFDD_H_ - #include /* Including external dependencies */ @@ -25,9 +24,9 @@ extern "C" UARFCN_t *uarfcn_UL /* OPTIONAL */; UARFCN_t uarfcn_DL; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c index 5411ca06f..eb5eb795f 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c +++ b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.c @@ -7,30 +7,27 @@ #include "FrequencyInfoTDD.h" static asn_TYPE_member_t asn_MBR_FrequencyInfoTDD_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoTDD, uarfcn_Nt), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UARFCN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "uarfcn-Nt" - }, + {ATF_NOFLAGS, 0, offsetof(struct FrequencyInfoTDD, uarfcn_Nt), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UARFCN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "uarfcn-Nt"}, }; static ber_tlv_tag_t asn_DEF_FrequencyInfoTDD_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_FrequencyInfoTDD_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* uarfcn-Nt at 132 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0} /* uarfcn-Nt at 132 */ }; static asn_SEQUENCE_specifics_t asn_SPC_FrequencyInfoTDD_specs_1 = { sizeof(struct FrequencyInfoTDD), offsetof(struct FrequencyInfoTDD, _asn_ctx), asn_MAP_FrequencyInfoTDD_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 0, /* Start extensions */ - 2 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 0, /* Start extensions */ + 2 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_FrequencyInfoTDD = { "FrequencyInfoTDD", @@ -44,16 +41,15 @@ asn_TYPE_descriptor_t asn_DEF_FrequencyInfoTDD = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_FrequencyInfoTDD_tags_1, - sizeof(asn_DEF_FrequencyInfoTDD_tags_1) - /sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ - asn_DEF_FrequencyInfoTDD_tags_1, /* Same as above */ - sizeof(asn_DEF_FrequencyInfoTDD_tags_1) - /sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_FrequencyInfoTDD_tags_1) / + sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ + asn_DEF_FrequencyInfoTDD_tags_1, /* Same as above */ + sizeof(asn_DEF_FrequencyInfoTDD_tags_1) / + sizeof(asn_DEF_FrequencyInfoTDD_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_FrequencyInfoTDD_1, - 1, /* Elements count */ - &asn_SPC_FrequencyInfoTDD_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_FrequencyInfoTDD_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h index 767e66ba2..6d80d9175 100644 --- a/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h +++ b/src/core/libs/supl/asn-supl/FrequencyInfoTDD.h @@ -7,7 +7,6 @@ #ifndef _FrequencyInfoTDD_H_ #define _FrequencyInfoTDD_H_ - #include /* Including external dependencies */ @@ -24,9 +23,9 @@ extern "C" { UARFCN_t uarfcn_Nt; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.c b/src/core/libs/supl/asn-supl/GeneralizedTime.c index 4d366ff7e..0d1ab922c 100644 --- a/src/core/libs/supl/asn-supl/GeneralizedTime.c +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.c @@ -2,136 +2,157 @@ * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ -#define _POSIX_PTHREAD_SEMANTICS /* for Sun */ +#define _POSIX_PTHREAD_SEMANTICS /* for Sun */ #ifndef _REENTRANT -#define _REENTRANT /* for Sun */ +#define _REENTRANT /* for Sun */ #endif #include #include #include -#ifdef __CYGWIN__ +#ifdef __CYGWIN__ #include "/usr/include/time.h" #else #include -#endif /* __CYGWIN__ */ +#endif /* __CYGWIN__ */ -#if defined(WIN32) -#pragma message( "PLEASE STOP AND READ!") -#pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.") -#pragma message( " gmtime_r is implemented via gmtime(), which may be not thread-safe.") -#pragma message( " ") -#pragma message( " You must fix the code by inserting appropriate locking") -#pragma message( " if you want to use asn_GT2time() or asn_UT2time().") -#pragma message( "PLEASE STOP AND READ!") +#if defined(WIN32) +#pragma message("PLEASE STOP AND READ!") +#pragma message( \ + " localtime_r is implemented via localtime(), which may be not thread-safe.") +#pragma message( \ + " gmtime_r is implemented via gmtime(), which may be not thread-safe.") +#pragma message(" ") +#pragma message(" You must fix the code by inserting appropriate locking") +#pragma message(" if you want to use asn_GT2time() or asn_UT2time().") +#pragma message("PLEASE STOP AND READ!") -static struct tm *localtime_r(const time_t *tloc, struct tm *result) { +static struct tm *localtime_r(const time_t *tloc, struct tm *result) +{ struct tm *tm; - if((tm = localtime(tloc))) - return memcpy(result, tm, sizeof(struct tm)); + if ((tm = localtime(tloc))) return memcpy(result, tm, sizeof(struct tm)); return 0; } -static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { +static struct tm *gmtime_r(const time_t *tloc, struct tm *result) +{ struct tm *tm; - if((tm = gmtime(tloc))) - return memcpy(result, tm, sizeof(struct tm)); + if ((tm = gmtime(tloc))) return memcpy(result, tm, sizeof(struct tm)); return 0; } -#define tzset() _tzset() -#define putenv(c) _putenv(c) -#define _EMULATE_TIMEGM +#define tzset() _tzset() +#define putenv(c) _putenv(c) +#define _EMULATE_TIMEGM -#endif /* WIN32 */ +#endif /* WIN32 */ -#if defined(sun) || defined(_sun_) || defined(__solaris__) -#define _EMULATE_TIMEGM +#if defined(sun) || defined(_sun_) || defined(__solaris__) +#define _EMULATE_TIMEGM #endif /* * Where to look for offset from GMT, Phase I. * Several platforms are known. */ -#if defined(__FreeBSD__) \ - || (defined(__GNUC__) && defined(__APPLE_CC__)) \ - || (defined __GLIBC__ && __GLIBC__ >= 2) -#undef HAVE_TM_GMTOFF -#define HAVE_TM_GMTOFF -#endif /* BSDs and newer glibc */ +#if defined(__FreeBSD__) || (defined(__GNUC__) && defined(__APPLE_CC__)) || \ + (defined __GLIBC__ && __GLIBC__ >= 2) +#undef HAVE_TM_GMTOFF +#define HAVE_TM_GMTOFF +#endif /* BSDs and newer glibc */ /* * Where to look for offset from GMT, Phase II. */ -#ifdef HAVE_TM_GMTOFF -#define GMTOFF(tm) ((tm).tm_gmtoff) -#else /* HAVE_TM_GMTOFF */ -#define GMTOFF(tm) (-timezone) -#endif /* HAVE_TM_GMTOFF */ +#ifdef HAVE_TM_GMTOFF +#define GMTOFF(tm) ((tm).tm_gmtoff) +#else /* HAVE_TM_GMTOFF */ +#define GMTOFF(tm) (-timezone) +#endif /* HAVE_TM_GMTOFF */ -#if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) +#if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) #warning "PLEASE STOP AND READ!" -#warning " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." +#warning \ + " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." #warning " " #warning " You must fix the code by inserting appropriate locking" #warning " if you want to use asn_GT2time() or asn_UT2time()." #warning "PLEASE STOP AND READ!" -#endif /* _EMULATE_TIMEGM */ +#endif /* _EMULATE_TIMEGM */ /* * Override our GMTOFF decision for other known platforms. */ #ifdef __CYGWIN__ -#undef GMTOFF -static long GMTOFF(struct tm a){ +#undef GMTOFF +static long GMTOFF(struct tm a) +{ struct tm *lt; time_t local_time, gmt_time; long zone; tzset(); - gmt_time = time (NULL); + gmt_time = time(NULL); lt = gmtime(&gmt_time); local_time = mktime(lt); return (gmt_time - local_time); } -#define _EMULATE_TIMEGM +#define _EMULATE_TIMEGM -#endif /* __CYGWIN__ */ +#endif /* __CYGWIN__ */ -#define ATZVARS do { \ - char tzoldbuf[64]; \ - char *tzold -#define ATZSAVETZ do { \ - tzold = getenv("TZ"); \ - if(tzold) { \ - size_t tzlen = strlen(tzold); \ - if(tzlen < sizeof(tzoldbuf)) { \ - tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ - } else { \ - char *dupptr = tzold; \ - tzold = MALLOC(tzlen + 1); \ - if(tzold) memcpy(tzold, dupptr, tzlen + 1); \ - } \ - setenv("TZ", "UTC", 1); \ - } \ - tzset(); \ -} while(0) -#define ATZOLDTZ do { \ - if (tzold) { \ - setenv("TZ", tzold, 1); \ - *tzoldbuf = 0; \ - if(tzold != tzoldbuf) \ - FREEMEM(tzold); \ - } else { \ - unsetenv("TZ"); \ - } \ - tzset(); \ -} while(0); } while(0); +#define ATZVARS \ + do \ + { \ + char tzoldbuf[64]; \ + char *tzold +#define ATZSAVETZ \ + do \ + { \ + tzold = getenv("TZ"); \ + if (tzold) \ + { \ + size_t tzlen = strlen(tzold); \ + if (tzlen < sizeof(tzoldbuf)) \ + { \ + tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ + } \ + else \ + { \ + char *dupptr = tzold; \ + tzold = MALLOC(tzlen + 1); \ + if (tzold) memcpy(tzold, dupptr, tzlen + 1); \ + } \ + setenv("TZ", "UTC", 1); \ + } \ + tzset(); \ + } \ + while (0) +#define ATZOLDTZ \ + do \ + { \ + if (tzold) \ + { \ + setenv("TZ", tzold, 1); \ + *tzoldbuf = 0; \ + if (tzold != tzoldbuf) FREEMEM(tzold); \ + } \ + else \ + { \ + unsetenv("TZ"); \ + } \ + tzset(); \ + } \ + while (0); \ + } \ + while (0) \ + ; -#ifdef _EMULATE_TIMEGM -static time_t timegm(struct tm *tm) { +#ifdef _EMULATE_TIMEGM +static time_t timegm(struct tm *tm) +{ time_t tloc; ATZVARS; ATZSAVETZ; @@ -139,24 +160,23 @@ static time_t timegm(struct tm *tm) { ATZOLDTZ; return tloc; } -#endif /* _EMULATE_TIMEGM */ +#endif /* _EMULATE_TIMEGM */ - -#ifndef __ASN_INTERNAL_TEST_MODE__ +#ifndef __ASN_INTERNAL_TEST_MODE__ /* * GeneralizedTime basic type description. */ static ber_tlv_tag_t asn_DEF_GeneralizedTime_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (24 << 2)), /* [UNIVERSAL 24] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ + (ASN_TAG_CLASS_UNIVERSAL | (24 << 2)), /* [UNIVERSAL 24] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t ASN_DEF_GENERALIZED_TIME_CONSTRAINTS = { - { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ - 0, 0 -}; + {APC_CONSTRAINED, 7, 7, 0x20, 0x7e}, /* Value */ + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, /* Size */ + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { "GeneralizedTime", "GeneralizedTime", @@ -171,47 +191,52 @@ asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GeneralizedTime_tags, - sizeof(asn_DEF_GeneralizedTime_tags) - / sizeof(asn_DEF_GeneralizedTime_tags[0]) - 2, + sizeof(asn_DEF_GeneralizedTime_tags) / + sizeof(asn_DEF_GeneralizedTime_tags[0]) - + 2, asn_DEF_GeneralizedTime_tags, - sizeof(asn_DEF_GeneralizedTime_tags) - / sizeof(asn_DEF_GeneralizedTime_tags[0]), + sizeof(asn_DEF_GeneralizedTime_tags) / + sizeof(asn_DEF_GeneralizedTime_tags[0]), &ASN_DEF_GENERALIZED_TIME_CONSTRAINTS, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -#endif /* __ASN_INTERNAL_TEST_MODE__ */ +#endif /* __ASN_INTERNAL_TEST_MODE__ */ /* * Check that the time looks like the time. */ -int -GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; time_t tloc; - errno = EPERM; /* Just an unlikely error code */ + errno = EPERM; /* Just an unlikely error code */ tloc = asn_GT2time(st, 0, 0); - if(tloc == -1 && errno != EPERM) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: Invalid time format: %s (%s:%d)", - td->name, strerror(errno), __FILE__, __LINE__); - return -1; - } + if (tloc == -1 && errno != EPERM) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: Invalid time format: %s (%s:%d)", td->name, + strerror(errno), __FILE__, __LINE__); + return -1; + } return 0; } -asn_enc_rval_t -GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ GeneralizedTime_t *st = (GeneralizedTime_t *)sptr; asn_enc_rval_t erval; int fv; - int fd; /* seconds fraction value and number of digits */ + int fd; /* seconds fraction value and number of digits */ struct tm tm; time_t tloc; @@ -219,13 +244,13 @@ GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, * Encode as a canonical DER. */ errno = EPERM; - tloc = asn_GT2time_frac(st, &fv, &fd, &tm, 1); /* Recognize time */ - if(tloc == -1 && errno != EPERM) + tloc = asn_GT2time_frac(st, &fv, &fd, &tm, 1); /* Recognize time */ + if (tloc == -1 && errno != EPERM) /* Failed to recognize time. Fail completely. */ _ASN_ENCODE_FAILED; st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */ - if(!st) _ASN_ENCODE_FAILED; /* Memory allocation failure. */ + if (!st) _ASN_ENCODE_FAILED; /* Memory allocation failure. */ erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key); @@ -235,270 +260,342 @@ GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, return erval; } -#ifndef __ASN_INTERNAL_TEST_MODE__ +#ifndef __ASN_INTERNAL_TEST_MODE__ -asn_enc_rval_t -GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + if (flags & XER_F_CANONICAL) + { + GeneralizedTime_t *gt; + asn_enc_rval_t rv; + int fv; + int fd; /* fractional parts */ + struct tm tm; - if(flags & XER_F_CANONICAL) { - GeneralizedTime_t *gt; - asn_enc_rval_t rv; - int fv; - int fd; /* fractional parts */ - struct tm tm; + errno = EPERM; + if (asn_GT2time_frac((GeneralizedTime_t *)sptr, &fv, &fd, &tm, 1) == + -1 && + errno != EPERM) + _ASN_ENCODE_FAILED; - errno = EPERM; - if(asn_GT2time_frac((GeneralizedTime_t *)sptr, - &fv, &fd, &tm, 1) == -1 - && errno != EPERM) - _ASN_ENCODE_FAILED; + gt = asn_time2GT_frac(0, &tm, fv, fd, 1); + if (!gt) _ASN_ENCODE_FAILED; - gt = asn_time2GT_frac(0, &tm, fv, fd, 1); - if(!gt) _ASN_ENCODE_FAILED; - - rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, - cb, app_key); - ASN_STRUCT_FREE(asn_DEF_GeneralizedTime, gt); - return rv; - } else { - return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, - cb, app_key); - } + rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, + app_key); + ASN_STRUCT_FREE(asn_DEF_GeneralizedTime, gt); + return rv; + } + else + { + return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, + app_key); + } } -#endif /* __ASN_INTERNAL_TEST_MODE__ */ +#endif /* __ASN_INTERNAL_TEST_MODE__ */ -int -GeneralizedTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int GeneralizedTime_print(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st && st->buf) { - char buf[32]; - struct tm tm; - int ret; + if (st && st->buf) + { + char buf[32]; + struct tm tm; + int ret; - errno = EPERM; - if(asn_GT2time(st, &tm, 1) == -1 && errno != EPERM) - return (cb("", 11, app_key) < 0) ? -1 : 0; + errno = EPERM; + if (asn_GT2time(st, &tm, 1) == -1 && errno != EPERM) + return (cb("", 11, app_key) < 0) ? -1 : 0; - ret = snprintf(buf, sizeof(buf), - "%04d-%02d-%02d %02d:%02d:%02d (GMT)", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); - assert(ret > 0 && ret < (int)sizeof(buf)); - return (cb(buf, ret, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + ret = snprintf(buf, sizeof(buf), + "%04d-%02d-%02d %02d:%02d:%02d (GMT)", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + assert(ret > 0 && ret < (int)sizeof(buf)); + return (cb(buf, ret, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -time_t -asn_GT2time(const GeneralizedTime_t *st, struct tm *ret_tm, int as_gmt) { +time_t asn_GT2time(const GeneralizedTime_t *st, struct tm *ret_tm, int as_gmt) +{ return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); } -time_t -asn_GT2time_prec(const GeneralizedTime_t *st, int *frac_value, int frac_digits, struct tm *ret_tm, int as_gmt) { +time_t asn_GT2time_prec(const GeneralizedTime_t *st, int *frac_value, + int frac_digits, struct tm *ret_tm, int as_gmt) +{ time_t tloc; int fv; int fd = 0; - if(frac_value) + if (frac_value) tloc = asn_GT2time_frac(st, &fv, &fd, ret_tm, as_gmt); else return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); - if(fd == 0 || frac_digits <= 0) { - *frac_value = 0; - } else { - while(fd > frac_digits) - fv /= 10, fd--; - while(fd < frac_digits) { - int new_fv = fv * 10; - if(new_fv / 10 != fv) { - /* Too long precision request */ - fv = 0; - break; - } - fv = new_fv, fd++; + if (fd == 0 || frac_digits <= 0) + { + *frac_value = 0; } + else + { + while (fd > frac_digits) fv /= 10, fd--; + while (fd < frac_digits) + { + int new_fv = fv * 10; + if (new_fv / 10 != fv) + { + /* Too long precision request */ + fv = 0; + break; + } + fv = new_fv, fd++; + } - *frac_value = fv; - } + *frac_value = fv; + } return tloc; } -time_t -asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, int *frac_digits, struct tm *ret_tm, int as_gmt) { +time_t asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, + int *frac_digits, struct tm *ret_tm, int as_gmt) +{ struct tm tm_s; uint8_t *buf; uint8_t *end; int gmtoff_h = 0; int gmtoff_m = 0; - int gmtoff = 0; /* h + m */ + int gmtoff = 0; /* h + m */ int offset_specified = 0; int fvalue = 0; int fdigits = 0; time_t tloc; - if(!st || !st->buf) { - errno = EINVAL; - return -1; - } else { - buf = st->buf; - end = buf + st->size; - } + if (!st || !st->buf) + { + errno = EINVAL; + return -1; + } + else + { + buf = st->buf; + end = buf + st->size; + } - if(st->size < 10) { - errno = EINVAL; - return -1; - } + if (st->size < 10) + { + errno = EINVAL; + return -1; + } /* * Decode first 10 bytes: "AAAAMMJJhh" */ memset(&tm_s, 0, sizeof(tm_s)); -#undef B2F -#undef B2T -#define B2F(var) do { \ - unsigned ch = *buf; \ - if(ch < 0x30 || ch > 0x39) { \ - errno = EINVAL; \ - return -1; \ - } else { \ - (var) = (var) * 10 + (ch - 0x30); \ - buf++; \ - } \ - } while(0) -#define B2T(var) B2F(tm_s.var) +#undef B2F +#undef B2T +#define B2F(var) \ + do \ + { \ + unsigned ch = *buf; \ + if (ch < 0x30 || ch > 0x39) \ + { \ + errno = EINVAL; \ + return -1; \ + } \ + else \ + { \ + (var) = (var)*10 + (ch - 0x30); \ + buf++; \ + } \ + } \ + while (0) +#define B2T(var) B2F(tm_s.var) - B2T(tm_year); /* 1: A */ - B2T(tm_year); /* 2: A */ - B2T(tm_year); /* 3: A */ - B2T(tm_year); /* 4: A */ - B2T(tm_mon); /* 5: M */ - B2T(tm_mon); /* 6: M */ - B2T(tm_mday); /* 7: J */ - B2T(tm_mday); /* 8: J */ - B2T(tm_hour); /* 9: h */ - B2T(tm_hour); /* 0: h */ + B2T(tm_year); /* 1: A */ + B2T(tm_year); /* 2: A */ + B2T(tm_year); /* 3: A */ + B2T(tm_year); /* 4: A */ + B2T(tm_mon); /* 5: M */ + B2T(tm_mon); /* 6: M */ + B2T(tm_mday); /* 7: J */ + B2T(tm_mday); /* 8: J */ + B2T(tm_hour); /* 9: h */ + B2T(tm_hour); /* 0: h */ - if(buf == end) goto local_finish; + if (buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^^ */ - switch(*buf) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - tm_s.tm_min = (*buf++) - 0x30; - if(buf == end) { errno = EINVAL; return -1; } - B2T(tm_min); - break; - case 0x2B: case 0x2D: /* +, - */ - goto offset; - case 0x5A: /* Z */ - goto utc_finish; - default: - errno = EINVAL; - return -1; - } + switch (*buf) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + tm_s.tm_min = (*buf++) - 0x30; + if (buf == end) + { + errno = EINVAL; + return -1; + } + B2T(tm_min); + break; + case 0x2B: + case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } - if(buf == end) goto local_finish; + if (buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^^ */ - switch(*buf) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - tm_s.tm_sec = (*buf++) - 0x30; - if(buf == end) { errno = EINVAL; return -1; } - B2T(tm_sec); - break; - case 0x2B: case 0x2D: /* +, - */ - goto offset; - case 0x5A: /* Z */ - goto utc_finish; - default: - errno = EINVAL; - return -1; - } + switch (*buf) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + tm_s.tm_sec = (*buf++) - 0x30; + if (buf == end) + { + errno = EINVAL; + return -1; + } + B2T(tm_sec); + break; + case 0x2B: + case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } - if(buf == end) goto local_finish; + if (buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^ ^ */ - switch(*buf) { - case 0x2C: case 0x2E: /* (.|,) */ - /* - * Process fractions of seconds. - */ - for(buf++; buf < end; buf++) { - int v = *buf; - int new_fvalue; - switch(v) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - new_fvalue = fvalue * 10 + (v - 0x30); - if(new_fvalue / 10 != fvalue) { - /* Not enough precision, ignore */ - } else { - fvalue = new_fvalue; - fdigits++; - } - continue; - default: - break; - } - break; + switch (*buf) + { + case 0x2C: + case 0x2E: /* (.|,) */ + /* + * Process fractions of seconds. + */ + for (buf++; buf < end; buf++) + { + int v = *buf; + int new_fvalue; + switch (v) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + new_fvalue = fvalue * 10 + (v - 0x30); + if (new_fvalue / 10 != fvalue) + { + /* Not enough precision, ignore */ + } + else + { + fvalue = new_fvalue; + fdigits++; + } + continue; + default: + break; + } + break; + } } - } - if(buf == end) goto local_finish; - - switch(*buf) { - case 0x2B: case 0x2D: /* +, - */ - goto offset; - case 0x5A: /* Z */ - goto utc_finish; - default: - errno = EINVAL; - return -1; - } + if (buf == end) goto local_finish; + switch (*buf) + { + case 0x2B: + case 0x2D: /* +, - */ + goto offset; + case 0x5A: /* Z */ + goto utc_finish; + default: + errno = EINVAL; + return -1; + } offset: - if(end - buf < 3) { - errno = EINVAL; - return -1; - } + if (end - buf < 3) + { + errno = EINVAL; + return -1; + } buf++; B2F(gmtoff_h); B2F(gmtoff_h); - if(buf[-3] == 0x2D) /* Negative */ + if (buf[-3] == 0x2D) /* Negative */ gmtoff = -1; else gmtoff = 1; - if((end - buf) == 2) { - B2F(gmtoff_m); - B2F(gmtoff_m); - } else if(end != buf) { - errno = EINVAL; - return -1; - } + if ((end - buf) == 2) + { + B2F(gmtoff_m); + B2F(gmtoff_m); + } + else if (end != buf) + { + errno = EINVAL; + return -1; + } gmtoff = gmtoff * (3600 * gmtoff_h + 60 * gmtoff_m); @@ -513,17 +610,16 @@ local_finish: /* * Validation. */ - if((tm_s.tm_mon > 12 || tm_s.tm_mon < 1) - || (tm_s.tm_mday > 31 || tm_s.tm_mday < 1) - || (tm_s.tm_hour > 23) - || (tm_s.tm_sec > 60) - ) { - errno = EINVAL; - return -1; - } + if ((tm_s.tm_mon > 12 || tm_s.tm_mon < 1) || + (tm_s.tm_mday > 31 || tm_s.tm_mday < 1) || (tm_s.tm_hour > 23) || + (tm_s.tm_sec > 60)) + { + errno = EINVAL; + return -1; + } /* Canonicalize */ - tm_s.tm_mon -= 1; /* 0 - 11 */ + tm_s.tm_mon -= 1; /* 0 - 11 */ tm_s.tm_year -= 1900; tm_s.tm_isdst = -1; @@ -531,167 +627,195 @@ local_finish: /*** AT THIS POINT tm_s is either GMT or local (unknown) ****/ - if(offset_specified) { - tloc = timegm(&tm_s); - } else { - /* - * Without an offset (or "Z"), - * we can only guess that it is a local zone. - * Interpret it in this fashion. - */ - tloc = mktime(&tm_s); - } - if(tloc == -1) { - errno = EINVAL; - return -1; - } - - if(ret_tm) { - if(as_gmt) { - if(offset_specified) { - *ret_tm = tm_s; - } else { - if(gmtime_r(&tloc, ret_tm) == 0) { - errno = EINVAL; - return -1; - } - } - } else { - if(localtime_r(&tloc, ret_tm) == 0) { - errno = EINVAL; - return -1; - } + if (offset_specified) + { + tloc = timegm(&tm_s); + } + else + { + /* + * Without an offset (or "Z"), + * we can only guess that it is a local zone. + * Interpret it in this fashion. + */ + tloc = mktime(&tm_s); + } + if (tloc == -1) + { + errno = EINVAL; + return -1; + } + + if (ret_tm) + { + if (as_gmt) + { + if (offset_specified) + { + *ret_tm = tm_s; + } + else + { + if (gmtime_r(&tloc, ret_tm) == 0) + { + errno = EINVAL; + return -1; + } + } + } + else + { + if (localtime_r(&tloc, ret_tm) == 0) + { + errno = EINVAL; + return -1; + } + } } - } /* Fractions of seconds */ - if(frac_value) *frac_value = fvalue; - if(frac_digits) *frac_digits = fdigits; + if (frac_value) *frac_value = fvalue; + if (frac_digits) *frac_digits = fdigits; return tloc; } -GeneralizedTime_t * -asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) { +GeneralizedTime_t *asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, + int force_gmt) +{ return asn_time2GT_frac(opt_gt, tm, 0, 0, force_gmt); } -GeneralizedTime_t * -asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value, int frac_digits, int force_gmt) { +GeneralizedTime_t *asn_time2GT_frac(GeneralizedTime_t *opt_gt, + const struct tm *tm, int frac_value, + int frac_digits, int force_gmt) +{ struct tm tm_s; long gmtoff; - const unsigned int buf_size = - 4 + 2 + 2 /* yyyymmdd */ - + 2 + 2 + 2 /* hhmmss */ - + 1 + 6 /* .ffffff */ - + 1 + 4 /* +hhmm */ - + 1 /* '\0' */ + const unsigned int buf_size = 4 + 2 + 2 /* yyyymmdd */ + + 2 + 2 + 2 /* hhmmss */ + + 1 + 6 /* .ffffff */ + + 1 + 4 /* +hhmm */ + + 1 /* '\0' */ ; char *buf; char *p; int size; /* Check arguments */ - if(!tm) { - errno = EINVAL; - return 0; - } + if (!tm) + { + errno = EINVAL; + return 0; + } /* Pre-allocate a buffer of sufficient yet small length */ buf = (char *)MALLOC(buf_size); - if(!buf) return 0; + if (!buf) return 0; gmtoff = GMTOFF(*tm); - if(force_gmt && gmtoff) { - tm_s = *tm; - tm_s.tm_sec -= gmtoff; - timegm(&tm_s); /* Fix the time */ - tm = &tm_s; -#ifdef HAVE_TM_GMTOFF - assert(!GMTOFF(tm_s)); /* Will fix itself */ -#else /* !HAVE_TM_GMTOFF */ - gmtoff = 0; + if (force_gmt && gmtoff) + { + tm_s = *tm; + tm_s.tm_sec -= gmtoff; + timegm(&tm_s); /* Fix the time */ + tm = &tm_s; +#ifdef HAVE_TM_GMTOFF + assert(!GMTOFF(tm_s)); /* Will fix itself */ +#else /* !HAVE_TM_GMTOFF */ + gmtoff = 0; #endif - } + } size = snprintf(buf, buf_size, "%04d%02d%02d%02d%02d%02d", - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday, - tm->tm_hour, - tm->tm_min, - tm->tm_sec - ); - if(size != 14) { - /* Could be assert(size == 14); */ - FREEMEM(buf); - errno = EINVAL; - return 0; - } + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + if (size != 14) + { + /* Could be assert(size == 14); */ + FREEMEM(buf); + errno = EINVAL; + return 0; + } p = buf + size; /* * Deal with fractions. */ - if(frac_value > 0 && frac_digits > 0) { - char *end = p + 1 + 6; /* '.' + maximum 6 digits */ - char *z = p; - long fbase; - *z++ = '.'; + if (frac_value > 0 && frac_digits > 0) + { + char *end = p + 1 + 6; /* '.' + maximum 6 digits */ + char *z = p; + long fbase; + *z++ = '.'; - /* Place bounds on precision */ - while(frac_digits-- > 6) - frac_value /= 10; + /* Place bounds on precision */ + while (frac_digits-- > 6) frac_value /= 10; - /* emulate fbase = pow(10, frac_digits) */ - for(fbase = 1; frac_digits--;) - fbase *= 10; + /* emulate fbase = pow(10, frac_digits) */ + for (fbase = 1; frac_digits--;) fbase *= 10; - do { - int digit = frac_value / fbase; - if(digit > 9) { z = 0; break; } - *z++ = digit + 0x30; - frac_value %= fbase; - fbase /= 10; - } while(fbase > 0 && frac_value > 0 && z < end); - if(z) { - for(--z; *z == 0x30; --z); /* Strip zeroes */ - p = z + (*z != '.'); - size = p - buf; + do + { + int digit = frac_value / fbase; + if (digit > 9) + { + z = 0; + break; + } + *z++ = digit + 0x30; + frac_value %= fbase; + fbase /= 10; + } + while (fbase > 0 && frac_value > 0 && z < end); + if (z) + { + for (--z; *z == 0x30; --z) + ; /* Strip zeroes */ + p = z + (*z != '.'); + size = p - buf; + } } - } - if(force_gmt) { - *p++ = 0x5a; /* "Z" */ - *p++ = 0; - size++; - } else { - int ret; - gmtoff %= 86400; - ret = snprintf(p, buf_size - size, "%+03ld%02ld", - gmtoff / 3600, labs(gmtoff % 3600) / 60); - if(ret != 5) { - FREEMEM(buf); - errno = EINVAL; - return 0; + if (force_gmt) + { + *p++ = 0x5a; /* "Z" */ + *p++ = 0; + size++; + } + else + { + int ret; + gmtoff %= 86400; + ret = snprintf(p, buf_size - size, "%+03ld%02ld", gmtoff / 3600, + labs(gmtoff % 3600) / 60); + if (ret != 5) + { + FREEMEM(buf); + errno = EINVAL; + return 0; + } + size += ret; } - size += ret; - } - if(opt_gt) { - if(opt_gt->buf) - FREEMEM(opt_gt->buf); - } else { - opt_gt = (GeneralizedTime_t *)CALLOC(1, sizeof *opt_gt); - if(!opt_gt) { FREEMEM(buf); return 0; } - } + if (opt_gt) + { + if (opt_gt->buf) FREEMEM(opt_gt->buf); + } + else + { + opt_gt = (GeneralizedTime_t *)CALLOC(1, sizeof *opt_gt); + if (!opt_gt) + { + FREEMEM(buf); + return 0; + } + } opt_gt->buf = (unsigned char *)buf; opt_gt->size = size; return opt_gt; } - - diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.h b/src/core/libs/supl/asn-supl/GeneralizedTime.h index 3867820e3..2d73d7852 100644 --- a/src/core/libs/supl/asn-supl/GeneralizedTime.h +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.h @@ -22,46 +22,48 @@ extern "C" xer_type_encoder_f GeneralizedTime_encode_xer; /*********************** - * Some handy helpers. * - ***********************/ + * Some handy helpers. * + ***********************/ struct tm; /* */ /* - * Convert a GeneralizedTime structure into time_t - * and optionally into struct tm. - * If as_gmt is given, the resulting _optional_tm4fill will have a GMT zone, - * instead of default local one. - * On error returns -1 and errno set to EINVAL - */ + * Convert a GeneralizedTime structure into time_t + * and optionally into struct tm. + * If as_gmt is given, the resulting _optional_tm4fill will have a GMT zone, + * instead of default local one. + * On error returns -1 and errno set to EINVAL + */ time_t asn_GT2time(const GeneralizedTime_t * /*st*/, struct tm *ret_tm, - int as_gmt); + int as_gmt); - /* A version of the above function also returning the fractions of seconds */ - time_t asn_GT2time_frac(const GeneralizedTime_t * /*st*/, - int *frac_value, int *frac_digits, /* (value / (10 ^ digits)) */ - struct tm *ret_tm, int as_gmt); + /* A version of the above function also returning the fractions of seconds + */ + time_t asn_GT2time_frac(const GeneralizedTime_t * /*st*/, int *frac_value, + int *frac_digits, /* (value / (10 ^ digits)) */ + struct tm *ret_tm, int as_gmt); /* - * Another version returning fractions with defined precision - * For example, parsing of the time ending with ".1" seconds - * with frac_digits=3 (msec) would yield frac_value = 100. - */ - time_t asn_GT2time_prec(const GeneralizedTime_t * /*st*/, - int *frac_value, int frac_digits, - struct tm *ret_tm, int as_gmt); + * Another version returning fractions with defined precision + * For example, parsing of the time ending with ".1" seconds + * with frac_digits=3 (msec) would yield frac_value = 100. + */ + time_t asn_GT2time_prec(const GeneralizedTime_t * /*st*/, int *frac_value, + int frac_digits, struct tm *ret_tm, int as_gmt); /* - * Convert a struct tm into GeneralizedTime. - * If _optional_gt is not given, this function will try to allocate one. - * If force_gmt is given, the resulting GeneralizedTime will be forced - * into a GMT time zone (encoding ends with a "Z"). - * On error, this function returns 0 and sets errno. - */ + * Convert a struct tm into GeneralizedTime. + * If _optional_gt is not given, this function will try to allocate one. + * If force_gmt is given, the resulting GeneralizedTime will be forced + * into a GMT time zone (encoding ends with a "Z"). + * On error, this function returns 0 and sets errno. + */ GeneralizedTime_t *asn_time2GT(GeneralizedTime_t *opt_gt, - const struct tm * /*tm*/, int force_gmt); + const struct tm * /*tm*/, int force_gmt); GeneralizedTime_t *asn_time2GT_frac(GeneralizedTime_t *opt_gt, - const struct tm * /*tm*/, int frac_value, int frac_digits, int force_gmt); + const struct tm * /*tm*/, + int frac_value, int frac_digits, + int force_gmt); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/GsmCellInformation.c b/src/core/libs/supl/asn-supl/GsmCellInformation.c index ca8985a84..c9c57cca3 100644 --- a/src/core/libs/supl/asn-supl/GsmCellInformation.c +++ b/src/core/libs/supl/asn-supl/GsmCellInformation.c @@ -6,233 +6,224 @@ #include "GsmCellInformation.h" -static int -memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refLAC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refLAC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refCI_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refCI_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_tA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_tA_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_MCC_CONSTR_2 = { - { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 999} /* (0..999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_MNC_CONSTR_3 = { - { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 999} /* (0..999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_LAC_CONSTR_4 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_CI_CONSTR_5 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_T_A_CONSTR_7 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_GsmCellInformation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMCC), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refMCC_constraint_1, - &ASN_PER_MEMB_REF_MCC_CONSTR_2, - 0, - "refMCC" - }, - { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMNC), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refMNC_constraint_1, - &ASN_PER_MEMB_REF_MNC_CONSTR_3, - 0, - "refMNC" - }, - { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refLAC), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refLAC_constraint_1, - &ASN_PER_MEMB_REF_LAC_CONSTR_4, - 0, - "refLAC" - }, - { ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refCI), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refCI_constraint_1, - &ASN_PER_MEMB_REF_CI_CONSTR_5, - 0, - "refCI" - }, - { ATF_POINTER, 2, offsetof(struct GsmCellInformation, nMR), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NMR, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "nMR" - }, - { ATF_POINTER, 1, offsetof(struct GsmCellInformation, tA), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_tA_constraint_1, - &ASN_PER_MEMB_T_A_CONSTR_7, - 0, - "tA" - }, + {ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMCC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refMCC_constraint_1, + &ASN_PER_MEMB_REF_MCC_CONSTR_2, 0, "refMCC"}, + {ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refMNC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refMNC_constraint_1, + &ASN_PER_MEMB_REF_MNC_CONSTR_3, 0, "refMNC"}, + {ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refLAC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refLAC_constraint_1, + &ASN_PER_MEMB_REF_LAC_CONSTR_4, 0, "refLAC"}, + {ATF_NOFLAGS, 0, offsetof(struct GsmCellInformation, refCI), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refCI_constraint_1, + &ASN_PER_MEMB_REF_CI_CONSTR_5, 0, "refCI"}, + {ATF_POINTER, 2, offsetof(struct GsmCellInformation, nMR), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NMR, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "nMR"}, + {ATF_POINTER, 1, offsetof(struct GsmCellInformation, tA), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_tA_constraint_1, &ASN_PER_MEMB_T_A_CONSTR_7, + 0, "tA"}, }; -static int asn_MAP_GsmCellInformation_oms_1[] = { 4, 5 }; +static int asn_MAP_GsmCellInformation_oms_1[] = {4, 5}; static ber_tlv_tag_t asn_DEF_GsmCellInformation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_GsmCellInformation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refMCC at 103 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refMNC at 104 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refLAC at 105 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* refCI at 106 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* nMR at 107 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* tA at 108 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refMCC at 103 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* refMNC at 104 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* refLAC at 105 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* refCI at 106 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* nMR at 107 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* tA at 108 */ }; static asn_SEQUENCE_specifics_t asn_SPC_GsmCellInformation_specs_1 = { sizeof(struct GsmCellInformation), offsetof(struct GsmCellInformation, _asn_ctx), asn_MAP_GsmCellInformation_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_GsmCellInformation_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_GsmCellInformation_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_GsmCellInformation = { "GsmCellInformation", @@ -246,16 +237,15 @@ asn_TYPE_descriptor_t asn_DEF_GsmCellInformation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_GsmCellInformation_tags_1, - sizeof(asn_DEF_GsmCellInformation_tags_1) - /sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ - asn_DEF_GsmCellInformation_tags_1, /* Same as above */ - sizeof(asn_DEF_GsmCellInformation_tags_1) - /sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_GsmCellInformation_tags_1) / + sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ + asn_DEF_GsmCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_GsmCellInformation_tags_1) / + sizeof(asn_DEF_GsmCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_GsmCellInformation_1, - 6, /* Elements count */ - &asn_SPC_GsmCellInformation_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_GsmCellInformation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/GsmCellInformation.h b/src/core/libs/supl/asn-supl/GsmCellInformation.h index 69b87d561..70e49bfe8 100644 --- a/src/core/libs/supl/asn-supl/GsmCellInformation.h +++ b/src/core/libs/supl/asn-supl/GsmCellInformation.h @@ -7,7 +7,6 @@ #ifndef _GsmCellInformation_H_ #define _GsmCellInformation_H_ - #include /* Including external dependencies */ @@ -32,9 +31,9 @@ extern "C" struct NMR *nMR /* OPTIONAL */; long *tA /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/Horandveruncert.c b/src/core/libs/supl/asn-supl/Horandveruncert.c index f79e92099..f9cc33e4a 100644 --- a/src/core/libs/supl/asn-supl/Horandveruncert.c +++ b/src/core/libs/supl/asn-supl/Horandveruncert.c @@ -6,18 +6,18 @@ #include "Horandveruncert.h" -static int -memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -38,25 +38,24 @@ memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -77,25 +76,24 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -116,25 +114,24 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -155,15 +152,14 @@ memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, +static int memb_horuncertspeed_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; @@ -171,9 +167,8 @@ memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -194,15 +189,14 @@ memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, +static int memb_veruncertspeed_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; @@ -210,9 +204,8 @@ memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -233,9 +226,8 @@ memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -243,82 +235,64 @@ memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_VERDIRECT_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 1, 1} /* (SIZE(1..1)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BEARING_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_HORSPEED_CONSTR_4 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_VERSPEED_CONSTR_5 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_HORUNCERTSPEED_CONSTR_6 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_VERUNCERTSPEED_CONSTR_7 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = { {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verdirect), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_verdirect_constraint_1, - &ASN_PER_MEMB_VERDIRECT_CONSTR_2, - 0, - "verdirect"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_verdirect_constraint_1, + &ASN_PER_MEMB_VERDIRECT_CONSTR_2, 0, "verdirect"}, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, bearing), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_bearing_constraint_1, - &ASN_PER_MEMB_BEARING_CONSTR_3, - 0, - "bearing"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_bearing_constraint_1, + &ASN_PER_MEMB_BEARING_CONSTR_3, 0, "bearing"}, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horspeed), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_horspeed_constraint_1, - &ASN_PER_MEMB_HORSPEED_CONSTR_4, - 0, - "horspeed"}, + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_horspeed_constraint_1, + &ASN_PER_MEMB_HORSPEED_CONSTR_4, 0, "horspeed"}, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_verspeed_constraint_1, - &ASN_PER_MEMB_VERSPEED_CONSTR_5, - 0, - "verspeed"}, + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_verspeed_constraint_1, + &ASN_PER_MEMB_VERSPEED_CONSTR_5, 0, "verspeed"}, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_horuncertspeed_constraint_1, - &ASN_PER_MEMB_HORUNCERTSPEED_CONSTR_6, - 0, - "horuncertspeed"}, + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_horuncertspeed_constraint_1, + &ASN_PER_MEMB_HORUNCERTSPEED_CONSTR_6, 0, "horuncertspeed"}, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_veruncertspeed_constraint_1, - &ASN_PER_MEMB_VERUNCERTSPEED_CONSTR_7, - 0, - "veruncertspeed"}, + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_veruncertspeed_constraint_1, + &ASN_PER_MEMB_VERUNCERTSPEED_CONSTR_7, 0, "veruncertspeed"}, }; static ber_tlv_tag_t asn_DEF_Horandveruncert_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; @@ -334,10 +308,12 @@ static asn_SEQUENCE_specifics_t asn_SPC_Horandveruncert_specs_1 = { sizeof(struct Horandveruncert), offsetof(struct Horandveruncert, _asn_ctx), asn_MAP_Horandveruncert_tag2el_1, - 6, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Horandveruncert = { "Horandveruncert", @@ -353,10 +329,12 @@ asn_TYPE_descriptor_t asn_DEF_Horandveruncert = { SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Horandveruncert_tags_1, - sizeof(asn_DEF_Horandveruncert_tags_1) / sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ - asn_DEF_Horandveruncert_tags_1, /* Same as above */ - sizeof(asn_DEF_Horandveruncert_tags_1) / sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Horandveruncert_tags_1) / + sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ + asn_DEF_Horandveruncert_tags_1, /* Same as above */ + sizeof(asn_DEF_Horandveruncert_tags_1) / + sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Horandveruncert_1, 6, /* Elements count */ &asn_SPC_Horandveruncert_specs_1 /* Additional specs */ diff --git a/src/core/libs/supl/asn-supl/Horandveruncert.h b/src/core/libs/supl/asn-supl/Horandveruncert.h index 4ad6954b9..8ef3e1578 100644 --- a/src/core/libs/supl/asn-supl/Horandveruncert.h +++ b/src/core/libs/supl/asn-supl/Horandveruncert.h @@ -7,7 +7,6 @@ #ifndef _Horandveruncert_H_ #define _Horandveruncert_H_ - #include /* Including external dependencies */ @@ -29,9 +28,9 @@ extern "C" BIT_STRING_t horuncertspeed; BIT_STRING_t veruncertspeed; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/Horandvervel.c b/src/core/libs/supl/asn-supl/Horandvervel.c index c498d6022..919972d8b 100644 --- a/src/core/libs/supl/asn-supl/Horandvervel.c +++ b/src/core/libs/supl/asn-supl/Horandvervel.c @@ -6,18 +6,18 @@ #include "Horandvervel.h" -static int -memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -38,25 +38,24 @@ memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -77,25 +76,24 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -116,25 +114,24 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -155,9 +152,8 @@ memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -165,56 +161,44 @@ memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_VERDIRECT_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 1, 1} /* (SIZE(1..1)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_BEARING_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_HORSPEED_CONSTR_4 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_VERSPEED_CONSTR_5 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = { {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verdirect), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_verdirect_constraint_1, - &ASN_PER_MEMB_VERDIRECT_CONSTR_2, - 0, - "verdirect"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_verdirect_constraint_1, + &ASN_PER_MEMB_VERDIRECT_CONSTR_2, 0, "verdirect"}, {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, bearing), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_bearing_constraint_1, - &ASN_PER_MEMB_BEARING_CONSTR_3, - 0, - "bearing"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_bearing_constraint_1, + &ASN_PER_MEMB_BEARING_CONSTR_3, 0, "bearing"}, {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, horspeed), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_horspeed_constraint_1, - &ASN_PER_MEMB_HORSPEED_CONSTR_4, - 0, - "horspeed"}, + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_horspeed_constraint_1, + &ASN_PER_MEMB_HORSPEED_CONSTR_4, 0, "horspeed"}, {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_verspeed_constraint_1, - &ASN_PER_MEMB_VERSPEED_CONSTR_5, - 0, - "verspeed"}, + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_verspeed_constraint_1, + &ASN_PER_MEMB_VERSPEED_CONSTR_5, 0, "verspeed"}, }; static ber_tlv_tag_t asn_DEF_Horandvervel_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; @@ -228,10 +212,12 @@ static asn_SEQUENCE_specifics_t asn_SPC_Horandvervel_specs_1 = { sizeof(struct Horandvervel), offsetof(struct Horandvervel, _asn_ctx), asn_MAP_Horandvervel_tag2el_1, - 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 3, /* Start extensions */ - 5 /* Stop extensions */ + 4, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 3, /* Start extensions */ + 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Horandvervel = { "Horandvervel", @@ -247,10 +233,12 @@ asn_TYPE_descriptor_t asn_DEF_Horandvervel = { SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Horandvervel_tags_1, - sizeof(asn_DEF_Horandvervel_tags_1) / sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ - asn_DEF_Horandvervel_tags_1, /* Same as above */ - sizeof(asn_DEF_Horandvervel_tags_1) / sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Horandvervel_tags_1) / + sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ + asn_DEF_Horandvervel_tags_1, /* Same as above */ + sizeof(asn_DEF_Horandvervel_tags_1) / + sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Horandvervel_1, 4, /* Elements count */ &asn_SPC_Horandvervel_specs_1 /* Additional specs */ diff --git a/src/core/libs/supl/asn-supl/Horandvervel.h b/src/core/libs/supl/asn-supl/Horandvervel.h index 6d98cd174..7119f3033 100644 --- a/src/core/libs/supl/asn-supl/Horandvervel.h +++ b/src/core/libs/supl/asn-supl/Horandvervel.h @@ -7,7 +7,6 @@ #ifndef _Horandvervel_H_ #define _Horandvervel_H_ - #include /* Including external dependencies */ @@ -27,9 +26,9 @@ extern "C" BIT_STRING_t horspeed; BIT_STRING_t verspeed; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/Horvel.c b/src/core/libs/supl/asn-supl/Horvel.c index 10f769b32..fbb52a8e5 100644 --- a/src/core/libs/supl/asn-supl/Horvel.c +++ b/src/core/libs/supl/asn-supl/Horvel.c @@ -6,18 +6,18 @@ #include "Horvel.h" -static int -memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -38,25 +38,24 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -77,9 +76,8 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -87,30 +85,24 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_BEARING_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_HORSPEED_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Horvel_1[] = { {ATF_NOFLAGS, 0, offsetof(struct Horvel, bearing), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_bearing_constraint_1, - &ASN_PER_MEMB_BEARING_CONSTR_2, - 0, - "bearing"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_bearing_constraint_1, + &ASN_PER_MEMB_BEARING_CONSTR_2, 0, "bearing"}, {ATF_NOFLAGS, 0, offsetof(struct Horvel, horspeed), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_horspeed_constraint_1, - &ASN_PER_MEMB_HORSPEED_CONSTR_3, - 0, - "horspeed"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_horspeed_constraint_1, + &ASN_PER_MEMB_HORSPEED_CONSTR_3, 0, "horspeed"}, }; static ber_tlv_tag_t asn_DEF_Horvel_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; @@ -122,10 +114,12 @@ static asn_SEQUENCE_specifics_t asn_SPC_Horvel_specs_1 = { sizeof(struct Horvel), offsetof(struct Horvel, _asn_ctx), asn_MAP_Horvel_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Horvel = { "Horvel", @@ -142,9 +136,9 @@ asn_TYPE_descriptor_t asn_DEF_Horvel = { 0, /* Use generic outmost tag fetcher */ asn_DEF_Horvel_tags_1, sizeof(asn_DEF_Horvel_tags_1) / sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */ - asn_DEF_Horvel_tags_1, /* Same as above */ + asn_DEF_Horvel_tags_1, /* Same as above */ sizeof(asn_DEF_Horvel_tags_1) / sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + 0, /* No PER visible constraints */ asn_MBR_Horvel_1, 2, /* Elements count */ &asn_SPC_Horvel_specs_1 /* Additional specs */ diff --git a/src/core/libs/supl/asn-supl/Horvel.h b/src/core/libs/supl/asn-supl/Horvel.h index f2d2b0ec0..0abf28311 100644 --- a/src/core/libs/supl/asn-supl/Horvel.h +++ b/src/core/libs/supl/asn-supl/Horvel.h @@ -7,7 +7,6 @@ #ifndef _Horvel_H_ #define _Horvel_H_ - #include /* Including external dependencies */ @@ -25,9 +24,9 @@ extern "C" BIT_STRING_t bearing; BIT_STRING_t horspeed; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/Horveluncert.c b/src/core/libs/supl/asn-supl/Horveluncert.c index f6f19ca0f..344465dd7 100644 --- a/src/core/libs/supl/asn-supl/Horveluncert.c +++ b/src/core/libs/supl/asn-supl/Horveluncert.c @@ -6,18 +6,18 @@ #include "Horveluncert.h" -static int -memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -38,25 +38,24 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -77,25 +76,24 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -116,9 +114,8 @@ memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -126,43 +123,34 @@ memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_BEARING_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_HORSPEED_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UNCERTSPEED_CONSTR_4 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = { {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, bearing), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_bearing_constraint_1, - &ASN_PER_MEMB_BEARING_CONSTR_2, - 0, - "bearing"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_bearing_constraint_1, + &ASN_PER_MEMB_BEARING_CONSTR_2, 0, "bearing"}, {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, horspeed), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_horspeed_constraint_1, - &ASN_PER_MEMB_HORSPEED_CONSTR_3, - 0, - "horspeed"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_horspeed_constraint_1, + &ASN_PER_MEMB_HORSPEED_CONSTR_3, 0, "horspeed"}, {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, uncertspeed), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_uncertspeed_constraint_1, - &ASN_PER_MEMB_UNCERTSPEED_CONSTR_4, - 0, - "uncertspeed"}, + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_uncertspeed_constraint_1, + &ASN_PER_MEMB_UNCERTSPEED_CONSTR_4, 0, "uncertspeed"}, }; static ber_tlv_tag_t asn_DEF_Horveluncert_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; @@ -175,10 +163,12 @@ static asn_SEQUENCE_specifics_t asn_SPC_Horveluncert_specs_1 = { sizeof(struct Horveluncert), offsetof(struct Horveluncert, _asn_ctx), asn_MAP_Horveluncert_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Horveluncert = { "Horveluncert", @@ -194,10 +184,12 @@ asn_TYPE_descriptor_t asn_DEF_Horveluncert = { SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Horveluncert_tags_1, - sizeof(asn_DEF_Horveluncert_tags_1) / sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ - asn_DEF_Horveluncert_tags_1, /* Same as above */ - sizeof(asn_DEF_Horveluncert_tags_1) / sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Horveluncert_tags_1) / + sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ + asn_DEF_Horveluncert_tags_1, /* Same as above */ + sizeof(asn_DEF_Horveluncert_tags_1) / + sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Horveluncert_1, 3, /* Elements count */ &asn_SPC_Horveluncert_specs_1 /* Additional specs */ diff --git a/src/core/libs/supl/asn-supl/Horveluncert.h b/src/core/libs/supl/asn-supl/Horveluncert.h index 4324214e1..946655283 100644 --- a/src/core/libs/supl/asn-supl/Horveluncert.h +++ b/src/core/libs/supl/asn-supl/Horveluncert.h @@ -7,7 +7,6 @@ #ifndef _Horveluncert_H_ #define _Horveluncert_H_ - #include /* Including external dependencies */ @@ -26,9 +25,9 @@ extern "C" BIT_STRING_t horspeed; BIT_STRING_t uncertspeed; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/IA5String.c b/src/core/libs/supl/asn-supl/IA5String.c index eac6bb034..187acb0b8 100644 --- a/src/core/libs/supl/asn-supl/IA5String.c +++ b/src/core/libs/supl/asn-supl/IA5String.c @@ -9,21 +9,21 @@ * IA5String basic type description. */ static ber_tlv_tag_t asn_DEF_IA5String_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), /* [UNIVERSAL 22] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ + (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), /* [UNIVERSAL 22] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t ASN_DEF_I_A5_STRING_CONSTRAINTS = { - { APC_CONSTRAINED, 7, 7, 0, 0x7f }, /* Value */ - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ - 0, 0 -}; + {APC_CONSTRAINED, 7, 7, 0, 0x7f}, /* Value */ + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, /* Size */ + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_IA5String = { "IA5String", "IA5String", OCTET_STRING_free, - OCTET_STRING_print_utf8, /* ASCII subset */ - IA5String_constraint, /* Constraint on the alphabet */ - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_print_utf8, /* ASCII subset */ + IA5String_constraint, /* Constraint on the alphabet */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, @@ -31,47 +31,47 @@ asn_TYPE_descriptor_t asn_DEF_IA5String = { OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_IA5String_tags, - sizeof(asn_DEF_IA5String_tags) - / sizeof(asn_DEF_IA5String_tags[0]) - 1, + sizeof(asn_DEF_IA5String_tags) / sizeof(asn_DEF_IA5String_tags[0]) - 1, asn_DEF_IA5String_tags, - sizeof(asn_DEF_IA5String_tags) - / sizeof(asn_DEF_IA5String_tags[0]), + sizeof(asn_DEF_IA5String_tags) / sizeof(asn_DEF_IA5String_tags[0]), &ASN_DEF_I_A5_STRING_CONSTRAINTS, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -int -IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const IA5String_t *st = (const IA5String_t *)sptr; - if(st && st->buf) { - uint8_t *buf = st->buf; - uint8_t *end = buf + st->size; - /* - * IA5String is generally equivalent to 7bit ASCII. - * ISO/ITU-T T.50, 1963. - */ - for(; buf < end; buf++) { - if(*buf > 0x7F) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value byte %ld out of range: " - "%d > 127 (%s:%d)", - td->name, - ((buf - st->buf) + 1), - *buf, - __FILE__, __LINE__); - return -1; - } + if (st && st->buf) + { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; + /* + * IA5String is generally equivalent to 7bit ASCII. + * ISO/ITU-T T.50, 1963. + */ + for (; buf < end; buf++) + { + if (*buf > 0x7F) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value byte %ld out of range: " + "%d > 127 (%s:%d)", + td->name, ((buf - st->buf) + 1), *buf, + __FILE__, __LINE__); + return -1; + } + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } return 0; } - diff --git a/src/core/libs/supl/asn-supl/IA5String.h b/src/core/libs/supl/asn-supl/IA5String.h index 74ccf6a75..a18a924cd 100644 --- a/src/core/libs/supl/asn-supl/IA5String.h +++ b/src/core/libs/supl/asn-supl/IA5String.h @@ -15,8 +15,8 @@ extern "C" typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */ /* - * IA5String ASN.1 type definition. - */ + * IA5String ASN.1 type definition. + */ extern asn_TYPE_descriptor_t asn_DEF_IA5String; asn_constr_check_f IA5String_constraint; diff --git a/src/core/libs/supl/asn-supl/INTEGER.c b/src/core/libs/supl/asn-supl/INTEGER.c index 93121347d..3a0f90a47 100644 --- a/src/core/libs/supl/asn-supl/INTEGER.c +++ b/src/core/libs/supl/asn-supl/INTEGER.c @@ -5,7 +5,7 @@ */ #include #include -#include /* Encoder and decoder of a primitive type */ +#include /* Encoder and decoder of a primitive type */ #include #include @@ -13,8 +13,7 @@ * INTEGER basic type description. */ static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_INTEGER = { "INTEGER", "INTEGER", @@ -25,86 +24,93 @@ asn_TYPE_descriptor_t asn_DEF_INTEGER = { INTEGER_encode_der, INTEGER_decode_xer, INTEGER_encode_xer, - INTEGER_decode_uper, /* Unaligned PER decoder */ - INTEGER_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + INTEGER_decode_uper, /* Unaligned PER decoder */ + INTEGER_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_INTEGER_tags, sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), - asn_DEF_INTEGER_tags, /* Same as above */ + asn_DEF_INTEGER_tags, /* Same as above */ sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Encode INTEGER type using DER. */ -asn_enc_rval_t -INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ INTEGER_t *st = (INTEGER_t *)sptr; - ASN_DEBUG("%s %s as INTEGER (tm=%d)", - cb?"Encoding":"Estimating", td->name, tag_mode); + ASN_DEBUG("%s %s as INTEGER (tm=%d)", cb ? "Encoding" : "Estimating", + td->name, tag_mode); /* * Canonicalize integer in the buffer. * (Remove too int64_t sign extension, remove some first 0x00 bytes) */ - if(st->buf) { - uint8_t *buf = st->buf; - uint8_t *end1 = buf + st->size - 1; - int shift; + if (st->buf) + { + uint8_t *buf = st->buf; + uint8_t *end1 = buf + st->size - 1; + int shift; - /* Compute the number of superfluous leading bytes */ - for(; buf < end1; buf++) { - /* - * If the contents octets of an integer value encoding - * consist of more than one octet, then the bits of the - * first octet and bit 8 of the second octet: - * a) shall not all be ones; and - * b) shall not all be zero. - */ - switch(*buf) { - case 0x00: if((buf[1] & 0x80) == 0) - continue; - break; - case 0xff: if((buf[1] & 0x80)) - continue; - break; - } - break; - } + /* Compute the number of superfluous leading bytes */ + for (; buf < end1; buf++) + { + /* + * If the contents octets of an integer value encoding + * consist of more than one octet, then the bits of the + * first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + switch (*buf) + { + case 0x00: + if ((buf[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((buf[1] & 0x80)) continue; + break; + } + break; + } - /* Remove leading superfluous bytes from the integer */ - shift = buf - st->buf; - if(shift) { - uint8_t *nb = st->buf; - uint8_t *end; + /* Remove leading superfluous bytes from the integer */ + shift = buf - st->buf; + if (shift) + { + uint8_t *nb = st->buf; + uint8_t *end; - st->size -= shift; /* New size, minus bad bytes */ - end = nb + st->size; + st->size -= shift; /* New size, minus bad bytes */ + end = nb + st->size; - for(; nb < end; nb++, buf++) - *nb = *buf; - } + for (; nb < end; nb++, buf++) *nb = *buf; + } - } /* if(1) */ + } /* if(1) */ return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); } -static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value( + asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); /* * INTEGER specific human-readable output. */ -static ssize_t -INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - char scratch[32]; /* Enough for 64-bit integer */ +static ssize_t INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, + asn_app_consume_bytes_f *cb, void *app_key, + int plainOrXER) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit integer */ uint8_t *buf = st->buf; uint8_t *buf_end = st->buf + st->size; int64_t accum; @@ -119,80 +125,99 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by * (0x0000000000abcdef would yield a fine 0x00abcdef) */ /* Skip the insignificant leading bytes */ - for(; buf < buf_end-1; buf++) { - switch(*buf) { - case 0x00: if((buf[1] & 0x80) == 0) continue; break; - case 0xff: if((buf[1] & 0x80) != 0) continue; break; + for (; buf < buf_end - 1; buf++) + { + switch (*buf) + { + case 0x00: + if ((buf[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((buf[1] & 0x80) != 0) continue; + break; + } + break; } - break; - } /* Simple case: the integer size is small */ - if((size_t)(buf_end - buf) <= sizeof(accum)) { - const asn_INTEGER_enum_map_t *el; - size_t scrsize; - char *scr; + if ((size_t)(buf_end - buf) <= sizeof(accum)) + { + const asn_INTEGER_enum_map_t *el; + size_t scrsize; + char *scr; - if(buf == buf_end) { - accum = 0LL; - } else { - accum = (*buf & 0x80) ? -1LL : 0LL; - for(; buf < buf_end; buf++) - accum = (accum * 256) | *buf; - } - - el = INTEGER_map_value2enum(specs, accum); - if(el) { - scrsize = el->enum_len + 32; - scr = (char *)alloca(scrsize); - if(plainOrXER == 0) - ret = snprintf(scr, scrsize, - "%+"PRId64"(%s)", accum, el->enum_name); + if (buf == buf_end) + { + accum = 0LL; + } else - ret = snprintf(scr, scrsize, - "<%s/>", el->enum_name); - } else if(plainOrXER && specs && specs->strict_enumeration) { - ASN_DEBUG("ASN.1 forbids dealing with " + { + accum = (*buf & 0x80) ? -1LL : 0LL; + for (; buf < buf_end; buf++) accum = (accum * 256) | *buf; + } + + el = INTEGER_map_value2enum(specs, accum); + if (el) + { + scrsize = el->enum_len + 32; + scr = (char *)alloca(scrsize); + if (plainOrXER == 0) + ret = snprintf(scr, scrsize, "%+" PRId64 "(%s)", accum, + el->enum_name); + else + ret = snprintf(scr, scrsize, "<%s/>", el->enum_name); + } + else if (plainOrXER && specs && specs->strict_enumeration) + { + ASN_DEBUG( + "ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + errno = EPERM; + return -1; + } + else + { + scrsize = sizeof(scratch); + scr = scratch; + ret = + snprintf(scr, scrsize, + (specs && specs->field_unsigned) ? "%" PRIu64 + : "%+" PRId64, + accum); + } + assert(ret > 0 && (size_t)ret < scrsize); + return (cb(scr, ret, app_key) < 0) ? -1 : ret; + } + else if (plainOrXER && specs && specs->strict_enumeration) + { + /* + * Here and earlier, we cannot encode the ENUMERATED values + * if there is no corresponding identifier. + */ + ASN_DEBUG( + "ASN.1 forbids dealing with " "unknown value of ENUMERATED type"); errno = EPERM; return -1; - } else { - scrsize = sizeof(scratch); - scr = scratch; - ret = snprintf(scr, scrsize, - (specs && specs->field_unsigned) - ?"%"PRIu64:"%+"PRId64, accum); } - assert(ret > 0 && (size_t)ret < scrsize); - return (cb(scr, ret, app_key) < 0) ? -1 : ret; - } else if(plainOrXER && specs && specs->strict_enumeration) { - /* - * Here and earlier, we cannot encode the ENUMERATED values - * if there is no corresponding identifier. - */ - ASN_DEBUG("ASN.1 forbids dealing with " - "unknown value of ENUMERATED type"); - errno = EPERM; - return -1; - } /* Output in the int64_t xx:yy:zz... format */ /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ - for(p = scratch; buf < buf_end; buf++) { - static const char *h2c = "0123456789ABCDEF"; - if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { - /* Flush buffer */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - wrote += p - scratch; - p = scratch; + for (p = scratch; buf < buf_end; buf++) + { + static const char *h2c = "0123456789ABCDEF"; + if ((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) + { + /* Flush buffer */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + wrote += p - scratch; + p = scratch; + } + *p++ = h2c[*buf >> 4]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x3a; /* ":" */ } - *p++ = h2c[*buf >> 4]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x3a; /* ":" */ - } - if(p != scratch) - p--; /* Remove the last ":" */ + if (p != scratch) p--; /* Remove the last ":" */ wrote += p - scratch; return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; @@ -201,16 +226,16 @@ INTEGER__dump(asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_by /* * INTEGER specific human-readable output. */ -int -INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ const INTEGER_t *st = (const INTEGER_t *)sptr; ssize_t ret; (void)td; (void)ilevel; - if(!st || !st->buf) + if (!st || !st->buf) ret = cb("", 8, app_key); else ret = INTEGER__dump(td, st, cb, app_key, 0); @@ -218,14 +243,15 @@ INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, return (ret < 0) ? -1 : 0; } -struct e2v_key { +struct e2v_key +{ const char *start; const char *stop; asn_INTEGER_enum_map_t *vemap; unsigned int *evmap; }; -static int -INTEGER__compar_enum2value(const void *kp, const void *am) { +static int INTEGER__compar_enum2value(const void *kp, const void *am) +{ const struct e2v_key *key = (const struct e2v_key *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; const char *ptr; @@ -236,98 +262,120 @@ INTEGER__compar_enum2value(const void *kp, const void *am) { el = key->vemap + key->evmap[el - key->vemap]; /* Compare strings */ - for(ptr = key->start, end = key->stop, name = el->enum_name; - ptr < end; ptr++, name++) { - if(*ptr != *name) - return *(const unsigned char *)ptr - - *(const unsigned char *)name; - } + for (ptr = key->start, end = key->stop, name = el->enum_name; ptr < end; + ptr++, name++) + { + if (*ptr != *name) + return *(const unsigned char *)ptr - + *(const unsigned char *)name; + } return name[0] ? -1 : 0; } -static const asn_INTEGER_enum_map_t * -INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { +static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value( + asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) +{ asn_INTEGER_enum_map_t *el_found; int count = specs ? specs->map_count : 0; struct e2v_key key; const char *lp; - if(!count) return NULL; + if (!count) return NULL; /* Guaranteed: assert(lstart < lstop); */ /* Figure out the tag name */ - for(lstart++, lp = lstart; lp < lstop; lp++) { - switch(*lp) { - case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ - case 0x2f: /* '/' */ case 0x3e: /* '>' */ + for (lstart++, lp = lstart; lp < lstop; lp++) + { + switch (*lp) + { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: /* WSP */ + case 0x2f: /* '/' */ + case 0x3e: /* '>' */ + break; + default: + continue; + } break; - default: - continue; } - break; - } - if(lp == lstop) return NULL; /* No tag found */ + if (lp == lstop) return NULL; /* No tag found */ lstop = lp; key.start = lstart; key.stop = lstop; key.vemap = specs->value2enum; key.evmap = specs->enum2value; - el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, - specs->value2enum, count, sizeof(specs->value2enum[0]), - INTEGER__compar_enum2value); - if(el_found) { - /* Remap enum2value into value2enum */ - el_found = key.vemap + key.evmap[el_found - key.vemap]; - } + el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, specs->value2enum, count, + sizeof(specs->value2enum[0]), + INTEGER__compar_enum2value); + if (el_found) + { + /* Remap enum2value into value2enum */ + el_found = key.vemap + key.evmap[el_found - key.vemap]; + } return el_found; } -static int -INTEGER__compar_value2enum(const void *kp, const void *am) { +static int INTEGER__compar_value2enum(const void *kp, const void *am) +{ int64_t a = *(const int64_t *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; int64_t b = el->nat_value; - if(a < b) return -1; - else if(a == b) return 0; - else return 1; -} - -const asn_INTEGER_enum_map_t * -INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value) { - int count = specs ? specs->map_count : 0; - if(!count) return 0; - return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, - count, sizeof(specs->value2enum[0]), - INTEGER__compar_value2enum); -} - -static int -INTEGER_st_prealloc(INTEGER_t *st, int min_size) { - void *p = MALLOC(min_size + 1); - if(p) { - void *b = st->buf; - st->size = 0; - st->buf = p; - FREEMEM(b); - return 0; - } else { + if (a < b) return -1; - } + else if (a == b) + return 0; + else + return 1; +} + +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum( + asn_INTEGER_specifics_t *specs, int64_t value) +{ + int count = specs ? specs->map_count : 0; + if (!count) return 0; + return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, count, + sizeof(specs->value2enum[0]), + INTEGER__compar_value2enum); +} + +static int INTEGER_st_prealloc(INTEGER_t *st, int min_size) +{ + void *p = MALLOC(min_size + 1); + if (p) + { + void *b = st->buf; + st->size = 0; + st->buf = p; + FREEMEM(b); + return 0; + } + else + { + return -1; + } } /* * Decode the chunk of XML text encoding INTEGER. */ -static enum xer_pbd_rval -INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { +static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, + void *sptr, + const void *chunk_buf, + size_t chunk_size) +{ INTEGER_t *st = (INTEGER_t *)sptr; int64_t sign = 1LL; int64_t value; const char *lp; const char *lstart = (const char *)chunk_buf; const char *lstop = lstart + chunk_size; - enum { + enum + { ST_SKIPSPACE, ST_SKIPSPHEX, ST_WAITDIGITS, @@ -338,334 +386,394 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ST_EXTRASTUFF } state = ST_SKIPSPACE; - if(chunk_size) - ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", - (int64_t)chunk_size, *lstart, lstop[-1]); + if (chunk_size) + ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", (int64_t)chunk_size, *lstart, + lstop[-1]); /* * We may have received a tag here. It will be processed inline. * Use strtoul()-like code and serialize the result. */ - for(value = 0, lp = lstart; lp < lstop; lp++) { - int lv = *lp; - switch(lv) { - case 0x09: case 0x0a: case 0x0d: case 0x20: - switch(state) { - case ST_SKIPSPACE: - case ST_SKIPSPHEX: - continue; - case ST_HEXCOLON: - if(xer_is_whitespace(lp, lstop - lp)) { - lp = lstop - 1; - continue; + for (value = 0, lp = lstart; lp < lstop; lp++) + { + int lv = *lp; + switch (lv) + { + case 0x09: + case 0x0a: + case 0x0d: + case 0x20: + switch (state) + { + case ST_SKIPSPACE: + case ST_SKIPSPHEX: + continue; + case ST_HEXCOLON: + if (xer_is_whitespace(lp, lstop - lp)) + { + lp = lstop - 1; + continue; + } + break; + default: + break; + } + break; + case 0x2d: /* '-' */ + if (state == ST_SKIPSPACE) + { + sign = -1; + state = ST_WAITDIGITS; + continue; + } + break; + case 0x2b: /* '+' */ + if (state == ST_SKIPSPACE) + { + state = ST_WAITDIGITS; + continue; + } + break; + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + switch (state) + { + case ST_DIGITS: + break; + case ST_SKIPSPHEX: /* Fall through */ + case ST_HEXDIGIT1: + value = (lv - 0x30) << 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += (lv - 0x30); + state = ST_HEXCOLON; + st->buf[st->size++] = (uint8_t)value; + continue; + case ST_HEXCOLON: + return XPBD_BROKEN_ENCODING; + default: + state = ST_DIGITS; + break; + } + + { + int64_t new_value = value * 10; + + if (new_value / 10 != value) /* Overflow */ + return XPBD_DECODER_LIMIT; + + value = new_value + (lv - 0x30); + /* Check for two's complement overflow */ + if (value < 0) + { + /* Check whether it is a LONG_MIN */ + if (sign == -1 && + (uint64_t)value == ~((uint64_t)-1 >> 1)) + { + sign = 1; + } + else + { + /* Overflow */ + return XPBD_DECODER_LIMIT; + } + } + } + continue; + case 0x3c: /* '<' */ + if (state == ST_SKIPSPACE) + { + const asn_INTEGER_enum_map_t *el; + el = INTEGER_map_enum2value( + (asn_INTEGER_specifics_t *)td->specifics, + lstart, lstop); + if (el) + { + ASN_DEBUG("Found \"%s\" => %ld", + el->enum_name, el->nat_value); + state = ST_DIGITS; + value = el->nat_value; + lp = lstop - 1; + continue; + } + ASN_DEBUG("Unknown identifier for INTEGER"); + } + return XPBD_BROKEN_ENCODING; + case 0x3a: /* ':' */ + if (state == ST_HEXCOLON) + { + /* This colon is expected */ + state = ST_HEXDIGIT1; + continue; + } + else if (state == ST_DIGITS) + { + /* The colon here means that we have + * decoded the first two hexadecimal + * places as a decimal value. + * Switch decoding mode. */ + ASN_DEBUG("INTEGER re-evaluate as hex form"); + if (INTEGER_st_prealloc(st, + (chunk_size / 3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + } + else + { + ASN_DEBUG("state %d at %d", state, lp - lstart); + break; + } + /* [A-Fa-f] */ + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x45: + case 0x46: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + switch (state) + { + case ST_SKIPSPHEX: + case ST_SKIPSPACE: /* Fall through */ + case ST_HEXDIGIT1: + value = lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + value <<= 4; + state = ST_HEXDIGIT2; + continue; + case ST_HEXDIGIT2: + value += lv - ((lv < 0x61) ? 0x41 : 0x61); + value += 10; + st->buf[st->size++] = (uint8_t)value; + state = ST_HEXCOLON; + continue; + case ST_DIGITS: + ASN_DEBUG( + "INTEGER re-evaluate as hex form"); + if (INTEGER_st_prealloc( + st, (chunk_size / 3) + 1)) + return XPBD_SYSTEM_FAILURE; + state = ST_SKIPSPHEX; + lp = lstart - 1; + continue; + default: + break; + } + break; } + + /* Found extra non-numeric stuff */ + ASN_DEBUG("Found non-numeric 0x%2x at %d", lv, lp - lstart); + state = ST_EXTRASTUFF; + break; + } + + switch (state) + { + case ST_DIGITS: + /* Everything is cool */ break; - default: - break; - } - break; - case 0x2d: /* '-' */ - if(state == ST_SKIPSPACE) { - sign = -1; - state = ST_WAITDIGITS; - continue; - } - break; - case 0x2b: /* '+' */ - if(state == ST_SKIPSPACE) { - state = ST_WAITDIGITS; - continue; - } - break; - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: - switch(state) { - case ST_DIGITS: break; - case ST_SKIPSPHEX: /* Fall through */ - case ST_HEXDIGIT1: - value = (lv - 0x30) << 4; - state = ST_HEXDIGIT2; - continue; - case ST_HEXDIGIT2: - value += (lv - 0x30); - state = ST_HEXCOLON; - st->buf[st->size++] = (uint8_t)value; - continue; case ST_HEXCOLON: + st->buf[st->size] = 0; /* Just in case termination */ + return XPBD_BODY_CONSUMED; + case ST_HEXDIGIT1: + case ST_HEXDIGIT2: + case ST_SKIPSPHEX: return XPBD_BROKEN_ENCODING; default: - state = ST_DIGITS; + if (xer_is_whitespace(lp, lstop - lp)) + { + if (state != ST_EXTRASTUFF) return XPBD_NOT_BODY_IGNORE; + break; + } + else + { + ASN_DEBUG("INTEGER: No useful digits (state %d)", + state); + return XPBD_BROKEN_ENCODING; /* No digits */ + } break; - } - - { - int64_t new_value = value * 10; - - if(new_value / 10 != value) - /* Overflow */ - return XPBD_DECODER_LIMIT; - - value = new_value + (lv - 0x30); - /* Check for two's complement overflow */ - if(value < 0) { - /* Check whether it is a LONG_MIN */ - if(sign == -1 - && (uint64_t)value - == ~((uint64_t)-1 >> 1)) { - sign = 1; - } else { - /* Overflow */ - return XPBD_DECODER_LIMIT; - } - } - } - continue; - case 0x3c: /* '<' */ - if(state == ST_SKIPSPACE) { - const asn_INTEGER_enum_map_t *el; - el = INTEGER_map_enum2value( - (asn_INTEGER_specifics_t *) - td->specifics, lstart, lstop); - if(el) { - ASN_DEBUG("Found \"%s\" => %ld", - el->enum_name, el->nat_value); - state = ST_DIGITS; - value = el->nat_value; - lp = lstop - 1; - continue; - } - ASN_DEBUG("Unknown identifier for INTEGER"); - } - return XPBD_BROKEN_ENCODING; - case 0x3a: /* ':' */ - if(state == ST_HEXCOLON) { - /* This colon is expected */ - state = ST_HEXDIGIT1; - continue; - } else if(state == ST_DIGITS) { - /* The colon here means that we have - * decoded the first two hexadecimal - * places as a decimal value. - * Switch decoding mode. */ - ASN_DEBUG("INTEGER re-evaluate as hex form"); - if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) - return XPBD_SYSTEM_FAILURE; - state = ST_SKIPSPHEX; - lp = lstart - 1; - continue; - } else { - ASN_DEBUG("state %d at %d", state, lp - lstart); - break; - } - /* [A-Fa-f] */ - case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: - case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: - switch(state) { - case ST_SKIPSPHEX: - case ST_SKIPSPACE: /* Fall through */ - case ST_HEXDIGIT1: - value = lv - ((lv < 0x61) ? 0x41 : 0x61); - value += 10; - value <<= 4; - state = ST_HEXDIGIT2; - continue; - case ST_HEXDIGIT2: - value += lv - ((lv < 0x61) ? 0x41 : 0x61); - value += 10; - st->buf[st->size++] = (uint8_t)value; - state = ST_HEXCOLON; - continue; - case ST_DIGITS: - ASN_DEBUG("INTEGER re-evaluate as hex form"); - if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) - return XPBD_SYSTEM_FAILURE; - state = ST_SKIPSPHEX; - lp = lstart - 1; - continue; - default: - break; - } - break; } - /* Found extra non-numeric stuff */ - ASN_DEBUG("Found non-numeric 0x%2x at %d", - lv, lp - lstart); - state = ST_EXTRASTUFF; - break; - } + value *= sign; /* Change sign, if needed */ - switch(state) { - case ST_DIGITS: - /* Everything is cool */ - break; - case ST_HEXCOLON: - st->buf[st->size] = 0; /* Just in case termination */ - return XPBD_BODY_CONSUMED; - case ST_HEXDIGIT1: - case ST_HEXDIGIT2: - case ST_SKIPSPHEX: - return XPBD_BROKEN_ENCODING; - default: - if(xer_is_whitespace(lp, lstop - lp)) { - if(state != ST_EXTRASTUFF) - return XPBD_NOT_BODY_IGNORE; - break; - } else { - ASN_DEBUG("INTEGER: No useful digits (state %d)", - state); - return XPBD_BROKEN_ENCODING; /* No digits */ - } - break; - } - - value *= sign; /* Change sign, if needed */ - - if(asn_long2INTEGER(st, value)) - return XPBD_SYSTEM_FAILURE; + if (asn_long2INTEGER(st, value)) return XPBD_SYSTEM_FAILURE; return XPBD_BODY_CONSUMED; } -asn_dec_rval_t -INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - - return xer_decode_primitive(opt_codec_ctx, td, - sptr, sizeof(INTEGER_t), opt_mname, - buf_ptr, size, INTEGER__xer_body_decode); +asn_dec_rval_t INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ + return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(INTEGER_t), + opt_mname, buf_ptr, size, + INTEGER__xer_body_decode); } -asn_enc_rval_t -INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ const INTEGER_t *st = (const INTEGER_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; - if(!st || !st->buf) - _ASN_ENCODE_FAILED; + if (!st || !st->buf) _ASN_ENCODE_FAILED; er.encoded = INTEGER__dump(td, st, cb, app_key, 1); - if(er.encoded < 0) _ASN_ENCODE_FAILED; + if (er.encoded < 0) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } -asn_dec_rval_t -INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - asn_dec_rval_t rval = { RC_OK, 0 }; +asn_dec_rval_t INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = {RC_OK, 0}; INTEGER_t *st = (INTEGER_t *)*sptr; asn_per_constraint_t *ct; int repeat; (void)opt_codec_ctx; - if(!st) { - st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if (!st) _ASN_DECODE_FAILED; + } - if(!constraints) constraints = td->per_constraints; + if (!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) _ASN_DECODE_STARVED; - if(inext) ct = 0; - } + if (ct && ct->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) _ASN_DECODE_STARVED; + if (inext) ct = 0; + } FREEMEM(st->buf); st->buf = 0; st->size = 0; - if(ct) { - if(ct->flags & APC_SEMI_CONSTRAINED) { - st->buf = (uint8_t *)CALLOC(1, 2); - if(!st->buf) _ASN_DECODE_FAILED; - st->size = 1; - } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { - size_t size = (ct->range_bits + 7) >> 3; - st->buf = (uint8_t *)MALLOC(1 + size + 1); - if(!st->buf) _ASN_DECODE_FAILED; - st->size = size; + if (ct) + { + if (ct->flags & APC_SEMI_CONSTRAINED) + { + st->buf = (uint8_t *)CALLOC(1, 2); + if (!st->buf) _ASN_DECODE_FAILED; + st->size = 1; + } + else if (ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) + { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if (!st->buf) _ASN_DECODE_FAILED; + st->size = size; + } } - } /* X.691, #12.2.2 */ - if(ct && ct->flags != APC_UNCONSTRAINED) { - /* #10.5.6 */ - ASN_DEBUG("Integer with range %d bits", ct->range_bits); - if(ct->range_bits >= 0) { - int64_t value; - if(ct->range_bits == 32) { - int64_t lhalf; - value = per_get_few_bits(pd, 16); - if(value < 0) _ASN_DECODE_STARVED; - lhalf = per_get_few_bits(pd, 16); - if(lhalf < 0) _ASN_DECODE_STARVED; - value = (value << 16) | lhalf; - } else { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - } - ASN_DEBUG("Got value %ld + low %ld", - value, ct->lower_bound); - value += ct->lower_bound; - if((specs && specs->field_unsigned) - ? asn_ulong2INTEGER(st, value) - : asn_long2INTEGER(st, value)) - _ASN_DECODE_FAILED; - return rval; + if (ct && ct->flags != APC_UNCONSTRAINED) + { + /* #10.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if (ct->range_bits >= 0) + { + int64_t value; + if (ct->range_bits == 32) + { + int64_t lhalf; + value = per_get_few_bits(pd, 16); + if (value < 0) _ASN_DECODE_STARVED; + lhalf = per_get_few_bits(pd, 16); + if (lhalf < 0) _ASN_DECODE_STARVED; + value = (value << 16) | lhalf; + } + else + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + } + ASN_DEBUG("Got value %ld + low %ld", value, + ct->lower_bound); + value += ct->lower_bound; + if ((specs && specs->field_unsigned) + ? asn_ulong2INTEGER(st, value) + : asn_long2INTEGER(st, value)) + _ASN_DECODE_FAILED; + return rval; + } + } + else + { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); } - } else { - ASN_DEBUG("Decoding unconstrained integer %s", td->name); - } /* X.691, #12.2.3, #12.2.4 */ - do { - ssize_t len; - void *p; - int ret; + do + { + ssize_t len; + void *p; + int ret; - /* Get the PER length */ - len = uper_get_length(pd, -1, &repeat); - if(len < 0) _ASN_DECODE_STARVED; + /* Get the PER length */ + len = uper_get_length(pd, -1, &repeat); + if (len < 0) _ASN_DECODE_STARVED; - p = REALLOC(st->buf, st->size + len + 1); - if(!p) _ASN_DECODE_FAILED; - st->buf = (uint8_t *)p; + p = REALLOC(st->buf, st->size + len + 1); + if (!p) _ASN_DECODE_FAILED; + st->buf = (uint8_t *)p; - ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); - if(ret < 0) _ASN_DECODE_STARVED; - st->size += len; - } while(repeat); - st->buf[st->size] = 0; /* JIC */ + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if (ret < 0) _ASN_DECODE_STARVED; + st->size += len; + } + while (repeat); + st->buf[st->size] = 0; /* JIC */ /* #12.2.3 */ - if(ct && ct->lower_bound) { - /* - * TODO: replace by in-place arithmetics. - */ - int64_t value; - if(asn_INTEGER2long(st, &value)) - _ASN_DECODE_FAILED; - if(asn_long2INTEGER(st, value + ct->lower_bound)) - _ASN_DECODE_FAILED; - } + if (ct && ct->lower_bound) + { + /* + * TODO: replace by in-place arithmetics. + */ + int64_t value; + if (asn_INTEGER2long(st, &value)) _ASN_DECODE_FAILED; + if (asn_long2INTEGER(st, value + ct->lower_bound)) + _ASN_DECODE_FAILED; + } return rval; } -asn_enc_rval_t -INTEGER_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_enc_rval_t INTEGER_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; INTEGER_t *st = (INTEGER_t *)sptr; const uint8_t *buf; @@ -673,243 +781,268 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraint_t *ct; int64_t value = 0; - if(!st || st->size == 0) _ASN_ENCODE_FAILED; + if (!st || st->size == 0) _ASN_ENCODE_FAILED; - if(!constraints) constraints = td->per_constraints; + if (!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; er.encoded = 0; - if(ct) { - int inext = 0; - if(specs && specs->field_unsigned) { - uint64_t uval; - if(asn_INTEGER2ulong(st, &uval)) - _ASN_ENCODE_FAILED; - /* Check proper range */ - if(ct->flags & APC_SEMI_CONSTRAINED) { - if(uval < (uint64_t)ct->lower_bound) - inext = 1; - } else if(ct->range_bits >= 0) { - if(uval < (uint64_t)ct->lower_bound - || uval > (uint64_t)ct->upper_bound) - inext = 1; - } - ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", - uval, st->buf[0], st->size, - ct->lower_bound, ct->upper_bound, - inext ? "ext" : "fix"); - value = uval; - } else { - if(asn_INTEGER2long(st, &value)) - _ASN_ENCODE_FAILED; - /* Check proper range */ - if(ct->flags & APC_SEMI_CONSTRAINED) { - if(value < ct->lower_bound) - inext = 1; - } else if(ct->range_bits >= 0) { - if(value < ct->lower_bound - || value > ct->upper_bound) - inext = 1; - } - ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", - value, st->buf[0], st->size, - ct->lower_bound, ct->upper_bound, - inext ? "ext" : "fix"); + if (ct) + { + int inext = 0; + if (specs && specs->field_unsigned) + { + uint64_t uval; + if (asn_INTEGER2ulong(st, &uval)) _ASN_ENCODE_FAILED; + /* Check proper range */ + if (ct->flags & APC_SEMI_CONSTRAINED) + { + if (uval < (uint64_t)ct->lower_bound) inext = 1; + } + else if (ct->range_bits >= 0) + { + if (uval < (uint64_t)ct->lower_bound || + uval > (uint64_t)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", uval, + st->buf[0], st->size, ct->lower_bound, + ct->upper_bound, inext ? "ext" : "fix"); + value = uval; + } + else + { + if (asn_INTEGER2long(st, &value)) _ASN_ENCODE_FAILED; + /* Check proper range */ + if (ct->flags & APC_SEMI_CONSTRAINED) + { + if (value < ct->lower_bound) inext = 1; + } + else if (ct->range_bits >= 0) + { + if (value < ct->lower_bound || + value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", value, + st->buf[0], st->size, ct->lower_bound, + ct->upper_bound, inext ? "ext" : "fix"); + } + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + if (inext) ct = 0; + } + else if (inext) + { + _ASN_ENCODE_FAILED; + } } - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, inext, 1)) - _ASN_ENCODE_FAILED; - if(inext) ct = 0; - } else if(inext) { - _ASN_ENCODE_FAILED; - } - } - /* X.691, #12.2.2 */ - if(ct && ct->range_bits >= 0) { - /* #10.5.6 */ - ASN_DEBUG("Encoding integer with range %d bits", - ct->range_bits); - if(ct->range_bits == 32) { - /* TODO: extend to >32 bits */ - int64_t v = value - ct->lower_bound; - if(per_put_few_bits(po, v >> 1, 31) - || per_put_few_bits(po, v, 1)) - _ASN_ENCODE_FAILED; - } else { - if(per_put_few_bits(po, value - ct->lower_bound, - ct->range_bits)) - _ASN_ENCODE_FAILED; + if (ct && ct->range_bits >= 0) + { + /* #10.5.6 */ + ASN_DEBUG("Encoding integer with range %d bits", ct->range_bits); + if (ct->range_bits == 32) + { + /* TODO: extend to >32 bits */ + int64_t v = value - ct->lower_bound; + if (per_put_few_bits(po, v >> 1, 31) || + per_put_few_bits(po, v, 1)) + _ASN_ENCODE_FAILED; + } + else + { + if (per_put_few_bits(po, value - ct->lower_bound, + ct->range_bits)) + _ASN_ENCODE_FAILED; + } + _ASN_ENCODED_OK(er); } - _ASN_ENCODED_OK(er); - } - if(ct && ct->lower_bound) { - ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); - /* TODO: adjust lower bound */ - _ASN_ENCODE_FAILED; - } + if (ct && ct->lower_bound) + { + ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + /* TODO: adjust lower bound */ + _ASN_ENCODE_FAILED; + } - for(buf = st->buf, end = st->buf + st->size; buf < end;) { - ssize_t mayEncode = uper_put_length(po, end - buf); - if(mayEncode < 0) - _ASN_ENCODE_FAILED; - if(per_put_many_bits(po, buf, 8 * mayEncode)) - _ASN_ENCODE_FAILED; - buf += mayEncode; - } + for (buf = st->buf, end = st->buf + st->size; buf < end;) + { + ssize_t mayEncode = uper_put_length(po, end - buf); + if (mayEncode < 0) _ASN_ENCODE_FAILED; + if (per_put_many_bits(po, buf, 8 * mayEncode)) _ASN_ENCODE_FAILED; + buf += mayEncode; + } _ASN_ENCODED_OK(er); } -int -asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) { +int asn_INTEGER2long(const INTEGER_t *iptr, int64_t *lptr) +{ uint8_t *b; uint8_t *end; size_t size; int64_t l; /* Sanity checking */ - if(!iptr || !iptr->buf || !lptr) { - errno = EINVAL; - return -1; - } - - /* Cache the begin/end of the buffer */ - b = iptr->buf; /* Start of the INTEGER buffer */ - size = iptr->size; - end = b + size; /* Where to stop */ - - if(size > sizeof(int64_t)) { - uint8_t *end1 = end - 1; - /* - * Slightly more advanced processing, - * able to >sizeof(int64_t) bytes, - * when the actual value is small - * (0x0000000000abcdef would yield a fine 0x00abcdef) - */ - /* Skip out the insignificant leading bytes */ - for(; b < end1; b++) { - switch(*b) { - case 0x00: if((b[1] & 0x80) == 0) continue; break; - case 0xff: if((b[1] & 0x80) != 0) continue; break; - } - break; - } - - size = end - b; - if(size > sizeof(int64_t)) { - /* Still cannot fit the int64_t */ - errno = ERANGE; + if (!iptr || !iptr->buf || !lptr) + { + errno = EINVAL; return -1; } - } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if (size > sizeof(int64_t)) + { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(int64_t) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for (; b < end1; b++) + { + switch (*b) + { + case 0x00: + if ((b[1] & 0x80) == 0) continue; + break; + case 0xff: + if ((b[1] & 0x80) != 0) continue; + break; + } + break; + } + + size = end - b; + if (size > sizeof(int64_t)) + { + /* Still cannot fit the int64_t */ + errno = ERANGE; + return -1; + } + } /* Shortcut processing of a corner case */ - if(end == b) { - *lptr = 0; - return 0; - } + if (end == b) + { + *lptr = 0; + return 0; + } /* Perform the sign initialization */ /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ - if((*b >> 7)) l = -1; else l = 0; + if ((*b >> 7)) + l = -1; + else + l = 0; /* Conversion engine */ - for(; b < end; b++) - l = (l * 256) | *b; + for (; b < end; b++) l = (l * 256) | *b; *lptr = l; return 0; } -int -asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) { +int asn_INTEGER2ulong(const INTEGER_t *iptr, uint64_t *lptr) +{ uint8_t *b; uint8_t *end; uint64_t l; size_t size; - if(!iptr || !iptr->buf || !lptr) { - errno = EINVAL; - return -1; - } + if (!iptr || !iptr->buf || !lptr) + { + errno = EINVAL; + return -1; + } b = iptr->buf; size = iptr->size; end = b + size; /* If all extra leading bytes are zeroes, ignore them */ - for(; size > sizeof(uint64_t); b++, size--) { - if(*b) { - /* Value won't fit uint64_t */ - errno = ERANGE; - return -1; + for (; size > sizeof(uint64_t); b++, size--) + { + if (*b) + { + /* Value won't fit uint64_t */ + errno = ERANGE; + return -1; + } } - } /* Conversion engine */ - for(l = 0; b < end; b++) - l = (l << 8) | *b; + for (l = 0; b < end; b++) l = (l << 8) | *b; *lptr = l; return 0; } -int -asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) { +int asn_ulong2INTEGER(INTEGER_t *st, uint64_t value) +{ uint8_t *buf; uint8_t *end; uint8_t *b; int shr; - if(value <= LONG_MAX) - return asn_long2INTEGER(st, value); + if (value <= LONG_MAX) return asn_long2INTEGER(st, value); buf = (uint8_t *)MALLOC(1 + sizeof(value)); - if(!buf) return -1; + if (!buf) return -1; end = buf + (sizeof(value) + 1); buf[0] = 0; - for(b = buf + 1, shr = (sizeof(int64_t)-1)*8; b < end; shr -= 8, b++) + for (b = buf + 1, shr = (sizeof(int64_t) - 1) * 8; b < end; shr -= 8, b++) *b = (uint8_t)(value >> shr); - if(st->buf) FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); st->buf = buf; st->size = 1 + sizeof(value); return 0; } -int -asn_long2INTEGER(INTEGER_t *st, int64_t value) { +int asn_long2INTEGER(INTEGER_t *st, int64_t value) +{ uint8_t *buf; uint8_t *bp; uint8_t *p; uint8_t *pstart; uint8_t *pend1; - int littleEndian = 1; /* Run-time detection */ + int littleEndian = 1; /* Run-time detection */ int add; - if(!st) { - errno = EINVAL; - return -1; - } + if (!st) + { + errno = EINVAL; + return -1; + } buf = (uint8_t *)MALLOC(8); - if(!buf) return -1; + if (!buf) return -1; - if(*(char *)&littleEndian) { - pstart = (uint8_t *)&value + sizeof(value) - 1; - pend1 = (uint8_t *)&value; - add = -1; - } else { - pstart = (uint8_t *)&value; - pend1 = pstart + sizeof(value) - 1; - add = 1; - } + if (*(char *)&littleEndian) + { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } + else + { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } /* * If the contents octet consists of more than one octet, @@ -917,22 +1050,23 @@ asn_long2INTEGER(INTEGER_t *st, int64_t value) { * a) shall not all be ones; and * b) shall not all be zero. */ - for(p = pstart; p != pend1; p += add) { - switch(*p) { - case 0x00: if((*(p+add) & 0x80) == 0) - continue; - break; - case 0xff: if((*(p+add) & 0x80)) - continue; + for (p = pstart; p != pend1; p += add) + { + switch (*p) + { + case 0x00: + if ((*(p + add) & 0x80) == 0) continue; + break; + case 0xff: + if ((*(p + add) & 0x80)) continue; + break; + } break; } - break; - } /* Copy the integer body */ - for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) - *bp++ = *p; + for (pstart = p, bp = buf, pend1 += add; p != pend1; p += add) *bp++ = *p; - if(st->buf) FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); st->buf = buf; st->size = bp - buf; diff --git a/src/core/libs/supl/asn-supl/INTEGER.h b/src/core/libs/supl/asn-supl/INTEGER.h index c23b59210..c2cfbcbd2 100644 --- a/src/core/libs/supl/asn-supl/INTEGER.h +++ b/src/core/libs/supl/asn-supl/INTEGER.h @@ -20,7 +20,7 @@ extern "C" /* Map with to integer value association */ typedef struct asn_INTEGER_enum_map_s { - int64_t nat_value; /* associated native integer value */ + int64_t nat_value; /* associated native integer value */ size_t enum_len; /* strlen("tag") */ const char *enum_name; /* "tag" */ } asn_INTEGER_enum_map_t; @@ -46,24 +46,25 @@ extern "C" per_type_encoder_f INTEGER_encode_uper; /*********************************** - * Some handy conversion routines. * - ***********************************/ + * Some handy conversion routines. * + ***********************************/ /* - * Returns 0 if it was possible to convert, -1 otherwise. - * -1/EINVAL: Mandatory argument missing - * -1/ERANGE: Value encoded is out of range for long representation - * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). - */ + * Returns 0 if it was possible to convert, -1 otherwise. + * -1/EINVAL: Mandatory argument missing + * -1/ERANGE: Value encoded is out of range for long representation + * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). + */ int asn_INTEGER2long(const INTEGER_t *i, int64_t *l); int asn_INTEGER2ulong(const INTEGER_t *i, uint64_t *l); int asn_long2INTEGER(INTEGER_t *st, int64_t value); int asn_ulong2INTEGER(INTEGER_t *st, uint64_t value); /* - * Convert the integer value into the corresponding enumeration map entry. - */ - const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, int64_t value); + * Convert the integer value into the corresponding enumeration map entry. + */ + const asn_INTEGER_enum_map_t *INTEGER_map_value2enum( + asn_INTEGER_specifics_t *specs, int64_t value); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/IPAddress.c b/src/core/libs/supl/asn-supl/IPAddress.c index efb674142..d6acf8163 100644 --- a/src/core/libs/supl/asn-supl/IPAddress.c +++ b/src/core/libs/supl/asn-supl/IPAddress.c @@ -6,18 +6,18 @@ #include "IPAddress.h" -static int -memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -30,25 +30,24 @@ memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -61,9 +60,8 @@ memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -71,35 +69,30 @@ memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_IPV4_ADDRESS_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 4, 4} /* (SIZE(4..4)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IPV6_ADDRESS_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_TYPE_IP_ADDRESS_CONSTR_1 = { {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, {APC_UNCONSTRAINED, -1, -1, 0, 0}, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_IPAddress_1[] = { {ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv4Address), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_ipv4Address_constraint_1, - &ASN_PER_MEMB_IPV4_ADDRESS_CONSTR_2, - 0, - "ipv4Address"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_ipv4Address_constraint_1, + &ASN_PER_MEMB_IPV4_ADDRESS_CONSTR_2, 0, "ipv4Address"}, {ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv6Address), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_ipv6Address_constraint_1, - &ASN_PER_MEMB_IPV6_ADDRESS_CONSTR_3, - 0, - "ipv6Address"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_ipv6Address_constraint_1, + &ASN_PER_MEMB_IPV6_ADDRESS_CONSTR_3, 0, "ipv6Address"}, }; static asn_TYPE_tag2member_t asn_MAP_IPAddress_tag2el_1[] = { {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ipv4Address at 41 */ diff --git a/src/core/libs/supl/asn-supl/IPAddress.h b/src/core/libs/supl/asn-supl/IPAddress.h index fe00846c0..f54bf710d 100644 --- a/src/core/libs/supl/asn-supl/IPAddress.h +++ b/src/core/libs/supl/asn-supl/IPAddress.h @@ -7,7 +7,6 @@ #ifndef _IPAddress_H_ #define _IPAddress_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/KeyIdentity.c b/src/core/libs/supl/asn-supl/KeyIdentity.c index dd3a3b0f3..5dd017009 100644 --- a/src/core/libs/supl/asn-supl/KeyIdentity.c +++ b/src/core/libs/supl/asn-supl/KeyIdentity.c @@ -7,16 +7,15 @@ #include "KeyIdentity.h" int KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -37,9 +36,8 @@ int KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -48,8 +46,7 @@ int KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +static void KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; @@ -66,66 +63,74 @@ KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) td->specifics = asn_DEF_BIT_STRING.specifics; } -void KeyIdentity_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) +void KeyIdentity_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) { KeyIdentity_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int KeyIdentity_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { KeyIdentity_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -KeyIdentity_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) +asn_dec_rval_t KeyIdentity_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) { KeyIdentity_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -KeyIdentity_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t KeyIdentity_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) { KeyIdentity_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -KeyIdentity_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) +asn_dec_rval_t KeyIdentity_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) { KeyIdentity_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -KeyIdentity_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t KeyIdentity_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) { KeyIdentity_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -KeyIdentity_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) +asn_dec_rval_t KeyIdentity_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) { KeyIdentity_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) +asn_enc_rval_t KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { KeyIdentity_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); @@ -134,7 +139,8 @@ KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td, static asn_per_constraints_t ASN_PER_TYPE_KEY_IDENTITY_CONSTR_1 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_KeyIdentity_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; @@ -152,10 +158,13 @@ asn_TYPE_descriptor_t asn_DEF_KeyIdentity = { KeyIdentity_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_KeyIdentity_tags_1, - sizeof(asn_DEF_KeyIdentity_tags_1) / sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ - asn_DEF_KeyIdentity_tags_1, /* Same as above */ - sizeof(asn_DEF_KeyIdentity_tags_1) / sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ + sizeof(asn_DEF_KeyIdentity_tags_1) / + sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ + asn_DEF_KeyIdentity_tags_1, /* Same as above */ + sizeof(asn_DEF_KeyIdentity_tags_1) / + sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ &ASN_PER_TYPE_KEY_IDENTITY_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/KeyIdentity.h b/src/core/libs/supl/asn-supl/KeyIdentity.h index aa8c57e94..fd06d5146 100644 --- a/src/core/libs/supl/asn-supl/KeyIdentity.h +++ b/src/core/libs/supl/asn-supl/KeyIdentity.h @@ -7,7 +7,6 @@ #ifndef _KeyIdentity_H_ #define _KeyIdentity_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/KeyIdentity4.c b/src/core/libs/supl/asn-supl/KeyIdentity4.c index d0acf6cee..54cb9cc84 100644 --- a/src/core/libs/supl/asn-supl/KeyIdentity4.c +++ b/src/core/libs/supl/asn-supl/KeyIdentity4.c @@ -7,16 +7,16 @@ #include "KeyIdentity4.h" int KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -37,9 +37,8 @@ int KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -48,8 +47,7 @@ int KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +static void KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; @@ -66,66 +64,75 @@ KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) td->specifics = asn_DEF_BIT_STRING.specifics; } -void KeyIdentity4_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) +void KeyIdentity4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) { KeyIdentity4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int KeyIdentity4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { KeyIdentity4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -KeyIdentity4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) +asn_dec_rval_t KeyIdentity4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) { KeyIdentity4_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -KeyIdentity4_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t KeyIdentity4_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) { KeyIdentity4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -KeyIdentity4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) +asn_dec_rval_t KeyIdentity4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) { KeyIdentity4_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -KeyIdentity4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t KeyIdentity4_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) { KeyIdentity4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -KeyIdentity4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) +asn_dec_rval_t KeyIdentity4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) { KeyIdentity4_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) +asn_enc_rval_t KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) { KeyIdentity4_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); @@ -134,7 +141,8 @@ KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td, static asn_per_constraints_t ASN_PER_TYPE_KEY_IDENTITY4_CONSTR_1 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_KeyIdentity4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; @@ -152,10 +160,13 @@ asn_TYPE_descriptor_t asn_DEF_KeyIdentity4 = { KeyIdentity4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_KeyIdentity4_tags_1, - sizeof(asn_DEF_KeyIdentity4_tags_1) / sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ - asn_DEF_KeyIdentity4_tags_1, /* Same as above */ - sizeof(asn_DEF_KeyIdentity4_tags_1) / sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ + sizeof(asn_DEF_KeyIdentity4_tags_1) / + sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ + asn_DEF_KeyIdentity4_tags_1, /* Same as above */ + sizeof(asn_DEF_KeyIdentity4_tags_1) / + sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ &ASN_PER_TYPE_KEY_IDENTITY4_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/KeyIdentity4.h b/src/core/libs/supl/asn-supl/KeyIdentity4.h index 9237416c9..c67f3d899 100644 --- a/src/core/libs/supl/asn-supl/KeyIdentity4.h +++ b/src/core/libs/supl/asn-supl/KeyIdentity4.h @@ -7,7 +7,6 @@ #ifndef _KeyIdentity4_H_ #define _KeyIdentity4_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/LocationId.c b/src/core/libs/supl/asn-supl/LocationId.c index 296dde16f..c514749eb 100644 --- a/src/core/libs/supl/asn-supl/LocationId.c +++ b/src/core/libs/supl/asn-supl/LocationId.c @@ -7,40 +7,33 @@ #include "LocationId.h" static asn_TYPE_member_t asn_MBR_LocationId_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct LocationId, cellInfo), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_CellInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cellInfo" - }, - { ATF_NOFLAGS, 0, offsetof(struct LocationId, status), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Status, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "status" - }, + {ATF_NOFLAGS, 0, offsetof(struct LocationId, cellInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_CellInfo, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cellInfo"}, + {ATF_NOFLAGS, 0, offsetof(struct LocationId, status), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Status, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "status"}, }; static ber_tlv_tag_t asn_DEF_LocationId_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_LocationId_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellInfo at 53 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* status at 54 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* cellInfo at 53 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* status at 54 */ }; static asn_SEQUENCE_specifics_t asn_SPC_LocationId_specs_1 = { sizeof(struct LocationId), offsetof(struct LocationId, _asn_ctx), asn_MAP_LocationId_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_LocationId = { "LocationId", @@ -54,16 +47,15 @@ asn_TYPE_descriptor_t asn_DEF_LocationId = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_LocationId_tags_1, - sizeof(asn_DEF_LocationId_tags_1) - /sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ - asn_DEF_LocationId_tags_1, /* Same as above */ - sizeof(asn_DEF_LocationId_tags_1) - /sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_LocationId_tags_1) / + sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ + asn_DEF_LocationId_tags_1, /* Same as above */ + sizeof(asn_DEF_LocationId_tags_1) / + sizeof(asn_DEF_LocationId_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_LocationId_1, - 2, /* Elements count */ - &asn_SPC_LocationId_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_LocationId_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/LocationId.h b/src/core/libs/supl/asn-supl/LocationId.h index 8eb42acbb..c193e660a 100644 --- a/src/core/libs/supl/asn-supl/LocationId.h +++ b/src/core/libs/supl/asn-supl/LocationId.h @@ -7,7 +7,6 @@ #ifndef _LocationId_H_ #define _LocationId_H_ - #include /* Including external dependencies */ @@ -26,9 +25,9 @@ extern "C" CellInfo_t cellInfo; Status_t status; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/MAC.c b/src/core/libs/supl/asn-supl/MAC.c index 0b154db04..cc49e7f01 100644 --- a/src/core/libs/supl/asn-supl/MAC.c +++ b/src/core/libs/supl/asn-supl/MAC.c @@ -7,16 +7,15 @@ #include "MAC.h" int MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -37,9 +36,8 @@ int MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -48,8 +46,7 @@ int MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +static void MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; @@ -66,66 +63,67 @@ MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) td->specifics = asn_DEF_BIT_STRING.specifics; } -void MAC_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) +void MAC_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { MAC_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int MAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +int MAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { MAC_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -MAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) +asn_dec_rval_t MAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) { MAC_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -MAC_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t MAC_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { MAC_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -MAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) +asn_dec_rval_t MAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) { MAC_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -MAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t MAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { MAC_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -MAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) +asn_dec_rval_t MAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) { MAC_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -MAC_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) +asn_enc_rval_t MAC_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { MAC_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); @@ -134,7 +132,8 @@ MAC_encode_uper(asn_TYPE_descriptor_t *td, static asn_per_constraints_t ASN_PER_TYPE_MAC_CONSTR_1 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 64, 64} /* (SIZE(64..64)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_MAC_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; @@ -153,9 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_MAC = { 0, /* Use generic outmost tag fetcher */ asn_DEF_MAC_tags_1, sizeof(asn_DEF_MAC_tags_1) / sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */ - asn_DEF_MAC_tags_1, /* Same as above */ + asn_DEF_MAC_tags_1, /* Same as above */ sizeof(asn_DEF_MAC_tags_1) / sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MAC_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/MAC.h b/src/core/libs/supl/asn-supl/MAC.h index d2e658839..457d1d28f 100644 --- a/src/core/libs/supl/asn-supl/MAC.h +++ b/src/core/libs/supl/asn-supl/MAC.h @@ -7,7 +7,6 @@ #ifndef _MAC_H_ #define _MAC_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/MeasuredResults.c b/src/core/libs/supl/asn-supl/MeasuredResults.c index 9fe918647..aa9256e56 100644 --- a/src/core/libs/supl/asn-supl/MeasuredResults.c +++ b/src/core/libs/supl/asn-supl/MeasuredResults.c @@ -7,52 +7,44 @@ #include "MeasuredResults.h" static asn_TYPE_member_t asn_MBR_MeasuredResults_1[] = { - { ATF_POINTER, 3, offsetof(struct MeasuredResults, frequencyInfo), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrequencyInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "frequencyInfo" - }, - { ATF_POINTER, 2, offsetof(struct MeasuredResults, utra_CarrierRSSI), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UTRA_CarrierRSSI, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "utra-CarrierRSSI" - }, - { ATF_POINTER, 1, offsetof(struct MeasuredResults, cellMeasuredResultsList), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_CellMeasuredResultsList, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "cellMeasuredResultsList" - }, + {ATF_POINTER, 3, offsetof(struct MeasuredResults, frequencyInfo), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "frequencyInfo"}, + {ATF_POINTER, 2, offsetof(struct MeasuredResults, utra_CarrierRSSI), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTRA_CarrierRSSI, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "utra-CarrierRSSI"}, + {ATF_POINTER, 1, offsetof(struct MeasuredResults, cellMeasuredResultsList), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_CellMeasuredResultsList, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "cellMeasuredResultsList"}, }; -static int asn_MAP_MeasuredResults_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_MeasuredResults_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_MeasuredResults_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_MeasuredResults_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* frequencyInfo at 148 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utra-CarrierRSSI at 149 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cellMeasuredResultsList at 150 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* frequencyInfo at 148 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* utra-CarrierRSSI at 149 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* cellMeasuredResultsList at 150 */ }; static asn_SEQUENCE_specifics_t asn_SPC_MeasuredResults_specs_1 = { sizeof(struct MeasuredResults), offsetof(struct MeasuredResults, _asn_ctx), asn_MAP_MeasuredResults_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_MeasuredResults_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_MeasuredResults_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_MeasuredResults = { "MeasuredResults", @@ -66,16 +58,15 @@ asn_TYPE_descriptor_t asn_DEF_MeasuredResults = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MeasuredResults_tags_1, - sizeof(asn_DEF_MeasuredResults_tags_1) - /sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ - asn_DEF_MeasuredResults_tags_1, /* Same as above */ - sizeof(asn_DEF_MeasuredResults_tags_1) - /sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_MeasuredResults_tags_1) / + sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ + asn_DEF_MeasuredResults_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasuredResults_tags_1) / + sizeof(asn_DEF_MeasuredResults_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_MeasuredResults_1, - 3, /* Elements count */ - &asn_SPC_MeasuredResults_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_MeasuredResults_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/MeasuredResults.h b/src/core/libs/supl/asn-supl/MeasuredResults.h index 4abf9a9fb..029f4270e 100644 --- a/src/core/libs/supl/asn-supl/MeasuredResults.h +++ b/src/core/libs/supl/asn-supl/MeasuredResults.h @@ -7,7 +7,6 @@ #ifndef _MeasuredResults_H_ #define _MeasuredResults_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/MeasuredResultsList.c b/src/core/libs/supl/asn-supl/MeasuredResultsList.c index e90358992..09ba72bed 100644 --- a/src/core/libs/supl/asn-supl/MeasuredResultsList.c +++ b/src/core/libs/supl/asn-supl/MeasuredResultsList.c @@ -7,28 +7,24 @@ #include "MeasuredResultsList.h" static asn_per_constraints_t ASN_PER_TYPE_MEASURED_RESULTS_LIST_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 3, 3, 1, 8} /* (SIZE(1..8)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_MeasuredResultsList_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_MeasuredResults, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_MeasuredResults, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_MeasuredResultsList_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_MeasuredResultsList_specs_1 = { sizeof(struct MeasuredResultsList), offsetof(struct MeasuredResultsList, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_MeasuredResultsList = { "MeasuredResultsList", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_MeasuredResultsList = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_MeasuredResultsList_tags_1, - sizeof(asn_DEF_MeasuredResultsList_tags_1) - /sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ - asn_DEF_MeasuredResultsList_tags_1, /* Same as above */ - sizeof(asn_DEF_MeasuredResultsList_tags_1) - /sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ + sizeof(asn_DEF_MeasuredResultsList_tags_1) / + sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ + asn_DEF_MeasuredResultsList_tags_1, /* Same as above */ + sizeof(asn_DEF_MeasuredResultsList_tags_1) / + sizeof(asn_DEF_MeasuredResultsList_tags_1[0]), /* 1 */ &ASN_PER_TYPE_MEASURED_RESULTS_LIST_CONSTR_1, asn_MBR_MeasuredResultsList_1, - 1, /* Single element */ - &asn_SPC_MeasuredResultsList_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_MeasuredResultsList_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/MeasuredResultsList.h b/src/core/libs/supl/asn-supl/MeasuredResultsList.h index ebfa82313..1c5b016d1 100644 --- a/src/core/libs/supl/asn-supl/MeasuredResultsList.h +++ b/src/core/libs/supl/asn-supl/MeasuredResultsList.h @@ -7,7 +7,6 @@ #ifndef _MeasuredResultsList_H_ #define _MeasuredResultsList_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/NMR.c b/src/core/libs/supl/asn-supl/NMR.c index f1f6ec41e..4366349f3 100644 --- a/src/core/libs/supl/asn-supl/NMR.c +++ b/src/core/libs/supl/asn-supl/NMR.c @@ -7,28 +7,22 @@ #include "NMR.h" static asn_per_constraints_t ASN_PER_TYPE_NMR_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 15} /* (SIZE(1..15)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_NMR_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_NMRelement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_NMRelement, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_NMR_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_NMR_specs_1 = { - sizeof(struct NMR), - offsetof(struct NMR, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + sizeof(struct NMR), offsetof(struct NMR, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_NMR = { "NMR", @@ -42,16 +36,13 @@ asn_TYPE_descriptor_t asn_DEF_NMR = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NMR_tags_1, - sizeof(asn_DEF_NMR_tags_1) - /sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ - asn_DEF_NMR_tags_1, /* Same as above */ - sizeof(asn_DEF_NMR_tags_1) - /sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ + sizeof(asn_DEF_NMR_tags_1) / sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ + asn_DEF_NMR_tags_1, /* Same as above */ + sizeof(asn_DEF_NMR_tags_1) / sizeof(asn_DEF_NMR_tags_1[0]), /* 1 */ &ASN_PER_TYPE_NMR_CONSTR_1, asn_MBR_NMR_1, - 1, /* Single element */ - &asn_SPC_NMR_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_NMR_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/NMR.h b/src/core/libs/supl/asn-supl/NMR.h index 4fa1fcdd3..57ffbd6d5 100644 --- a/src/core/libs/supl/asn-supl/NMR.h +++ b/src/core/libs/supl/asn-supl/NMR.h @@ -7,7 +7,6 @@ #ifndef _NMR_H_ #define _NMR_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/NMRelement.c b/src/core/libs/supl/asn-supl/NMRelement.c index 8203ac805..df1ca1d11 100644 --- a/src/core/libs/supl/asn-supl/NMRelement.c +++ b/src/core/libs/supl/asn-supl/NMRelement.c @@ -6,141 +6,139 @@ #include "NMRelement.h" -static int -memb_aRFCN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_aRFCN_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_bSIC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_bSIC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_rxLev_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_rxLev_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_A_RFCN_CONSTR_2 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_B_SIC_CONSTR_3 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RX_LEV_CONSTR_4 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_NMRelement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct NMRelement, aRFCN), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_aRFCN_constraint_1, - &ASN_PER_MEMB_A_RFCN_CONSTR_2, - 0, - "aRFCN" - }, - { ATF_NOFLAGS, 0, offsetof(struct NMRelement, bSIC), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_bSIC_constraint_1, - &ASN_PER_MEMB_B_SIC_CONSTR_3, - 0, - "bSIC" - }, - { ATF_NOFLAGS, 0, offsetof(struct NMRelement, rxLev), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_rxLev_constraint_1, - &ASN_PER_MEMB_RX_LEV_CONSTR_4, - 0, - "rxLev" - }, + {ATF_NOFLAGS, 0, offsetof(struct NMRelement, aRFCN), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_aRFCN_constraint_1, + &ASN_PER_MEMB_A_RFCN_CONSTR_2, 0, "aRFCN"}, + {ATF_NOFLAGS, 0, offsetof(struct NMRelement, bSIC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_bSIC_constraint_1, + &ASN_PER_MEMB_B_SIC_CONSTR_3, 0, "bSIC"}, + {ATF_NOFLAGS, 0, offsetof(struct NMRelement, rxLev), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_rxLev_constraint_1, + &ASN_PER_MEMB_RX_LEV_CONSTR_4, 0, "rxLev"}, }; static ber_tlv_tag_t asn_DEF_NMRelement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_NMRelement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* aRFCN at 140 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* bSIC at 141 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rxLev at 142 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* aRFCN at 140 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bSIC at 141 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* rxLev at 142 */ }; static asn_SEQUENCE_specifics_t asn_SPC_NMRelement_specs_1 = { sizeof(struct NMRelement), offsetof(struct NMRelement, _asn_ctx), asn_MAP_NMRelement_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_NMRelement = { "NMRelement", @@ -154,16 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_NMRelement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NMRelement_tags_1, - sizeof(asn_DEF_NMRelement_tags_1) - /sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ - asn_DEF_NMRelement_tags_1, /* Same as above */ - sizeof(asn_DEF_NMRelement_tags_1) - /sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_NMRelement_tags_1) / + sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ + asn_DEF_NMRelement_tags_1, /* Same as above */ + sizeof(asn_DEF_NMRelement_tags_1) / + sizeof(asn_DEF_NMRelement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_NMRelement_1, - 3, /* Elements count */ - &asn_SPC_NMRelement_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_NMRelement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/NMRelement.h b/src/core/libs/supl/asn-supl/NMRelement.h index 72e08a5f3..100b6f788 100644 --- a/src/core/libs/supl/asn-supl/NMRelement.h +++ b/src/core/libs/supl/asn-supl/NMRelement.h @@ -7,7 +7,6 @@ #ifndef _NMRelement_H_ #define _NMRelement_H_ - #include /* Including external dependencies */ @@ -26,9 +25,9 @@ extern "C" long bSIC; long rxLev; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/NativeEnumerated.c b/src/core/libs/supl/asn-supl/NativeEnumerated.c index d67c75c5c..dd4d3f235 100644 --- a/src/core/libs/supl/asn-supl/NativeEnumerated.c +++ b/src/core/libs/supl/asn-supl/NativeEnumerated.c @@ -16,10 +16,9 @@ * NativeEnumerated basic type description. */ static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { - "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ + "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ "ENUMERATED", NativeInteger_free, NativeInteger_print, @@ -32,92 +31,108 @@ asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { NativeEnumerated_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeEnumerated_tags, - sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), - asn_DEF_NativeEnumerated_tags, /* Same as above */ - sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + sizeof(asn_DEF_NativeEnumerated_tags) / + sizeof(asn_DEF_NativeEnumerated_tags[0]), + asn_DEF_NativeEnumerated_tags, /* Same as above */ + sizeof(asn_DEF_NativeEnumerated_tags) / + sizeof(asn_DEF_NativeEnumerated_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -asn_enc_rval_t -NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - asn_enc_rval_t er; - const long *native = (const long *)sptr; +asn_enc_rval_t NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, + void *sptr, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + const long *native = (const long *)sptr; const asn_INTEGER_enum_map_t *el; - (void)ilevel; - (void)flags; + (void)ilevel; + (void)flags; - if(!native) _ASN_ENCODE_FAILED; + if (!native) _ASN_ENCODE_FAILED; el = INTEGER_map_value2enum(specs, *native); - if(el) { - size_t srcsize = el->enum_len + 5; - char *src = (char *)alloca(srcsize); + if (el) + { + size_t srcsize = el->enum_len + 5; + char *src = (char *)alloca(srcsize); - er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); - assert(er.encoded > 0 && (size_t)er.encoded < srcsize); - if(cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } else { - ASN_DEBUG("ASN.1 forbids dealing with " - "unknown value of ENUMERATED type"); - _ASN_ENCODE_FAILED; - } + er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); + assert(er.encoded > 0 && (size_t)er.encoded < srcsize); + if (cb(src, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + else + { + ASN_DEBUG( + "ASN.1 forbids dealing with " + "unknown value of ENUMERATED type"); + _ASN_ENCODE_FAILED; + } } -asn_dec_rval_t -NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, - void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; - asn_dec_rval_t rval = { RC_OK, 0 }; + asn_dec_rval_t rval = {RC_OK, 0}; long *native = (long *)*sptr; asn_per_constraint_t *ct; long value; (void)opt_codec_ctx; - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else _ASN_DECODE_FAILED; /* Mandatory! */ - if(!specs) _ASN_DECODE_FAILED; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + _ASN_DECODE_FAILED; /* Mandatory! */ + if (!specs) _ASN_DECODE_FAILED; - if(!native) { - native = (long *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); - if(ct->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) _ASN_DECODE_STARVED; - if(inext) ct = 0; - } + if (ct->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) _ASN_DECODE_STARVED; + if (inext) ct = 0; + } - if(ct && ct->range_bits >= 0) { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - if(value >= (specs->extension - ? specs->extension - 1 : specs->map_count)) - _ASN_DECODE_FAILED; - } else { - if(!specs->extension) - _ASN_DECODE_FAILED; - /* - * X.691, #10.6: normally small non-negative whole number; - */ - value = uper_get_nsnnwn(pd); - if(value < 0) _ASN_DECODE_STARVED; - value += specs->extension - 1; - if(value >= specs->map_count) - _ASN_DECODE_FAILED; - } + if (ct && ct->range_bits >= 0) + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + if (value >= + (specs->extension ? specs->extension - 1 : specs->map_count)) + _ASN_DECODE_FAILED; + } + else + { + if (!specs->extension) _ASN_DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if (value < 0) _ASN_DECODE_STARVED; + value += specs->extension - 1; + if (value >= specs->map_count) _ASN_DECODE_FAILED; + } *native = specs->value2enum[value].nat_value; ASN_DEBUG("Decoded %s = %ld", td->name, *native); @@ -125,20 +140,19 @@ NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } -static int -NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { +static int NativeEnumerated__compar_value2enum(const void *ap, const void *bp) +{ const asn_INTEGER_enum_map_t *a = ap; const asn_INTEGER_enum_map_t *b = bp; - if(a->nat_value == b->nat_value) - return 0; - if(a->nat_value < b->nat_value) - return -1; + if (a->nat_value == b->nat_value) return 0; + if (a->nat_value < b->nat_value) return -1; return 1; } -asn_enc_rval_t -NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native; @@ -148,61 +162,65 @@ NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, asn_INTEGER_enum_map_t key; asn_INTEGER_enum_map_t *kf; - if(!sptr) _ASN_ENCODE_FAILED; - if(!specs) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; + if (!specs) _ASN_ENCODE_FAILED; - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else _ASN_ENCODE_FAILED; /* Mandatory! */ + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + _ASN_ENCODE_FAILED; /* Mandatory! */ ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); er.encoded = 0; native = *(long *)sptr; - if(native < 0) _ASN_ENCODE_FAILED; + if (native < 0) _ASN_ENCODE_FAILED; key.nat_value = native; - kf = bsearch(&key, specs->value2enum, specs->map_count, - sizeof(key), NativeEnumerated__compar_value2enum); - if(!kf) { - ASN_DEBUG("No element corresponds to %ld", native); - _ASN_ENCODE_FAILED; - } + kf = bsearch(&key, specs->value2enum, specs->map_count, sizeof(key), + NativeEnumerated__compar_value2enum); + if (!kf) + { + ASN_DEBUG("No element corresponds to %ld", native); + _ASN_ENCODE_FAILED; + } value = kf - specs->value2enum; - if(ct->range_bits >= 0) { - int cmpWith = specs->extension - ? specs->extension - 1 : specs->map_count; - if(value >= cmpWith) - inext = 1; - } - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, inext, 1)) + if (ct->range_bits >= 0) + { + int cmpWith = + specs->extension ? specs->extension - 1 : specs->map_count; + if (value >= cmpWith) inext = 1; + } + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + if (inext) ct = 0; + } + else if (inext) + { _ASN_ENCODE_FAILED; - if(inext) ct = 0; - } else if(inext) { - _ASN_ENCODE_FAILED; - } + } - if(ct && ct->range_bits >= 0) { - if(per_put_few_bits(po, value, ct->range_bits)) - _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } + if (ct && ct->range_bits >= 0) + { + if (per_put_few_bits(po, value, ct->range_bits)) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } - if(!specs->extension) - _ASN_ENCODE_FAILED; + if (!specs->extension) _ASN_ENCODE_FAILED; /* * X.691, #10.6: normally small non-negative whole number; */ - ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", - value, specs->extension, inext, - value - (inext ? (specs->extension - 1) : 0)); - if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", value, + specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if (uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } - diff --git a/src/core/libs/supl/asn-supl/NativeInteger.c b/src/core/libs/supl/asn-supl/NativeInteger.c index b563925a7..675850bda 100644 --- a/src/core/libs/supl/asn-supl/NativeInteger.c +++ b/src/core/libs/supl/asn-supl/NativeInteger.c @@ -17,10 +17,9 @@ * NativeInteger basic type description. */ static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_NativeInteger = { - "INTEGER", /* The ASN.1 type is still INTEGER */ + "INTEGER", /* The ASN.1 type is still INTEGER */ "INTEGER", NativeInteger_free, NativeInteger_print, @@ -29,26 +28,28 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = { NativeInteger_encode_der, NativeInteger_decode_xer, NativeInteger_encode_xer, - NativeInteger_decode_uper, /* Unaligned PER decoder */ - NativeInteger_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + NativeInteger_decode_uper, /* Unaligned PER decoder */ + NativeInteger_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeInteger_tags, sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), - asn_DEF_NativeInteger_tags, /* Same as above */ + asn_DEF_NativeInteger_tags, /* Same as above */ sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - 0 /* No specifics */ + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; /* * Decode INTEGER type. */ -asn_dec_rval_t -NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **nint_ptr, const void *buf_ptr, + size_t size, int tag_mode) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; int64_t *native = (int64_t *)*nint_ptr; asn_dec_rval_t rval; ber_tlv_len_t length; @@ -56,25 +57,25 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * If the structure is not there, allocate it. */ - if(native == NULL) { - native = (int64_t *)(*nint_ptr = CALLOC(1, sizeof(*native))); - if(native == NULL) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; + if (native == NULL) + { + native = (int64_t *)(*nint_ptr = CALLOC(1, sizeof(*native))); + if (native == NULL) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } } - } - ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", td->name, tag_mode); /* * Check tags. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); @@ -83,11 +84,12 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } /* * ASN.1 encoded INTEGER: buf_ptr, length @@ -96,7 +98,8 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, */ { INTEGER_t tmp; - union { + union + { const void *constbuf; void *nonconstbuf; } unconst_buf; @@ -106,13 +109,14 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; tmp.size = length; - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmp, (uint64_t *)&l) - : asn_INTEGER2long(&tmp, &l)) { - rval.code = RC_FAIL; - rval.consumed = 0; - return rval; - } + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&tmp, (uint64_t *)&l) + : asn_INTEGER2long(&tmp, &l)) + { + rval.code = RC_FAIL; + rval.consumed = 0; + return rval; + } *native = l; } @@ -120,8 +124,8 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", - (long)rval.consumed, (long)length, td->name, (long)*native); + ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", (long)rval.consumed, + (long)length, td->name, (long)*native); return rval; } @@ -129,114 +133,125 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * Encode the NativeInteger using the standard INTEGER type DER encoder. */ -asn_enc_rval_t -NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { - uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */ +asn_enc_rval_t NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + uint64_t native = *(uint64_t *)ptr; /* Disable sign ext. */ asn_enc_rval_t erval; INTEGER_t tmp; -#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ +#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ tmp.buf = (uint8_t *)&native; tmp.size = sizeof(native); -#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ +#else /* Works even if WORDS_BIGENDIAN is not set where should've been */ uint8_t buf[sizeof(native)]; uint8_t *p; /* Prepare a fake INTEGER */ - for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) + for (p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) *p = (uint8_t)native; tmp.buf = buf; tmp.size = sizeof(buf); -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ /* Encode fake INTEGER */ erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); - if(erval.encoded == -1) { - assert(erval.structure_ptr == &tmp); - erval.structure_ptr = ptr; - } + if (erval.encoded == -1) + { + assert(erval.structure_ptr == &tmp); + erval.structure_ptr = ptr; + } return erval; } /* * Decode the chunk of XML text encoding INTEGER. */ -asn_dec_rval_t -NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, - const void *buf_ptr, size_t size) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const char *opt_mname, + const void *buf_ptr, size_t size) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; INTEGER_t st; void *st_ptr = (void *)&st; int64_t *native = (int64_t *)*sptr; - if(!native) { - native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } memset(&st, 0, sizeof(st)); - rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, - opt_mname, buf_ptr, size); - if(rval.code == RC_OK) { - int64_t l; - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&st, (uint64_t *)&l) - : asn_INTEGER2long(&st, &l)) { - rval.code = RC_FAIL; - rval.consumed = 0; - } else { - *native = l; + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, + size); + if (rval.code == RC_OK) + { + int64_t l; + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&st, (uint64_t *)&l) + : asn_INTEGER2long(&st, &l)) + { + rval.code = RC_FAIL; + rval.consumed = 0; + } + else + { + *native = l; + } + } + else + { + /* + * Cannot restart from the middle; + * there is no place to save state in the native type. + * Request a continuation from the very beginning. + */ + rval.consumed = 0; } - } else { - /* - * Cannot restart from the middle; - * there is no place to save state in the native type. - * Request a continuation from the very beginning. - */ - rval.consumed = 0; - } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); return rval; } - -asn_enc_rval_t -NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; - char scratch[32]; /* Enough for 64-bit int */ +asn_enc_rval_t NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + char scratch[32]; /* Enough for 64-bit int */ asn_enc_rval_t er; const long *native = (const long *)sptr; (void)ilevel; (void)flags; - if(!native) _ASN_ENCODE_FAILED; + if (!native) _ASN_ENCODE_FAILED; - er.encoded = snprintf(scratch, sizeof(scratch), - (specs && specs->field_unsigned) - ? "%lu" : "%ld", *native); - if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) - || cb(scratch, er.encoded, app_key) < 0) + er.encoded = + snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) ? "%lu" : "%ld", *native); + if (er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) || + cb(scratch, er.encoded, app_key) < 0) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); } -asn_dec_rval_t -NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_dec_rval_t NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; int64_t *native = (int64_t *)*sptr; INTEGER_t tmpint; @@ -245,46 +260,46 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, (void)opt_codec_ctx; ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); - if(!native) { - native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); - if(!native) _ASN_DECODE_FAILED; - } + if (!native) + { + native = (int64_t *)(*sptr = CALLOC(1, sizeof(*native))); + if (!native) _ASN_DECODE_FAILED; + } memset(&tmpint, 0, sizeof tmpint); - rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, - &tmpintptr, pd); - if(rval.code == RC_OK) { - if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmpint, (uint64_t *)native) - : asn_INTEGER2long(&tmpint, native)) - rval.code = RC_FAIL; - else - ASN_DEBUG("NativeInteger %s got value %ld", - td->name, *native); - } + rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, &tmpintptr, pd); + if (rval.code == RC_OK) + { + if ((specs && specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (uint64_t *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", td->name, *native); + } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); return rval; } -asn_enc_rval_t -NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +asn_enc_rval_t NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native; INTEGER_t tmpint; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; native = *(long *)sptr; ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); memset(&tmpint, 0, sizeof(tmpint)); - if((specs&&specs->field_unsigned) - ? asn_ulong2INTEGER(&tmpint, native) - : asn_long2INTEGER(&tmpint, native)) + if ((specs && specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) _ASN_ENCODE_FAILED; er = INTEGER_encode_uper(td, constraints, &tmpint, po); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); @@ -294,38 +309,40 @@ NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, /* * INTEGER specific human-readable output. */ -int -NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; +int NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const long *native = (const long *)sptr; - char scratch[32]; /* Enough for 64-bit int */ + char scratch[32]; /* Enough for 64-bit int */ int ret; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(native) { - ret = snprintf(scratch, sizeof(scratch), - (specs && specs->field_unsigned) - ? "%lu" : "%ld", *native); - assert(ret > 0 && (size_t)ret < sizeof(scratch)); - return (cb(scratch, ret, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + if (native) + { + ret = snprintf(scratch, sizeof(scratch), + (specs && specs->field_unsigned) ? "%lu" : "%ld", + *native); + assert(ret > 0 && (size_t)ret < sizeof(scratch)); + return (cb(scratch, ret, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -void -NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { +void NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (!td || !ptr) return; - if(!td || !ptr) - return; + ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", td->name, contents_only, + ptr); - ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", - td->name, contents_only, ptr); - - if(!contents_only) { - FREEMEM(ptr); - } + if (!contents_only) + { + FREEMEM(ptr); + } } diff --git a/src/core/libs/supl/asn-supl/Notification.c b/src/core/libs/supl/asn-supl/Notification.c index 0b8b11119..0b054927a 100644 --- a/src/core/libs/supl/asn-supl/Notification.c +++ b/src/core/libs/supl/asn-supl/Notification.c @@ -6,145 +6,133 @@ #include "Notification.h" -static int -memb_requestorId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_requestorId_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 50)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 50)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_clientName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_clientName_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 50)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 50)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REQUESTOR_ID_CONSTR_4 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 50 } /* (SIZE(1..50)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 50} /* (SIZE(1..50)) */, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CLIENT_NAME_CONSTR_6 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 6, 6, 1, 50 } /* (SIZE(1..50)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 6, 6, 1, 50} /* (SIZE(1..50)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Notification_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Notification, notificationType), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NotificationType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "notificationType" - }, - { ATF_POINTER, 5, offsetof(struct Notification, encodingType), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_EncodingType, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "encodingType" - }, - { ATF_POINTER, 4, offsetof(struct Notification, requestorId), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_requestorId_constraint_1, - &ASN_PER_MEMB_REQUESTOR_ID_CONSTR_4, - 0, - "requestorId" - }, - { ATF_POINTER, 3, offsetof(struct Notification, requestorIdType), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FormatIndicator, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "requestorIdType" - }, - { ATF_POINTER, 2, offsetof(struct Notification, clientName), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_clientName_constraint_1, - &ASN_PER_MEMB_CLIENT_NAME_CONSTR_6, - 0, - "clientName" - }, - { ATF_POINTER, 1, offsetof(struct Notification, clientNameType), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FormatIndicator, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "clientNameType" - }, + {ATF_NOFLAGS, 0, offsetof(struct Notification, notificationType), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NotificationType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "notificationType"}, + {ATF_POINTER, 5, offsetof(struct Notification, encodingType), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_EncodingType, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "encodingType"}, + {ATF_POINTER, 4, offsetof(struct Notification, requestorId), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_requestorId_constraint_1, + &ASN_PER_MEMB_REQUESTOR_ID_CONSTR_4, 0, "requestorId"}, + {ATF_POINTER, 3, offsetof(struct Notification, requestorIdType), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FormatIndicator, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "requestorIdType"}, + {ATF_POINTER, 2, offsetof(struct Notification, clientName), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_clientName_constraint_1, + &ASN_PER_MEMB_CLIENT_NAME_CONSTR_6, 0, "clientName"}, + {ATF_POINTER, 1, offsetof(struct Notification, clientNameType), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FormatIndicator, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "clientNameType"}, }; -static int asn_MAP_Notification_oms_1[] = { 1, 2, 3, 4, 5 }; +static int asn_MAP_Notification_oms_1[] = {1, 2, 3, 4, 5}; static ber_tlv_tag_t asn_DEF_Notification_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Notification_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* notificationType at 20 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* encodingType at 21 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* requestorId at 22 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* requestorIdType at 23 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* clientName at 24 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* clientNameType at 25 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* notificationType at 20 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* encodingType at 21 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* requestorId at 22 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* requestorIdType at 23 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* clientName at 24 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* clientNameType at 25 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Notification_specs_1 = { sizeof(struct Notification), offsetof(struct Notification, _asn_ctx), asn_MAP_Notification_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_Notification_oms_1, /* Optional members */ - 5, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_Notification_oms_1, /* Optional members */ + 5, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Notification = { "Notification", @@ -158,16 +146,15 @@ asn_TYPE_descriptor_t asn_DEF_Notification = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Notification_tags_1, - sizeof(asn_DEF_Notification_tags_1) - /sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ - asn_DEF_Notification_tags_1, /* Same as above */ - sizeof(asn_DEF_Notification_tags_1) - /sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Notification_tags_1) / + sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ + asn_DEF_Notification_tags_1, /* Same as above */ + sizeof(asn_DEF_Notification_tags_1) / + sizeof(asn_DEF_Notification_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Notification_1, - 6, /* Elements count */ - &asn_SPC_Notification_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_Notification_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/Notification.h b/src/core/libs/supl/asn-supl/Notification.h index 48d11eb41..4cc4f1f65 100644 --- a/src/core/libs/supl/asn-supl/Notification.h +++ b/src/core/libs/supl/asn-supl/Notification.h @@ -7,7 +7,6 @@ #ifndef _Notification_H_ #define _Notification_H_ - #include /* Including external dependencies */ @@ -32,9 +31,9 @@ extern "C" OCTET_STRING_t *clientName /* OPTIONAL */; FormatIndicator_t *clientNameType /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/NotificationType.c b/src/core/libs/supl/asn-supl/NotificationType.c index 5f310abc9..c21e1a09e 100644 --- a/src/core/libs/supl/asn-supl/NotificationType.c +++ b/src/core/libs/supl/asn-supl/NotificationType.c @@ -6,9 +6,10 @@ #include "NotificationType.h" -int -NotificationType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int NotificationType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,115 +19,134 @@ NotificationType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -NotificationType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void NotificationType_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -NotificationType_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void NotificationType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ NotificationType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -NotificationType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int NotificationType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ NotificationType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -NotificationType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t NotificationType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ NotificationType_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -NotificationType_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NotificationType_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ NotificationType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -NotificationType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t NotificationType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ NotificationType_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -NotificationType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t NotificationType_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ NotificationType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -NotificationType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t NotificationType_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ NotificationType_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -NotificationType_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t NotificationType_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ NotificationType_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_NOTIFICATION_TYPE_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4 } /* (0..4,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4} /* (0..4,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_NotificationType_value2enum_1[] = { - { 0, 28, "noNotificationNoVerification" }, - { 1, 16, "notificationOnly" }, - { 2, 35, "notificationAndVerficationAllowedNA" }, - { 3, 34, "notificationAndVerficationDeniedNA" }, - { 4, 15, "privacyOverride" } + {0, 28, "noNotificationNoVerification"}, + {1, 16, "notificationOnly"}, + {2, 35, "notificationAndVerficationAllowedNA"}, + {3, 34, "notificationAndVerficationDeniedNA"}, + {4, 15, "privacyOverride"} /* This list is extensible */ }; static unsigned int asn_MAP_NotificationType_enum2value_1[] = { - 0, /* noNotificationNoVerification(0) */ - 2, /* notificationAndVerficationAllowedNA(2) */ - 3, /* notificationAndVerficationDeniedNA(3) */ - 1, /* notificationOnly(1) */ - 4 /* privacyOverride(4) */ - /* This list is extensible */ + 0, /* noNotificationNoVerification(0) */ + 2, /* notificationAndVerficationAllowedNA(2) */ + 3, /* notificationAndVerficationDeniedNA(3) */ + 1, /* notificationOnly(1) */ + 4 /* privacyOverride(4) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_NotificationType_specs_1 = { - asn_MAP_NotificationType_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_NotificationType_enum2value_1, /* N => "tag"; sorted by N */ - 5, /* Number of elements in the maps */ - 6, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_NotificationType_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_NotificationType_enum2value_1, /* N => "tag"; sorted by N */ + 5, /* Number of elements in the maps */ + 6, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_NotificationType_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_NotificationType = { "NotificationType", "NotificationType", @@ -139,15 +159,15 @@ asn_TYPE_descriptor_t asn_DEF_NotificationType = { NotificationType_encode_xer, NotificationType_decode_uper, NotificationType_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_NotificationType_tags_1, - sizeof(asn_DEF_NotificationType_tags_1) - /sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ - asn_DEF_NotificationType_tags_1, /* Same as above */ - sizeof(asn_DEF_NotificationType_tags_1) - /sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ + sizeof(asn_DEF_NotificationType_tags_1) / + sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ + asn_DEF_NotificationType_tags_1, /* Same as above */ + sizeof(asn_DEF_NotificationType_tags_1) / + sizeof(asn_DEF_NotificationType_tags_1[0]), /* 1 */ &ASN_PER_TYPE_NOTIFICATION_TYPE_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_NotificationType_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_NotificationType_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/NotificationType.h b/src/core/libs/supl/asn-supl/NotificationType.h index 547162b28..9bcc95b4c 100644 --- a/src/core/libs/supl/asn-supl/NotificationType.h +++ b/src/core/libs/supl/asn-supl/NotificationType.h @@ -7,7 +7,6 @@ #ifndef _NotificationType_H_ #define _NotificationType_H_ - #include /* Including external dependencies */ @@ -27,8 +26,8 @@ extern "C" NotificationType_notificationAndVerficationDeniedNA = 3, NotificationType_privacyOverride = 4 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_NotificationType; /* NotificationType */ diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.c b/src/core/libs/supl/asn-supl/OCTET_STRING.c index f7fbf670e..e66360994 100644 --- a/src/core/libs/supl/asn-supl/OCTET_STRING.c +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.c @@ -5,104 +5,116 @@ */ #include #include -#include /* for .bits_unused member */ +#include /* for .bits_unused member */ #include /* * OCTET STRING basic type description. */ static ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2))}; static asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { - sizeof(OCTET_STRING_t), - offsetof(OCTET_STRING_t, _asn_ctx), - ASN_OSUBV_STR -}; + sizeof(OCTET_STRING_t), offsetof(OCTET_STRING_t, _asn_ctx), ASN_OSUBV_STR}; static asn_per_constraints_t ASN_DEF_OCTET_STRING_CONSTRAINTS = { - { APC_CONSTRAINED, 8, 8, 0, 255 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, - 0, 0 -}; + {APC_CONSTRAINED, 8, 8, 0, 255}, + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { - "OCTET STRING", /* Canonical name */ - "OCTET_STRING", /* XML tag name */ + "OCTET STRING", /* Canonical name */ + "OCTET_STRING", /* XML tag name */ OCTET_STRING_free, - OCTET_STRING_print, /* non-ascii stuff, generally */ + OCTET_STRING_print, /* non-ascii stuff, generally */ asn_generic_no_constraint, OCTET_STRING_decode_ber, OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, - OCTET_STRING_decode_uper, /* Unaligned PER decoder */ - OCTET_STRING_encode_uper, /* Unaligned PER encoder */ - 0, /* Use generic outmost tag fetcher */ + OCTET_STRING_decode_uper, /* Unaligned PER decoder */ + OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_OCTET_STRING_tags, - sizeof(asn_DEF_OCTET_STRING_tags) - / sizeof(asn_DEF_OCTET_STRING_tags[0]), - asn_DEF_OCTET_STRING_tags, /* Same as above */ - sizeof(asn_DEF_OCTET_STRING_tags) - / sizeof(asn_DEF_OCTET_STRING_tags[0]), - 0, /* No PER visible constraints */ - 0, 0, /* No members */ - &asn_DEF_OCTET_STRING_specs -}; + sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), + asn_DEF_OCTET_STRING_tags, /* Same as above */ + sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), + 0, /* No PER visible constraints */ + 0, + 0, /* No members */ + &asn_DEF_OCTET_STRING_specs}; -#undef _CH_PHASE -#undef NEXT_PHASE -#undef PREV_PHASE -#define _CH_PHASE(ctx, inc) do { \ - if((ctx)->phase == 0) \ - (ctx)->context = 0; \ - (ctx)->phase += (inc); \ - } while(0) -#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) -#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) +#undef _CH_PHASE +#undef NEXT_PHASE +#undef PREV_PHASE +#define _CH_PHASE(ctx, inc) \ + do \ + { \ + if ((ctx)->phase == 0) (ctx)->context = 0; \ + (ctx)->phase += (inc); \ + } \ + while (0) +#define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) +#define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = (num_bytes); \ - buf_ptr = ((const char *)buf_ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) -#undef RETURN -#define RETURN(_code) do { \ - asn_dec_rval_t tmprval; \ - tmprval.code = _code; \ - tmprval.consumed = consumed_myself; \ - return tmprval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + asn_dec_rval_t tmprval; \ + tmprval.code = _code; \ + tmprval.consumed = consumed_myself; \ + return tmprval; \ + } \ + while (0) -#undef APPEND -#define APPEND(bufptr, bufsize) do { \ - size_t _bs = (bufsize); /* Append size */ \ - size_t _ns = ctx->context; /* Allocated now */ \ - size_t _es = st->size + _bs; /* Expected size */ \ - /* int is really a typeof(st->size): */ \ - if((int)_es < 0) RETURN(RC_FAIL); \ - if(_ns <= _es) { \ - void *ptr; \ - /* Be nice and round to the memory allocator */ \ - do { _ns = _ns ? _ns << 1 : 16; } \ - while(_ns <= _es); \ - /* int is really a typeof(st->size): */ \ - if((int)_ns < 0) RETURN(RC_FAIL); \ - ptr = REALLOC(st->buf, _ns); \ - if(ptr) { \ - st->buf = (uint8_t *)ptr; \ - ctx->context = _ns; \ - } else { \ - RETURN(RC_FAIL); \ - } \ - ASN_DEBUG("Reallocating into %ld", (long)_ns); \ - } \ - memcpy(st->buf + st->size, bufptr, _bs); \ - /* Convenient nul-termination */ \ - st->buf[_es] = '\0'; \ - st->size = _es; \ - } while(0) +#undef APPEND +#define APPEND(bufptr, bufsize) \ + do \ + { \ + size_t _bs = (bufsize); /* Append size */ \ + size_t _ns = ctx->context; /* Allocated now */ \ + size_t _es = st->size + _bs; /* Expected size */ \ + /* int is really a typeof(st->size): */ \ + if ((int)_es < 0) RETURN(RC_FAIL); \ + if (_ns <= _es) \ + { \ + void *ptr; \ + /* Be nice and round to the memory allocator */ \ + do \ + { \ + _ns = _ns ? _ns << 1 : 16; \ + } \ + while (_ns <= _es); \ + /* int is really a typeof(st->size): */ \ + if ((int)_ns < 0) RETURN(RC_FAIL); \ + ptr = REALLOC(st->buf, _ns); \ + if (ptr) \ + { \ + st->buf = (uint8_t *)ptr; \ + ctx->context = _ns; \ + } \ + else \ + { \ + RETURN(RC_FAIL); \ + } \ + ASN_DEBUG("Reallocating into %ld", (long)_ns); \ + } \ + memcpy(st->buf + st->size, bufptr, _bs); \ + /* Convenient nul-termination */ \ + st->buf[_es] = '\0'; \ + st->size = _es; \ + } \ + while (0) /* * The main reason why ASN.1 is still alive is that too much time and effort @@ -110,403 +122,465 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { * necessity to demonstrate that acquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ -struct _stack_el { - ber_tlv_len_t left; /* What's left to read (or -1) */ - ber_tlv_len_t got; /* What was actually processed */ - int cont_level; /* Depth of subcontainment */ - int want_nulls; /* Want null "end of content" octets? */ - int bits_chopped; /* Flag in BIT STRING mode */ - ber_tlv_tag_t tag; /* For debugging purposes */ +struct _stack_el +{ + ber_tlv_len_t left; /* What's left to read (or -1) */ + ber_tlv_len_t got; /* What was actually processed */ + int cont_level; /* Depth of subcontainment */ + int want_nulls; /* Want null "end of content" octets? */ + int bits_chopped; /* Flag in BIT STRING mode */ + ber_tlv_tag_t tag; /* For debugging purposes */ struct _stack_el *prev; struct _stack_el *next; }; -struct _stack { +struct _stack +{ struct _stack_el *tail; struct _stack_el *cur_ptr; }; -static struct _stack_el * -OS__add_stack_el(struct _stack *st) { +static struct _stack_el *OS__add_stack_el(struct _stack *st) +{ struct _stack_el *nel; /* * Reuse the old stack frame or allocate a new one. */ - if(st->cur_ptr && st->cur_ptr->next) { - nel = st->cur_ptr->next; - nel->bits_chopped = 0; - nel->got = 0; - /* Retain the nel->cont_level, it's correct. */ - } else { - nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); - if(nel == NULL) - return NULL; - - if(st->tail) { - /* Increase a subcontainment depth */ - nel->cont_level = st->tail->cont_level + 1; - st->tail->next = nel; + if (st->cur_ptr && st->cur_ptr->next) + { + nel = st->cur_ptr->next; + nel->bits_chopped = 0; + nel->got = 0; + /* Retain the nel->cont_level, it's correct. */ + } + else + { + nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); + if (nel == NULL) return NULL; + + if (st->tail) + { + /* Increase a subcontainment depth */ + nel->cont_level = st->tail->cont_level + 1; + st->tail->next = nel; + } + nel->prev = st->tail; + st->tail = nel; } - nel->prev = st->tail; - st->tail = nel; - } st->cur_ptr = nel; return nel; } -static struct _stack * -_new_stack() { +static struct _stack *_new_stack() +{ return (struct _stack *)CALLOC(1, sizeof(struct _stack)); } /* * Decode OCTET STRING type. */ -asn_dec_rval_t -OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, const void *buf_ptr, size_t size, int tag_mode) { - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; +asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buf_ptr, size_t size, + int tag_mode) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; asn_dec_rval_t rval; asn_struct_ctx_t *ctx; ssize_t consumed_myself = 0; - struct _stack *stck; /* Expectations stack structure */ - struct _stack_el *sel = 0; /* Stack element */ + struct _stack *stck; /* Expectations stack structure */ + struct _stack_el *sel = 0; /* Stack element */ int tlv_constr; enum asn_OS_Subvariant type_variant = specs->subvariant; - ASN_DEBUG("Decoding %s as %s (frame %ld)", - td->name, - (type_variant == ASN_OSUBV_STR) ? - "OCTET STRING" : "OS-SpecialCase", + ASN_DEBUG( + "Decoding %s as %s (frame %ld)", td->name, + (type_variant == ASN_OSUBV_STR) ? "OCTET STRING" : "OS-SpecialCase", (long)size); /* * Create the string if does not exist. */ - if(st == NULL) { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(st == NULL) RETURN(RC_FAIL); - } + if (st == NULL) + { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if (st == NULL) RETURN(RC_FAIL); + } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - switch(ctx->phase) { - case 0: - /* - * Check tags. - */ - rval = ber_check_tags(opt_codec_ctx, td, ctx, - buf_ptr, size, tag_mode, -1, - &ctx->left, &tlv_constr); - if(rval.code != RC_OK) - return rval; + switch (ctx->phase) + { + case 0: + /* + * Check tags. + */ + rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size, + tag_mode, -1, &ctx->left, &tlv_constr); + if (rval.code != RC_OK) return rval; - if(tlv_constr) { - /* - * Complex operation, requires stack of expectations. - */ - ctx->ptr = _new_stack(); - if(ctx->ptr) { + if (tlv_constr) + { + /* + * Complex operation, requires stack of expectations. + */ + ctx->ptr = _new_stack(); + if (ctx->ptr) + { + stck = (struct _stack *)ctx->ptr; + } + else + { + RETURN(RC_FAIL); + } + } + else + { + /* + * Jump into stackless primitive decoding. + */ + _CH_PHASE(ctx, 3); + if (type_variant == ASN_OSUBV_ANY && tag_mode != 1) + APPEND(buf_ptr, rval.consumed); + ADVANCE(rval.consumed); + goto phase3; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + phase1: + /* + * Fill the stack with expectations. + */ stck = (struct _stack *)ctx->ptr; - } else { - RETURN(RC_FAIL); - } - } else { - /* - * Jump into stackless primitive decoding. - */ - _CH_PHASE(ctx, 3); - if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) - APPEND(buf_ptr, rval.consumed); - ADVANCE(rval.consumed); - goto phase3; - } + sel = stck->cur_ptr; + do + { + ber_tlv_tag_t tlv_tag; + ber_tlv_len_t tlv_len; + ber_tlv_tag_t expected_tag; + ssize_t tl; + ssize_t ll; + ssize_t tlvl; + /* This one works even if (sel->left == -1) */ + ssize_t Left = + ((!sel || (size_t)sel->left >= size) ? (ssize_t)size + : sel->left); - NEXT_PHASE(ctx); - /* Fall through */ - case 1: - phase1: - /* - * Fill the stack with expectations. - */ - stck = (struct _stack *)ctx->ptr; - sel = stck->cur_ptr; - do { - ber_tlv_tag_t tlv_tag; - ber_tlv_len_t tlv_len; - ber_tlv_tag_t expected_tag; - ssize_t tl; - ssize_t ll; - ssize_t tlvl; - /* This one works even if (sel->left == -1) */ - ssize_t Left = ((!sel||(size_t)sel->left >= size) - ?(ssize_t)size:sel->left); + ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, + (sel ? sel->left : 0), + (long)(sel ? sel->want_nulls : 0), + (sel ? sel->got : 0)); + if (sel && sel->left <= 0 && sel->want_nulls == 0) + { + if (sel->prev) + { + struct _stack_el *prev = sel->prev; + if (prev->left != -1) + { + if (prev->left < sel->got) + RETURN(RC_FAIL); + prev->left -= sel->got; + } + prev->got += sel->got; + sel = stck->cur_ptr = prev; + if (!sel) break; + tlv_constr = 1; + continue; + } + else + { + sel = stck->cur_ptr = 0; + break; /* Nothing to wait */ + } + } + tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); + ASN_DEBUG( + "fetch tag(size=%ld,L=%ld), %sstack, left=%ld, " + "wn=%ld, " + "tl=%ld", + (long)size, (long)Left, sel ? "" : "!", + (sel ? sel->left : 0), + (long)(sel ? sel->want_nulls : 0), (long)tl); + switch (tl) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } - ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, - (sel?sel->left:0), - (long)(sel?sel->want_nulls:0), - (sel?sel->got:0) - ); - if(sel && sel->left <= 0 && sel->want_nulls == 0) { - if(sel->prev) { - struct _stack_el *prev = sel->prev; - if(prev->left != -1) { - if(prev->left < sel->got) - RETURN(RC_FAIL); - prev->left -= sel->got; + tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); + + ll = ber_fetch_length(tlv_constr, + (const char *)buf_ptr + tl, + Left - tl, &tlv_len); + ASN_DEBUG( + "Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, " + "ll=%ld", + ber_tlv_tag_string(tlv_tag), tlv_constr, (long)Left, + (long)tl, (long)tlv_len, (long)ll); + switch (ll) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + + if (sel && sel->want_nulls && + ((const uint8_t *)buf_ptr)[0] == 0 && + ((const uint8_t *)buf_ptr)[1] == 0) + { + ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); + + if (type_variant == ASN_OSUBV_ANY && + (tag_mode != 1 || sel->cont_level)) + APPEND("\0\0", 2); + + ADVANCE(2); + sel->got += 2; + if (sel->left != -1) + { + sel->left -= + 2; /* assert(sel->left >= 2) */ + } + + sel->want_nulls--; + if (sel->want_nulls == 0) + { + /* Move to the next expectation */ + sel->left = 0; + tlv_constr = 1; + } + + continue; + } + + /* + * Set up expected tags, + * depending on ASN.1 type being decoded. + */ + switch (type_variant) + { + case ASN_OSUBV_BIT: + /* X.690: 8.6.4.1, NOTE 2 */ + /* Fall through */ + case ASN_OSUBV_STR: + default: + if (sel) + { + int level = sel->cont_level; + if (level < td->all_tags_count) + { + expected_tag = + td->all_tags[level]; + break; + } + else if (td->all_tags_count) + { + expected_tag = + td->all_tags + [td->all_tags_count - + 1]; + break; + } + /* else, Fall through */ + } + /* Fall through */ + case ASN_OSUBV_ANY: + expected_tag = tlv_tag; + break; + } + + if (tlv_tag != expected_tag) + { + char buf[2][32]; + ber_tlv_tag_snprint(tlv_tag, buf[0], + sizeof(buf[0])); + ber_tlv_tag_snprint( + td->tags[td->tags_count - 1], buf[1], + sizeof(buf[1])); + ASN_DEBUG( + "Tag does not match expectation: %s != %s", + buf[0], buf[1]); + RETURN(RC_FAIL); + } + + tlvl = + tl + ll; /* Combined length of T and L encoding */ + if ((tlv_len + tlvl) < 0) + { + /* tlv_len value is too big */ + ASN_DEBUG( + "TLV encoding + length (%ld) is too big", + (long)tlv_len); + RETURN(RC_FAIL); + } + + /* + * Append a new expectation. + */ + sel = OS__add_stack_el(stck); + if (!sel) RETURN(RC_FAIL); + + sel->tag = tlv_tag; + + sel->want_nulls = (tlv_len == -1); + if (sel->prev && sel->prev->left != -1) + { + /* Check that the parent frame is big enough */ + if (sel->prev->left < + tlvl + (tlv_len == -1 ? 0 : tlv_len)) + RETURN(RC_FAIL); + if (tlv_len == -1) + sel->left = sel->prev->left - tlvl; + else + sel->left = tlv_len; + } + else + { + sel->left = tlv_len; + } + if (type_variant == ASN_OSUBV_ANY && + (tag_mode != 1 || sel->cont_level)) + APPEND(buf_ptr, tlvl); + sel->got += tlvl; + ADVANCE(tlvl); + + ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", + (long)sel->got, (long)sel->left, + sel->want_nulls, sel->cont_level); + } + while (tlv_constr); + if (sel == NULL) + { + /* Finished operation, "phase out" */ + ASN_DEBUG("Phase out"); + _CH_PHASE(ctx, +3); + break; + } + + NEXT_PHASE(ctx); + /* Fall through */ + case 2: + stck = (struct _stack *)ctx->ptr; + sel = stck->cur_ptr; + ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", + (long)sel->left, (long)size, (long)sel->got, + sel->want_nulls); + { + ber_tlv_len_t len; + + assert(sel->left >= 0); + + len = ((ber_tlv_len_t)size < sel->left) + ? (ber_tlv_len_t)size + : sel->left; + if (len > 0) + { + if (type_variant == ASN_OSUBV_BIT && + sel->bits_chopped == 0) + { + /* Put the unused-bits-octet away */ + st->bits_unused = *(const uint8_t *)buf_ptr; + APPEND(((const char *)buf_ptr + 1), + (len - 1)); + sel->bits_chopped = 1; + } + else + { + APPEND(buf_ptr, len); + } + ADVANCE(len); + sel->left -= len; + sel->got += len; + } + + if (sel->left) + { + ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", + (long)sel->left, (long)size, + sel->want_nulls); + RETURN(RC_WMORE); + } + + PREV_PHASE(ctx); + goto phase1; } - prev->got += sel->got; - sel = stck->cur_ptr = prev; - if(!sel) break; - tlv_constr = 1; - continue; - } else { - sel = stck->cur_ptr = 0; - break; /* Nothing to wait */ - } + break; + case 3: + phase3: + /* + * Primitive form, no stack required. + */ + assert(ctx->left >= 0); + + if (size < (size_t)ctx->left) + { + if (!size) RETURN(RC_WMORE); + if (type_variant == ASN_OSUBV_BIT && !ctx->context) + { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, size); + assert(ctx->context > 0); + ctx->left -= size; + ADVANCE(size); + RETURN(RC_WMORE); + } + else + { + if (type_variant == ASN_OSUBV_BIT && !ctx->context && + ctx->left) + { + st->bits_unused = *(const uint8_t *)buf_ptr; + ctx->left--; + ADVANCE(1); + } + APPEND(buf_ptr, ctx->left); + ADVANCE(ctx->left); + ctx->left = 0; + + NEXT_PHASE(ctx); + } + break; } - tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); - ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", - (long)size, (long)Left, sel?"":"!", - (sel?sel->left:0), - (long)(sel?sel->want_nulls:0), - (long)tl); - switch(tl) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); - - ll = ber_fetch_length(tlv_constr, - (const char *)buf_ptr + tl,Left - tl,&tlv_len); - ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", - ber_tlv_tag_string(tlv_tag), tlv_constr, - (long)Left, (long)tl, (long)tlv_len, (long)ll); - switch(ll) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - if(sel && sel->want_nulls - && ((const uint8_t *)buf_ptr)[0] == 0 - && ((const uint8_t *)buf_ptr)[1] == 0) + if (sel) { - - ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); - - if(type_variant == ASN_OSUBV_ANY - && (tag_mode != 1 || sel->cont_level)) - APPEND("\0\0", 2); - - ADVANCE(2); - sel->got += 2; - if(sel->left != -1) { - sel->left -= 2; /* assert(sel->left >= 2) */ - } - - sel->want_nulls--; - if(sel->want_nulls == 0) { - /* Move to the next expectation */ - sel->left = 0; - tlv_constr = 1; - } - - continue; - } - - /* - * Set up expected tags, - * depending on ASN.1 type being decoded. - */ - switch(type_variant) { - case ASN_OSUBV_BIT: - /* X.690: 8.6.4.1, NOTE 2 */ - /* Fall through */ - case ASN_OSUBV_STR: - default: - if(sel) { - int level = sel->cont_level; - if(level < td->all_tags_count) { - expected_tag = td->all_tags[level]; - break; - } else if(td->all_tags_count) { - expected_tag = td->all_tags - [td->all_tags_count - 1]; - break; + ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", sel->prev, + sel->want_nulls, (long)sel->left, (long)sel->got, + (long)size); + if (sel->prev || sel->want_nulls > 1 || sel->left > 0) + { + RETURN(RC_WMORE); } - /* else, Fall through */ - } - /* Fall through */ - case ASN_OSUBV_ANY: - expected_tag = tlv_tag; - break; } - - if(tlv_tag != expected_tag) { - char buf[2][32]; - ber_tlv_tag_snprint(tlv_tag, - buf[0], sizeof(buf[0])); - ber_tlv_tag_snprint(td->tags[td->tags_count-1], - buf[1], sizeof(buf[1])); - ASN_DEBUG("Tag does not match expectation: %s != %s", - buf[0], buf[1]); - RETURN(RC_FAIL); - } - - tlvl = tl + ll; /* Combined length of T and L encoding */ - if((tlv_len + tlvl) < 0) { - /* tlv_len value is too big */ - ASN_DEBUG("TLV encoding + length (%ld) is too big", - (long)tlv_len); - RETURN(RC_FAIL); - } - - /* - * Append a new expectation. - */ - sel = OS__add_stack_el(stck); - if(!sel) RETURN(RC_FAIL); - - sel->tag = tlv_tag; - - sel->want_nulls = (tlv_len==-1); - if(sel->prev && sel->prev->left != -1) { - /* Check that the parent frame is big enough */ - if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) - RETURN(RC_FAIL); - if(tlv_len == -1) - sel->left = sel->prev->left - tlvl; - else - sel->left = tlv_len; - } else { - sel->left = tlv_len; - } - if(type_variant == ASN_OSUBV_ANY - && (tag_mode != 1 || sel->cont_level)) - APPEND(buf_ptr, tlvl); - sel->got += tlvl; - ADVANCE(tlvl); - - ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", - (long)sel->got, (long)sel->left, - sel->want_nulls, sel->cont_level); - - } while(tlv_constr); - if(sel == NULL) { - /* Finished operation, "phase out" */ - ASN_DEBUG("Phase out"); - _CH_PHASE(ctx, +3); - break; - } - - NEXT_PHASE(ctx); - /* Fall through */ - case 2: - stck = (struct _stack *)ctx->ptr; - sel = stck->cur_ptr; - ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", - (long)sel->left, (long)size, (long)sel->got, - sel->want_nulls); - { - ber_tlv_len_t len; - - assert(sel->left >= 0); - - len = ((ber_tlv_len_t)size < sel->left) - ? (ber_tlv_len_t)size : sel->left; - if(len > 0) { - if(type_variant == ASN_OSUBV_BIT - && sel->bits_chopped == 0) { - /* Put the unused-bits-octet away */ - st->bits_unused = *(const uint8_t *)buf_ptr; - APPEND(((const char *)buf_ptr+1), (len - 1)); - sel->bits_chopped = 1; - } else { - APPEND(buf_ptr, len); - } - ADVANCE(len); - sel->left -= len; - sel->got += len; - } - - if(sel->left) { - ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", - (long)sel->left, (long)size, sel->want_nulls); - RETURN(RC_WMORE); - } - - PREV_PHASE(ctx); - goto phase1; - } - break; - case 3: - phase3: - /* - * Primitive form, no stack required. - */ - assert(ctx->left >= 0); - - if(size < (size_t)ctx->left) { - if(!size) RETURN(RC_WMORE); - if(type_variant == ASN_OSUBV_BIT && !ctx->context) { - st->bits_unused = *(const uint8_t *)buf_ptr; - ctx->left--; - ADVANCE(1); - } - APPEND(buf_ptr, size); - assert(ctx->context > 0); - ctx->left -= size; - ADVANCE(size); - RETURN(RC_WMORE); - } else { - if(type_variant == ASN_OSUBV_BIT - && !ctx->context && ctx->left) { - st->bits_unused = *(const uint8_t *)buf_ptr; - ctx->left--; - ADVANCE(1); - } - APPEND(buf_ptr, ctx->left); - ADVANCE(ctx->left); - ctx->left = 0; - - NEXT_PHASE(ctx); - } - break; - } - - if(sel) { - ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", - sel->prev, sel->want_nulls, - (long)sel->left, (long)sel->got, (long)size); - if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { - RETURN(RC_WMORE); - } - } - /* * BIT STRING-specific processing. */ - if(type_variant == ASN_OSUBV_BIT && st->size) { - /* Finalize BIT STRING: zero out unused bits. */ - st->buf[st->size-1] &= 0xff << st->bits_unused; - } - - ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", - (long)consumed_myself, td->name, - (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", - (long)st->size); + if (type_variant == ASN_OSUBV_BIT && st->size) + { + /* Finalize BIT STRING: zero out unused bits. */ + st->buf[st->size - 1] &= 0xff << st->bits_unused; + } + ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", (long)consumed_myself, + td->name, + (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", + (long)st->size); RETURN(RC_OK); } @@ -514,63 +588,70 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * Encode OCTET STRING type using DER. */ -asn_enc_rval_t -OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_enc_rval_t er; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)sptr; enum asn_OS_Subvariant type_variant = specs->subvariant; int fix_last_byte = 0; - ASN_DEBUG("%s %s as OCTET STRING", - cb?"Estimating":"Encoding", td->name); + ASN_DEBUG("%s %s as OCTET STRING", cb ? "Estimating" : "Encoding", + td->name); /* * Write tags. */ - if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { - er.encoded = der_write_tags(td, - (type_variant == ASN_OSUBV_BIT) + st->size, - tag_mode, type_variant == ASN_OSUBV_ANY, tag, - cb, app_key); - if(er.encoded == -1) { - er.failed_type = td; - er.structure_ptr = sptr; - return er; + if (type_variant != ASN_OSUBV_ANY || tag_mode == 1) + { + er.encoded = der_write_tags( + td, (type_variant == ASN_OSUBV_BIT) + st->size, tag_mode, + type_variant == ASN_OSUBV_ANY, tag, cb, app_key); + if (er.encoded == -1) + { + er.failed_type = td; + er.structure_ptr = sptr; + return er; + } + } + else + { + /* Disallow: [] IMPLICIT ANY */ + assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); + er.encoded = 0; } - } else { - /* Disallow: [] IMPLICIT ANY */ - assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); - er.encoded = 0; - } - if(!cb) { - er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; - _ASN_ENCODED_OK(er); - } + if (!cb) + { + er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; + _ASN_ENCODED_OK(er); + } /* * Prepare to deal with the last octet of BIT STRING. */ - if(type_variant == ASN_OSUBV_BIT) { - uint8_t b = st->bits_unused & 0x07; - if(b && st->size) fix_last_byte = 1; - _ASN_CALLBACK(&b, 1); - er.encoded++; - } + if (type_variant == ASN_OSUBV_BIT) + { + uint8_t b = st->bits_unused & 0x07; + if (b && st->size) fix_last_byte = 1; + _ASN_CALLBACK(&b, 1); + er.encoded++; + } /* Invoke callback for the main part of the buffer */ _ASN_CALLBACK(st->buf, st->size - fix_last_byte); /* The last octet should be stripped off the unused bits */ - if(fix_last_byte) { - uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); - _ASN_CALLBACK(&b, 1); - } + if (fix_last_byte) + { + uint8_t b = st->buf[st->size - 1] & (0xff << st->bits_unused); + _ASN_CALLBACK(&b, 1); + } er.encoded += st->size; _ASN_ENCODED_OK(er); @@ -578,10 +659,12 @@ cb_failed: _ASN_ENCODE_FAILED; } -asn_enc_rval_t -OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; @@ -591,8 +674,7 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, uint8_t *end; size_t i; - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; er.encoded = 0; @@ -601,101 +683,129 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, */ buf = st->buf; end = buf + st->size; - if(flags & XER_F_CANONICAL) { - char *scend = scratch + (sizeof(scratch) - 2); - for(; buf < end; buf++) { - if(p >= scend) { - _ASN_CALLBACK(scratch, p - scratch); - er.encoded += p - scratch; - p = scratch; - } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - } + if (flags & XER_F_CANONICAL) + { + char *scend = scratch + (sizeof(scratch) - 2); + for (; buf < end; buf++) + { + if (p >= scend) + { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += p - scratch; + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + } - _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ - er.encoded += p - scratch; - } else { - for(i = 0; buf < end; buf++, i++) { - if(!(i % 16) && (i || st->size > 16)) { - _ASN_CALLBACK(scratch, p-scratch); - er.encoded += (p-scratch); - p = scratch; - _i_ASN_TEXT_INDENT(1, ilevel); - } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - if(p - scratch) { - p--; /* Remove the tail space */ - _ASN_CALLBACK(scratch, p-scratch); /* Dump the rest */ + _ASN_CALLBACK(scratch, p - scratch); /* Dump the rest */ er.encoded += p - scratch; - if(st->size > 16) - _i_ASN_TEXT_INDENT(1, ilevel-1); } - } + else + { + for (i = 0; buf < end; buf++, i++) + { + if (!(i % 16) && (i || st->size > 16)) + { + _ASN_CALLBACK(scratch, p - scratch); + er.encoded += (p - scratch); + p = scratch; + _i_ASN_TEXT_INDENT(1, ilevel); + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; + } + if (p - scratch) + { + p--; /* Remove the tail space */ + _ASN_CALLBACK(scratch, p - scratch); /* Dump the rest */ + er.encoded += p - scratch; + if (st->size > 16) _i_ASN_TEXT_INDENT(1, ilevel - 1); + } + } _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -static struct OCTET_STRING__xer_escape_table_s { +static struct OCTET_STRING__xer_escape_table_s +{ char *string; int size; } OCTET_STRING__xer_escape_table[] = { -#define OSXET(s) { s, sizeof(s) - 1 } - OSXET("\074\156\165\154\057\076"), /* */ - OSXET("\074\163\157\150\057\076"), /* */ - OSXET("\074\163\164\170\057\076"), /* */ - OSXET("\074\145\164\170\057\076"), /* */ - OSXET("\074\145\157\164\057\076"), /* */ - OSXET("\074\145\156\161\057\076"), /* */ - OSXET("\074\141\143\153\057\076"), /* */ - OSXET("\074\142\145\154\057\076"), /* */ - OSXET("\074\142\163\057\076"), /* */ - OSXET("\011"), /* \t */ - OSXET("\012"), /* \n */ - OSXET("\074\166\164\057\076"), /* */ - OSXET("\074\146\146\057\076"), /* */ - OSXET("\015"), /* \r */ - OSXET("\074\163\157\057\076"), /* */ - OSXET("\074\163\151\057\076"), /* */ - OSXET("\074\144\154\145\057\076"), /* */ - OSXET("\074\144\143\061\057\076"), /* */ - OSXET("\074\144\143\062\057\076"), /* */ - OSXET("\074\144\143\063\057\076"), /* */ - OSXET("\074\144\143\064\057\076"), /* */ - OSXET("\074\156\141\153\057\076"), /* */ - OSXET("\074\163\171\156\057\076"), /* */ - OSXET("\074\145\164\142\057\076"), /* */ - OSXET("\074\143\141\156\057\076"), /* */ - OSXET("\074\145\155\057\076"), /* */ - OSXET("\074\163\165\142\057\076"), /* */ - OSXET("\074\145\163\143\057\076"), /* */ - OSXET("\074\151\163\064\057\076"), /* */ - OSXET("\074\151\163\063\057\076"), /* */ - OSXET("\074\151\163\062\057\076"), /* */ - OSXET("\074\151\163\061\057\076"), /* */ - { 0, 0 }, /* " " */ - { 0, 0 }, /* ! */ - { 0, 0 }, /* \" */ - { 0, 0 }, /* # */ - { 0, 0 }, /* $ */ - { 0, 0 }, /* % */ - OSXET("\046\141\155\160\073"), /* & */ - { 0, 0 }, /* ' */ - {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ - {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ - {0,0},{0,0},{0,0},{0,0}, /* 89:; */ - OSXET("\046\154\164\073"), /* < */ - { 0, 0 }, /* = */ - OSXET("\046\147\164\073"), /* > */ +#define OSXET(s) \ + { \ + s, sizeof(s) - 1 \ + } + OSXET("\074\156\165\154\057\076"), /* */ + OSXET("\074\163\157\150\057\076"), /* */ + OSXET("\074\163\164\170\057\076"), /* */ + OSXET("\074\145\164\170\057\076"), /* */ + OSXET("\074\145\157\164\057\076"), /* */ + OSXET("\074\145\156\161\057\076"), /* */ + OSXET("\074\141\143\153\057\076"), /* */ + OSXET("\074\142\145\154\057\076"), /* */ + OSXET("\074\142\163\057\076"), /* */ + OSXET("\011"), /* \t */ + OSXET("\012"), /* \n */ + OSXET("\074\166\164\057\076"), /* */ + OSXET("\074\146\146\057\076"), /* */ + OSXET("\015"), /* \r */ + OSXET("\074\163\157\057\076"), /* */ + OSXET("\074\163\151\057\076"), /* */ + OSXET("\074\144\154\145\057\076"), /* */ + OSXET("\074\144\143\061\057\076"), /* */ + OSXET("\074\144\143\062\057\076"), /* */ + OSXET("\074\144\143\063\057\076"), /* */ + OSXET("\074\144\143\064\057\076"), /* */ + OSXET("\074\156\141\153\057\076"), /* */ + OSXET("\074\163\171\156\057\076"), /* */ + OSXET("\074\145\164\142\057\076"), /* */ + OSXET("\074\143\141\156\057\076"), /* */ + OSXET("\074\145\155\057\076"), /* */ + OSXET("\074\163\165\142\057\076"), /* */ + OSXET("\074\145\163\143\057\076"), /* */ + OSXET("\074\151\163\064\057\076"), /* */ + OSXET("\074\151\163\063\057\076"), /* */ + OSXET("\074\151\163\062\057\076"), /* */ + OSXET("\074\151\163\061\057\076"), /* */ + {0, 0}, /* " " */ + {0, 0}, /* ! */ + {0, 0}, /* \" */ + {0, 0}, /* # */ + {0, 0}, /* $ */ + {0, 0}, /* % */ + OSXET("\046\141\155\160\073"), /* & */ + {0, 0}, /* ' */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* ()*+,-./ */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* 01234567 */ + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, /* 89:; */ + OSXET("\046\154\164\073"), /* < */ + {0, 0}, /* = */ + OSXET("\046\147\164\073"), /* > */ }; -static int -OS__check_escaped_control_char(const void *buf, int size) { +static int OS__check_escaped_control_char(const void *buf, int size) +{ size_t i; /* * Inefficient algorithm which translates the escape sequences @@ -703,78 +813,85 @@ OS__check_escaped_control_char(const void *buf, int size) { * TODO: replace by a faster algorithm (bsearch(), hash or * nested table lookups). */ - for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { - struct OCTET_STRING__xer_escape_table_s *el; - el = &OCTET_STRING__xer_escape_table[i]; - if(el->size == size && memcmp(buf, el->string, size) == 0) - return i; - } + for (i = 0; i < 32 /* Don't spend time on the bottom half */; i++) + { + struct OCTET_STRING__xer_escape_table_s *el; + el = &OCTET_STRING__xer_escape_table[i]; + if (el->size == size && memcmp(buf, el->string, size) == 0) + return i; + } return -1; } -static int -OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { +static int OCTET_STRING__handle_control_chars(void *struct_ptr, + const void *chunk_buf, + size_t chunk_size) +{ /* * This might be one of the escape sequences * for control characters. Check it out. * #11.15.5 */ - int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); - if(control_char >= 0) { - OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; - void *p = REALLOC(st->buf, st->size + 2); - if(p) { - st->buf = (uint8_t *)p; - st->buf[st->size++] = control_char; - st->buf[st->size] = '\0'; /* nul-termination */ - return 0; + int control_char = OS__check_escaped_control_char(chunk_buf, chunk_size); + if (control_char >= 0) + { + OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; + void *p = REALLOC(st->buf, st->size + 2); + if (p) + { + st->buf = (uint8_t *)p; + st->buf[st->size++] = control_char; + st->buf[st->size] = '\0'; /* nul-termination */ + return 0; + } } - } - return -1; /* No, it's not */ + return -1; /* No, it's not */ } -asn_enc_rval_t -OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, + void *sptr, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; uint8_t *buf; uint8_t *end; - uint8_t *ss; /* Sequence start */ + uint8_t *ss; /* Sequence start */ ssize_t encoded_len = 0; - (void)ilevel; /* Unused argument */ - (void)flags; /* Unused argument */ + (void)ilevel; /* Unused argument */ + (void)flags; /* Unused argument */ - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; buf = st->buf; end = buf + st->size; - for(ss = buf; buf < end; buf++) { - unsigned int ch = *buf; - int s_len; /* Special encoding sequence length */ + for (ss = buf; buf < end; buf++) + { + unsigned int ch = *buf; + int s_len; /* Special encoding sequence length */ - /* - * Escape certain characters: X.680/11.15 - */ - if(ch < sizeof(OCTET_STRING__xer_escape_table) - /sizeof(OCTET_STRING__xer_escape_table[0]) - && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { - if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) - || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, - app_key) < 0) - _ASN_ENCODE_FAILED; - encoded_len += (buf - ss) + s_len; - ss = buf + 1; + /* + * Escape certain characters: X.680/11.15 + */ + if (ch < sizeof(OCTET_STRING__xer_escape_table) / + sizeof(OCTET_STRING__xer_escape_table[0]) && + (s_len = OCTET_STRING__xer_escape_table[ch].size)) + { + if (((buf - ss) && cb(ss, buf - ss, app_key) < 0) || + cb(OCTET_STRING__xer_escape_table[ch].string, s_len, + app_key) < 0) + _ASN_ENCODE_FAILED; + encoded_len += (buf - ss) + s_len; + ss = buf + 1; + } } - } encoded_len += (buf - ss); - if((buf - ss) && cb(ss, buf - ss, app_key) < 0) - _ASN_ENCODE_FAILED; + if ((buf - ss) && cb(ss, buf - ss, app_key) < 0) _ASN_ENCODE_FAILED; er.encoded = encoded_len; _ASN_ENCODED_OK(er); @@ -783,19 +900,23 @@ OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, /* * Convert from hexadecimal format (cstring): "AB CD EF" */ -static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, + const void *chunk_buf, + size_t chunk_size, + int have_more) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *chunk_stop = (const char *)chunk_buf; const char *p = chunk_stop; const char *pend = p + chunk_size; unsigned int clv = 0; - int half = 0; /* Half bit */ + int half = 0; /* Half bit */ uint8_t *buf; /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 1) / 2; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; @@ -804,63 +925,91 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b * converted, and the rest skipped. That is, unless buf_size is greater * than chunk_size, then it'll be equivalent to "ABC0". */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - switch(ch) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* Ignore whitespace */ - continue; - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ - clv = (clv << 4) + (ch - 0x30); - break; - case 0x41: case 0x42: case 0x43: /* ABC */ - case 0x44: case 0x45: case 0x46: /* DEF */ - clv = (clv << 4) + (ch - 0x41 + 10); - break; - case 0x61: case 0x62: case 0x63: /* abc */ - case 0x64: case 0x65: case 0x66: /* def */ - clv = (clv << 4) + (ch - 0x61 + 10); - break; - default: - *buf = 0; /* JIC */ - return -1; + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + switch (ch) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* Ignore whitespace */ + continue; + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: /*01234*/ + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: /*56789*/ + clv = (clv << 4) + (ch - 0x30); + break; + case 0x41: + case 0x42: + case 0x43: /* ABC */ + case 0x44: + case 0x45: + case 0x46: /* DEF */ + clv = (clv << 4) + (ch - 0x41 + 10); + break; + case 0x61: + case 0x62: + case 0x63: /* abc */ + case 0x64: + case 0x65: + case 0x66: /* def */ + clv = (clv << 4) + (ch - 0x61 + 10); + break; + default: + *buf = 0; /* JIC */ + return -1; + } + if (half++) + { + half = 0; + *buf++ = clv; + chunk_stop = p + 1; + } } - if(half++) { - half = 0; - *buf++ = clv; - chunk_stop = p + 1; - } - } /* * Check partial decoding. */ - if(half) { - if(have_more) { - /* - * Partial specification is fine, - * because no more more PXER_TEXT data is available. - */ - *buf++ = clv << 4; + if (half) + { + if (have_more) + { + /* + * Partial specification is fine, + * because no more more PXER_TEXT data is available. + */ + *buf++ = clv << 4; + chunk_stop = p; + } + } + else + { chunk_stop = p; } - } else { - chunk_stop = p; - } - st->size = buf - st->buf; /* Adjust the buffer size */ + st->size = buf - st->buf; /* Adjust the buffer size */ assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return (chunk_stop - (const char *)chunk_buf); /* Converted size */ + return (chunk_stop - (const char *)chunk_buf); /* Converted size */ } /* * Convert from binary format: "00101011101" */ -static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, + size_t chunk_size, int have_more) +{ BIT_STRING_t *st = (BIT_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; @@ -870,90 +1019,117 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, s /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 7) / 8; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; (void)have_more; - if(bits_unused == 0) + if (bits_unused == 0) bits_unused = 8; - else if(st->size) + else if (st->size) buf--; /* * Convert series of 0 and 1 into the octet string. */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - switch(ch) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* Ignore whitespace */ - break; - case 0x30: - case 0x31: - if(bits_unused-- <= 0) { - *++buf = 0; /* Clean the cell */ - bits_unused = 7; - } - *buf |= (ch&1) << bits_unused; - break; - default: - st->bits_unused = bits_unused; - return -1; + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + switch (ch) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* Ignore whitespace */ + break; + case 0x30: + case 0x31: + if (bits_unused-- <= 0) + { + *++buf = 0; /* Clean the cell */ + bits_unused = 7; + } + *buf |= (ch & 1) << bits_unused; + break; + default: + st->bits_unused = bits_unused; + return -1; + } } - } - if(bits_unused == 8) { - st->size = buf - st->buf; - st->bits_unused = 0; - } else { - st->size = buf - st->buf + 1; - st->bits_unused = bits_unused; - } + if (bits_unused == 8) + { + st->size = buf - st->buf; + st->bits_unused = 0; + } + else + { + st->size = buf - st->buf + 1; + st->bits_unused = bits_unused; + } assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return chunk_size; /* Converted in full */ + return chunk_size; /* Converted in full */ } /* * Something like strtod(), but with stricter rules. */ -static int -OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { +static int OS__strtoent(int base, const char *buf, const char *end, + int32_t *ret_value) +{ int32_t val = 0; const char *p; - for(p = buf; p < end; p++) { - int ch = *p; + for (p = buf; p < end; p++) + { + int ch = *p; - /* Strange huge value */ - if((val * base + base) < 0) - return -1; + /* Strange huge value */ + if ((val * base + base) < 0) return -1; - switch(ch) { - case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ - case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ - val = val * base + (ch - 0x30); - break; - case 0x41: case 0x42: case 0x43: /* ABC */ - case 0x44: case 0x45: case 0x46: /* DEF */ - val = val * base + (ch - 0x41 + 10); - break; - case 0x61: case 0x62: case 0x63: /* abc */ - case 0x64: case 0x65: case 0x66: /* def */ - val = val * base + (ch - 0x61 + 10); - break; - case 0x3b: /* ';' */ - *ret_value = val; - return (p - buf) + 1; - default: - return -1; /* Character set error */ + switch (ch) + { + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: /*01234*/ + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: /*56789*/ + val = val * base + (ch - 0x30); + break; + case 0x41: + case 0x42: + case 0x43: /* ABC */ + case 0x44: + case 0x45: + case 0x46: /* DEF */ + val = val * base + (ch - 0x41 + 10); + break; + case 0x61: + case 0x62: + case 0x63: /* abc */ + case 0x64: + case 0x65: + case 0x66: /* def */ + val = val * base + (ch - 0x61 + 10); + break; + case 0x3b: /* ';' */ + *ret_value = val; + return (p - buf) + 1; + default: + return -1; /* Character set error */ + } } - } *ret_value = -1; return (p - buf); @@ -962,7 +1138,9 @@ OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { /* * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" */ -static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, + size_t chunk_size, int have_more) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; @@ -971,185 +1149,216 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, /* Reallocate buffer */ ssize_t _ns = st->size + chunk_size; void *nptr = REALLOC(st->buf, _ns + 1); - if(!nptr) return -1; + if (!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; /* * Convert series of 0 and 1 into the octet string. */ - for(; p < pend; p++) { - int ch = *(const unsigned char *)p; - int len; /* Length of the rest of the chunk */ + for (; p < pend; p++) + { + int ch = *(const unsigned char *)p; + int len; /* Length of the rest of the chunk */ - if(ch != 0x26 /* '&' */) { - *buf++ = ch; - continue; /* That was easy... */ - } + if (ch != 0x26 /* '&' */) + { + *buf++ = ch; + continue; /* That was easy... */ + } - /* - * Process entity reference. - */ - len = chunk_size - (p - (const char *)chunk_buf); - if(len == 1 /* "&" */) goto want_more; - if(p[1] == 0x23 /* '#' */) { - const char *pval; /* Pointer to start of digits */ - int32_t val = 0; /* Entity reference value */ - int base; + /* + * Process entity reference. + */ + len = chunk_size - (p - (const char *)chunk_buf); + if (len == 1 /* "&" */) goto want_more; + if (p[1] == 0x23 /* '#' */) + { + const char *pval; /* Pointer to start of digits */ + int32_t val = 0; /* Entity reference value */ + int base; - if(len == 2 /* "&#" */) goto want_more; - if(p[2] == 0x78 /* 'x' */) - pval = p + 3, base = 16; + if (len == 2 /* "&#" */) goto want_more; + if (p[2] == 0x78 /* 'x' */) + pval = p + 3, base = 16; + else + pval = p + 2, base = 10; + len = OS__strtoent(base, pval, p + len, &val); + if (len == -1) + { + /* Invalid charset. Just copy verbatim. */ + *buf++ = ch; + continue; + } + if (!len || pval[len - 1] != 0x3b) goto want_more; + assert(val > 0); + p += (pval - p) + len - 1; /* Advance past entref */ + + if (val < 0x80) + { + *buf++ = (char)val; + } + else if (val < 0x800) + { + *buf++ = 0xc0 | ((val >> 6)); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x10000) + { + *buf++ = 0xe0 | ((val >> 12)); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x200000) + { + *buf++ = 0xf0 | ((val >> 18)); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else if (val < 0x4000000) + { + *buf++ = 0xf8 | ((val >> 24)); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + else + { + *buf++ = 0xfc | ((val >> 30) & 0x1); + *buf++ = 0x80 | ((val >> 24) & 0x3f); + *buf++ = 0x80 | ((val >> 18) & 0x3f); + *buf++ = 0x80 | ((val >> 12) & 0x3f); + *buf++ = 0x80 | ((val >> 6) & 0x3f); + *buf++ = 0x80 | ((val & 0x3f)); + } + } else - pval = p + 2, base = 10; - len = OS__strtoent(base, pval, p + len, &val); - if(len == -1) { - /* Invalid charset. Just copy verbatim. */ - *buf++ = ch; - continue; - } - if(!len || pval[len-1] != 0x3b) goto want_more; - assert(val > 0); - p += (pval - p) + len - 1; /* Advance past entref */ - - if(val < 0x80) { - *buf++ = (char)val; - } else if(val < 0x800) { - *buf++ = 0xc0 | ((val >> 6)); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x10000) { - *buf++ = 0xe0 | ((val >> 12)); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x200000) { - *buf++ = 0xf0 | ((val >> 18)); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else if(val < 0x4000000) { - *buf++ = 0xf8 | ((val >> 24)); - *buf++ = 0x80 | ((val >> 18) & 0x3f); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } else { - *buf++ = 0xfc | ((val >> 30) & 0x1); - *buf++ = 0x80 | ((val >> 24) & 0x3f); - *buf++ = 0x80 | ((val >> 18) & 0x3f); - *buf++ = 0x80 | ((val >> 12) & 0x3f); - *buf++ = 0x80 | ((val >> 6) & 0x3f); - *buf++ = 0x80 | ((val & 0x3f)); - } - } else { - /* - * Ugly, limited parsing of & > < - */ - char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); - if(!sc) goto want_more; - if((sc - p) == 4 - && p[1] == 0x61 /* 'a' */ - && p[2] == 0x6d /* 'm' */ - && p[3] == 0x70 /* 'p' */) { - *buf++ = 0x26; - p = sc; - continue; - } - if((sc - p) == 3) { - if(p[1] == 0x6c) { - *buf = 0x3c; /* '<' */ - } else if(p[1] == 0x67) { - *buf = 0x3e; /* '>' */ - } else { + { + /* + * Ugly, limited parsing of & > < + */ + char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); + if (!sc) goto want_more; + if ((sc - p) == 4 && p[1] == 0x61 /* 'a' */ + && p[2] == 0x6d /* 'm' */ + && p[3] == 0x70 /* 'p' */) + { + *buf++ = 0x26; + p = sc; + continue; + } + if ((sc - p) == 3) + { + if (p[1] == 0x6c) + { + *buf = 0x3c; /* '<' */ + } + else if (p[1] == 0x67) + { + *buf = 0x3e; /* '>' */ + } + else + { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + if (p[2] != 0x74) + { + /* Unsupported entity reference */ + *buf++ = ch; + continue; + } + buf++; + p = sc; + continue; + } /* Unsupported entity reference */ *buf++ = ch; - continue; } - if(p[2] != 0x74) { - /* Unsupported entity reference */ - *buf++ = ch; - continue; - } - buf++; - p = sc; - continue; - } - /* Unsupported entity reference */ - *buf++ = ch; - } - continue; - want_more: - if(have_more) { - /* - * We know that no more data (of the same type) - * is coming. Copy the rest verbatim. - */ - *buf++ = ch; continue; + want_more: + if (have_more) + { + /* + * We know that no more data (of the same type) + * is coming. Copy the rest verbatim. + */ + *buf++ = ch; + continue; + } + chunk_size = (p - (const char *)chunk_buf); + /* Processing stalled: need more data */ + break; } - chunk_size = (p - (const char *)chunk_buf); - /* Processing stalled: need more data */ - break; - } st->size = buf - st->buf; assert(st->size <= _ns); - st->buf[st->size] = 0; /* Courtesy termination */ + st->buf[st->size] = 0; /* Courtesy termination */ - return chunk_size; /* Converted in full */ + return chunk_size; /* Converted in full */ } /* * Decode OCTET STRING from the XML element's body. */ -static asn_dec_rval_t -OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, +static asn_dec_rval_t OCTET_STRING__decode_xer( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder) - (void *struct_ptr, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver) - (void *struct_ptr, const void *chunk_buf, size_t chunk_size, - int have_more) -) { + int (*opt_unexpected_tag_decoder)(void *struct_ptr, const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_ptr, const void *chunk_buf, + size_t chunk_size, int have_more)) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; - asn_struct_ctx_t *ctx; /* Per-structure parser context */ - asn_dec_rval_t rval; /* Return value from the decoder */ + asn_struct_ctx_t *ctx; /* Per-structure parser context */ + asn_dec_rval_t rval; /* Return value from the decoder */ int st_allocated; /* * Create the string if does not exist. */ - if(!st) { - st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); - *sptr = (void *)st; - if(!st) goto sta_failed; - st_allocated = 1; - } else { - st_allocated = 0; - } - if(!st->buf) { - /* This is separate from above section */ - st->buf = (uint8_t *)CALLOC(1, 1); - if(!st->buf) { - if(st_allocated) { - *sptr = 0; - goto stb_failed; - } else { - goto sta_failed; - } + if (!st) + { + st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); + *sptr = (void *)st; + if (!st) goto sta_failed; + st_allocated = 1; + } + else + { + st_allocated = 0; + } + if (!st->buf) + { + /* This is separate from above section */ + st->buf = (uint8_t *)CALLOC(1, 1); + if (!st->buf) + { + if (st_allocated) + { + *sptr = 0; + goto stb_failed; + } + else + { + goto sta_failed; + } + } } - } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); - return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, - buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); + return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, buf_ptr, size, + opt_unexpected_tag_decoder, body_receiver); stb_failed: FREEMEM(st); @@ -1162,502 +1371,596 @@ sta_failed: /* * Decode OCTET STRING from the hexadecimal data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); +asn_dec_rval_t OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, 0, OCTET_STRING__convert_hexadecimal); } /* * Decode OCTET STRING from the binary (0/1) data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, 0, OCTET_STRING__convert_binary); +asn_dec_rval_t OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, + const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, 0, OCTET_STRING__convert_binary); } /* * Decode OCTET STRING from the string (ASCII/UTF-8) data. */ -asn_dec_rval_t -OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, void **sptr, - const char *opt_mname, const void *buf_ptr, size_t size) { - return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, - buf_ptr, size, - OCTET_STRING__handle_control_chars, - OCTET_STRING__convert_entrefs); +asn_dec_rval_t OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **sptr, const char *opt_mname, + const void *buf_ptr, size_t size) +{ + return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, + size, OCTET_STRING__handle_control_chars, + OCTET_STRING__convert_entrefs); } -static int -OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, - size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { +static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, + size_t units, unsigned int bpc, + unsigned int unit_bits, long lb, + long ub, asn_per_constraints_t *pc) +{ uint8_t *end = buf + units * bpc; - ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", - (int)units, lb, ub, unit_bits); + ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", (int)units, lb, ub, + unit_bits); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { - /* Decode without translation */ - lb = 0; - } else if(pc && pc->code2value) { - if(unit_bits > 16) - return 1; /* FATAL: can't have constrained - * UniversalString with more than - * 16 million code points */ - for(; buf < end; buf += bpc) { - int value; - int code = per_get_few_bits(po, unit_bits); - if(code < 0) return -1; /* WMORE */ - value = pc->code2value(code); - if(value < 0) { - ASN_DEBUG("Code %d (0x%02x) is" - " not in map (%ld..%ld)", - code, code, lb, ub); - return 1; /* FATAL */ - } - switch(bpc) { - case 1: *buf = value; break; - case 2: buf[0] = value >> 8; buf[1] = value; break; - case 4: buf[0] = value >> 24; buf[1] = value >> 16; - buf[2] = value >> 8; buf[3] = value; break; - } + if ((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) + { + /* Decode without translation */ + lb = 0; + } + else if (pc && pc->code2value) + { + if (unit_bits > 16) + return 1; /* FATAL: can't have constrained + * UniversalString with more than + * 16 million code points */ + for (; buf < end; buf += bpc) + { + int value; + int code = per_get_few_bits(po, unit_bits); + if (code < 0) return -1; /* WMORE */ + value = pc->code2value(code); + if (value < 0) + { + ASN_DEBUG( + "Code %d (0x%02x) is" + " not in map (%ld..%ld)", + code, code, lb, ub); + return 1; /* FATAL */ + } + switch (bpc) + { + case 1: + *buf = value; + break; + case 2: + buf[0] = value >> 8; + buf[1] = value; + break; + case 4: + buf[0] = value >> 24; + buf[1] = value >> 16; + buf[2] = value >> 8; + buf[3] = value; + break; + } + } + return 0; } - return 0; - } /* Shortcut the no-op copying to the aligned structure */ - if(lb == 0 && (unit_bits == 8 * bpc)) { - return per_get_many_bits(po, buf, 0, unit_bits * units); - } + if (lb == 0 && (unit_bits == 8 * bpc)) + { + return per_get_many_bits(po, buf, 0, unit_bits * units); + } - for(; buf < end; buf += bpc) { - int code = per_get_few_bits(po, unit_bits); - int ch = code + lb; - if(code < 0) return -1; /* WMORE */ - if(ch > ub) { - ASN_DEBUG("Code %d is out of range (%ld..%ld)", - ch, lb, ub); - return 1; /* FATAL */ + for (; buf < end; buf += bpc) + { + int code = per_get_few_bits(po, unit_bits); + int ch = code + lb; + if (code < 0) return -1; /* WMORE */ + if (ch > ub) + { + ASN_DEBUG("Code %d is out of range (%ld..%ld)", ch, lb, ub); + return 1; /* FATAL */ + } + switch (bpc) + { + case 1: + *buf = ch; + break; + case 2: + buf[0] = ch >> 8; + buf[1] = ch; + break; + case 4: + buf[0] = ch >> 24; + buf[1] = ch >> 16; + buf[2] = ch >> 8; + buf[3] = ch; + break; + } } - switch(bpc) { - case 1: *buf = ch; break; - case 2: buf[0] = ch >> 8; buf[1] = ch; break; - case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; - buf[2] = ch >> 8; buf[3] = ch; break; - } - } return 0; } -static int -OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, - size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { +static int OCTET_STRING_per_put_characters(asn_per_outp_t *po, + const uint8_t *buf, size_t units, + unsigned int bpc, + unsigned int unit_bits, long lb, + long ub, asn_per_constraints_t *pc) +{ const uint8_t *end = buf + units * bpc; - ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", - (int)units, lb, ub, unit_bits, bpc); + ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", (int)units, + lb, ub, unit_bits, bpc); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { - /* Encode as is */ - lb = 0; - } else if(pc && pc->value2code) { - for(; buf < end; buf += bpc) { - int code; - uint32_t value; - switch(bpc) { - case 1: value = *buf; break; - case 2: value = (buf[0] << 8) | buf[1]; break; - case 4: value = (buf[0] << 24) | (buf[1] << 16) - | (buf[2] << 8) | buf[3]; break; - default: return -1; - } - code = pc->value2code(value); - if(code < 0) { - ASN_DEBUG("Character %d (0x%02x) is" - " not in map (%ld..%ld)", - *buf, *buf, lb, ub); - return -1; - } - if(per_put_few_bits(po, code, unit_bits)) - return -1; + if ((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) + { + /* Encode as is */ + lb = 0; + } + else if (pc && pc->value2code) + { + for (; buf < end; buf += bpc) + { + int code; + uint32_t value; + switch (bpc) + { + case 1: + value = *buf; + break; + case 2: + value = (buf[0] << 8) | buf[1]; + break; + case 4: + value = (buf[0] << 24) | (buf[1] << 16) | + (buf[2] << 8) | buf[3]; + break; + default: + return -1; + } + code = pc->value2code(value); + if (code < 0) + { + ASN_DEBUG( + "Character %d (0x%02x) is" + " not in map (%ld..%ld)", + *buf, *buf, lb, ub); + return -1; + } + if (per_put_few_bits(po, code, unit_bits)) return -1; + } } - } /* Shortcut the no-op copying to the aligned structure */ - if(lb == 0 && (unit_bits == 8 * bpc)) { - return per_put_many_bits(po, buf, unit_bits * units); - } + if (lb == 0 && (unit_bits == 8 * bpc)) + { + return per_put_many_bits(po, buf, unit_bits * units); + } - for(ub -= lb; buf < end; buf += bpc) { - int ch; - uint32_t value; - switch(bpc) { - case 1: value = *buf; break; - case 2: value = (buf[0] << 8) | buf[1]; break; - case 4: value = (buf[0] << 24) | (buf[1] << 16) - | (buf[2] << 8) | buf[3]; break; - default: return -1; + for (ub -= lb; buf < end; buf += bpc) + { + int ch; + uint32_t value; + switch (bpc) + { + case 1: + value = *buf; + break; + case 2: + value = (buf[0] << 8) | buf[1]; + break; + case 4: + value = (buf[0] << 24) | (buf[1] << 16) | + (buf[2] << 8) | buf[3]; + break; + default: + return -1; + } + ch = value - lb; + if (ch < 0 || ch > ub) + { + ASN_DEBUG( + "Character %d (0x%02x)" + " is out of range (%ld..%ld)", + *buf, *buf, lb, ub + lb); + return -1; + } + if (per_put_few_bits(po, ch, unit_bits)) return -1; } - ch = value - lb; - if(ch < 0 || ch > ub) { - ASN_DEBUG("Character %d (0x%02x)" - " is out of range (%ld..%ld)", - *buf, *buf, lb, ub + lb); - return -1; - } - if(per_put_few_bits(po, ch, unit_bits)) - return -1; - } return 0; } -asn_dec_rval_t -OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, - void **sptr, asn_per_data_t *pd) { - - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_per_constraints_t *pc = constraints ? constraints - : td->per_constraints; +asn_dec_rval_t OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; - asn_dec_rval_t rval = { RC_OK, 0 }; + asn_dec_rval_t rval = {RC_OK, 0}; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; ssize_t consumed_myself = 0; int repeat; - enum { - OS__BPC_BIT = 0, - OS__BPC_CHAR = 1, - OS__BPC_U16 = 2, - OS__BPC_U32 = 4 - } bpc; /* Bytes per character */ + enum + { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ unsigned int unit_bits; unsigned int canonical_unit_bits; (void)opt_codec_ctx; - if(pc) { - cval = &pc->value; - csiz = &pc->size; - } else { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - } + if (pc) + { + cval = &pc->value; + csiz = &pc->size; + } + else + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + } - switch(specs->subvariant) { - default: - case ASN_OSUBV_ANY: - ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); - RETURN(RC_FAIL); - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - break; - case ASN_OSUBV_STR: - canonical_unit_bits = unit_bits = 8; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_CHAR; - break; - case ASN_OSUBV_U16: - canonical_unit_bits = unit_bits = 16; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U16; - break; - case ASN_OSUBV_U32: - canonical_unit_bits = unit_bits = 32; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U32; - break; - } + switch (specs->subvariant) + { + default: + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } /* * Allocate the string. */ - if(!st) { - st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); - if(!st) RETURN(RC_FAIL); - } + if (!st) + { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if (!st) RETURN(RC_FAIL); + } ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", - csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", - csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); - if(csiz->flags & APC_EXTENSIBLE) { - int inext = per_get_few_bits(pd, 1); - if(inext < 0) RETURN(RC_WMORE); - if(inext) { - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - unit_bits = canonical_unit_bits; + if (csiz->flags & APC_EXTENSIBLE) + { + int inext = per_get_few_bits(pd, 1); + if (inext < 0) RETURN(RC_WMORE); + if (inext) + { + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + unit_bits = canonical_unit_bits; + } } - } - if(csiz->effective_bits >= 0) { - FREEMEM(st->buf); - if(bpc) { - st->size = csiz->upper_bound * bpc; - } else { - st->size = (csiz->upper_bound + 7) >> 3; + if (csiz->effective_bits >= 0) + { + FREEMEM(st->buf); + if (bpc) + { + st->size = csiz->upper_bound * bpc; + } + else + { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if (!st->buf) + { + st->size = 0; + RETURN(RC_FAIL); + } } - st->buf = (uint8_t *)MALLOC(st->size + 1); - if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } - } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ - if(csiz->effective_bits == 0) { - int ret; - if(bpc) { - ASN_DEBUG("Encoding OCTET STRING size %ld", - csiz->upper_bound); - ret = OCTET_STRING_per_get_characters(pd, st->buf, - csiz->upper_bound, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - if(ret > 0) RETURN(RC_FAIL); - } else { - ASN_DEBUG("Encoding BIT STRING size %ld", - csiz->upper_bound); - ret = per_get_many_bits(pd, st->buf, 0, - unit_bits * csiz->upper_bound); + if (csiz->effective_bits == 0) + { + int ret; + if (bpc) + { + ASN_DEBUG("Encoding OCTET STRING size %ld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters( + pd, st->buf, csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if (ret > 0) RETURN(RC_FAIL); + } + else + { + ASN_DEBUG("Encoding BIT STRING size %ld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if (ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if (bpc == 0) + { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); } - if(ret < 0) RETURN(RC_WMORE); - consumed_myself += unit_bits * csiz->upper_bound; - st->buf[st->size] = 0; - if(bpc == 0) { - int ubs = (csiz->upper_bound & 0x7); - st->bits_unused = ubs ? 8 - ubs : 0; - } - RETURN(RC_OK); - } st->size = 0; - do { - ssize_t raw_len; - ssize_t len_bytes; - ssize_t len_bits; - void *p; - int ret; + do + { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; - /* Get the PER length */ - raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); - if(raw_len < 0) RETURN(RC_WMORE); - raw_len += csiz->lower_bound; + /* Get the PER length */ + raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); + if (raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; - ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", - (long)csiz->effective_bits, (long)raw_len, - repeat ? "repeat" : "once", td->name); - if(bpc) { - len_bytes = raw_len * bpc; - len_bits = len_bytes * unit_bits; - } else { - len_bits = raw_len; - len_bytes = (len_bits + 7) >> 3; - if(len_bits & 0x7) - st->bits_unused = 8 - (len_bits & 0x7); - /* len_bits be multiple of 16K if repeat is set */ + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + if (bpc) + { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } + else + { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if (len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if (!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if (bpc) + { + ret = OCTET_STRING_per_get_characters( + pd, &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if (ret > 0) RETURN(RC_FAIL); + } + else + { + ret = + per_get_many_bits(pd, &st->buf[st->size], 0, len_bits); + } + if (ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; } - p = REALLOC(st->buf, st->size + len_bytes + 1); - if(!p) RETURN(RC_FAIL); - st->buf = (uint8_t *)p; - - if(bpc) { - ret = OCTET_STRING_per_get_characters(pd, - &st->buf[st->size], raw_len, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - if(ret > 0) RETURN(RC_FAIL); - } else { - ret = per_get_many_bits(pd, &st->buf[st->size], - 0, len_bits); - } - if(ret < 0) RETURN(RC_WMORE); - st->size += len_bytes; - } while(repeat); - st->buf[st->size] = 0; /* nul-terminate */ + while (repeat); + st->buf[st->size] = 0; /* nul-terminate */ return rval; } -asn_enc_rval_t -OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_per_constraints_t *pc = constraints ? constraints - : td->per_constraints; +asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - asn_enc_rval_t er = { 0, 0, 0 }; - int inext = 0; /* Lies not within extension root */ + asn_enc_rval_t er = {0, 0, 0}; + int inext = 0; /* Lies not within extension root */ unsigned int unit_bits; unsigned int canonical_unit_bits; unsigned int sizeinunits; const uint8_t *buf; int ret; - enum { - OS__BPC_BIT = 0, - OS__BPC_CHAR = 1, - OS__BPC_U16 = 2, - OS__BPC_U32 = 4 - } bpc; /* Bytes per character */ + enum + { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ int ct_extensible; - if(!st || (!st->buf && st->size)) - _ASN_ENCODE_FAILED; + if (!st || (!st->buf && st->size)) _ASN_ENCODE_FAILED; - if(pc) { - cval = &pc->value; - csiz = &pc->size; - } else { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - } + if (pc) + { + cval = &pc->value; + csiz = &pc->size; + } + else + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + } ct_extensible = csiz->flags & APC_EXTENSIBLE; - switch(specs->subvariant) { - default: - case ASN_OSUBV_ANY: - _ASN_ENCODE_FAILED; - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - sizeinunits = st->size * 8 - (st->bits_unused & 0x07); - ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", - sizeinunits, st->bits_unused); - break; - case ASN_OSUBV_STR: - canonical_unit_bits = unit_bits = 8; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_CHAR; - sizeinunits = st->size; - break; - case ASN_OSUBV_U16: - canonical_unit_bits = unit_bits = 16; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U16; - sizeinunits = st->size / 2; - break; - case ASN_OSUBV_U32: - canonical_unit_bits = unit_bits = 32; - if(cval->flags & APC_CONSTRAINED) - unit_bits = cval->range_bits; - bpc = OS__BPC_U32; - sizeinunits = st->size / 4; - break; - } + switch (specs->subvariant) + { + default: + case ASN_OSUBV_ANY: + _ASN_ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", sizeinunits, + st->bits_unused); + break; + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if (cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } - ASN_DEBUG("Encoding %s into %d units of %d bits" + ASN_DEBUG( + "Encoding %s into %d units of %d bits" " (%ld..%ld, effective %d)%s", - td->name, sizeinunits, unit_bits, - csiz->lower_bound, csiz->upper_bound, + td->name, sizeinunits, unit_bits, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); /* Figure out whether size lies within PER visible constraint */ - if(csiz->effective_bits >= 0) { - if((int)sizeinunits < csiz->lower_bound - || (int)sizeinunits > csiz->upper_bound) { - if(ct_extensible) { - cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; - csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; - unit_bits = canonical_unit_bits; - inext = 1; - } else - _ASN_ENCODE_FAILED; + if (csiz->effective_bits >= 0) + { + if ((int)sizeinunits < csiz->lower_bound || + (int)sizeinunits > csiz->upper_bound) + { + if (ct_extensible) + { + cval = &ASN_DEF_OCTET_STRING_CONSTRAINTS.value; + csiz = &ASN_DEF_OCTET_STRING_CONSTRAINTS.size; + unit_bits = canonical_unit_bits; + inext = 1; + } + else + _ASN_ENCODE_FAILED; + } + } + else + { + inext = 0; } - } else { - inext = 0; - } - if(ct_extensible) { - /* Declare whether length is [not] within extension root */ - if(per_put_few_bits(po, inext, 1)) - _ASN_ENCODE_FAILED; - } + if (ct_extensible) + { + /* Declare whether length is [not] within extension root */ + if (per_put_few_bits(po, inext, 1)) _ASN_ENCODE_FAILED; + } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ - if(csiz->effective_bits >= 0) { - ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", - st->size, sizeinunits - csiz->lower_bound, - csiz->effective_bits); - ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, - csiz->effective_bits); - if(ret) _ASN_ENCODE_FAILED; - if(bpc) { - ret = OCTET_STRING_per_put_characters(po, st->buf, - sizeinunits, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - } else { - ret = per_put_many_bits(po, st->buf, - sizeinunits * unit_bits); + if (csiz->effective_bits >= 0) + { + ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", st->size, + sizeinunits - csiz->lower_bound, csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if (ret) _ASN_ENCODE_FAILED; + if (bpc) + { + ret = OCTET_STRING_per_put_characters( + po, st->buf, sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } + else + { + ret = + per_put_many_bits(po, st->buf, sizeinunits * unit_bits); + } + if (ret) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); } - if(ret) _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } ASN_DEBUG("Encoding %d bytes", st->size); - if(sizeinunits == 0) { - if(uper_put_length(po, 0)) - _ASN_ENCODE_FAILED; - _ASN_ENCODED_OK(er); - } + if (sizeinunits == 0) + { + if (uper_put_length(po, 0)) _ASN_ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } buf = st->buf; - while(sizeinunits) { - ssize_t maySave = uper_put_length(po, sizeinunits); - if(maySave < 0) _ASN_ENCODE_FAILED; + while (sizeinunits) + { + ssize_t maySave = uper_put_length(po, sizeinunits); + if (maySave < 0) _ASN_ENCODE_FAILED; - ASN_DEBUG("Encoding %ld of %ld", - (long)maySave, (long)sizeinunits); + ASN_DEBUG("Encoding %ld of %ld", (long)maySave, (long)sizeinunits); - if(bpc) { - ret = OCTET_STRING_per_put_characters(po, buf, - maySave, bpc, unit_bits, - cval->lower_bound, cval->upper_bound, pc); - } else { - ret = per_put_many_bits(po, buf, maySave * unit_bits); + if (bpc) + { + ret = OCTET_STRING_per_put_characters( + po, buf, maySave, bpc, unit_bits, cval->lower_bound, + cval->upper_bound, pc); + } + else + { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if (ret) _ASN_ENCODE_FAILED; + + if (bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); } - if(ret) _ASN_ENCODE_FAILED; - - if(bpc) - buf += maySave * bpc; - else - buf += maySave >> 3; - sizeinunits -= maySave; - assert(!(maySave & 0x07) || !sizeinunits); - } _ASN_ENCODED_OK(er); } -int -OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ static const char *h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; char scratch[16 * 3 + 4]; @@ -1666,9 +1969,9 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, uint8_t *end; size_t i; - (void)td; /* Unused argument */ + (void)td; /* Unused argument */ - if(!st || (!st->buf && st->size)) + if (!st || (!st->buf && st->size)) return (cb("", 8, app_key) < 0) ? -1 : 0; /* @@ -1676,113 +1979,121 @@ OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, */ buf = st->buf; end = buf + st->size; - for(i = 0; buf < end; buf++, i++) { - if(!(i % 16) && (i || st->size > 16)) { - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - _i_INDENT(1); - p = scratch; + for (i = 0; buf < end; buf++, i++) + { + if (!(i % 16) && (i || st->size > 16)) + { + if (cb(scratch, p - scratch, app_key) < 0) return -1; + _i_INDENT(1); + p = scratch; + } + *p++ = h2c[(*buf >> 4) & 0x0F]; + *p++ = h2c[*buf & 0x0F]; + *p++ = 0x20; } - *p++ = h2c[(*buf >> 4) & 0x0F]; - *p++ = h2c[*buf & 0x0F]; - *p++ = 0x20; - } - if(p > scratch) { - p--; /* Remove the tail space */ - if(cb(scratch, p - scratch, app_key) < 0) - return -1; - } + if (p > scratch) + { + p--; /* Remove the tail space */ + if (cb(scratch, p - scratch, app_key) < 0) return -1; + } return 0; } -int -OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st && (st->buf || !st->size)) { - return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + if (st && (st->buf || !st->size)) + { + return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -void -OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { +void OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) +{ OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_struct_ctx_t *ctx = (asn_struct_ctx_t *) - ((char *)st + specs->ctx_offset); + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_struct_ctx_t *ctx = + (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); struct _stack *stck; - if(!td || !st) - return; + if (!td || !st) return; ASN_DEBUG("Freeing %s as OCTET STRING", td->name); - if(st->buf) { - FREEMEM(st->buf); - st->buf = 0; - } + if (st->buf) + { + FREEMEM(st->buf); + st->buf = 0; + } /* * Remove decode-time stack. */ stck = (struct _stack *)ctx->ptr; - if(stck) { - while(stck->tail) { - struct _stack_el *sel = stck->tail; - stck->tail = sel->prev; - FREEMEM(sel); + if (stck) + { + while (stck->tail) + { + struct _stack_el *sel = stck->tail; + stck->tail = sel->prev; + FREEMEM(sel); + } + FREEMEM(stck); } - FREEMEM(stck); - } - if(!contents_only) { - FREEMEM(st); - } + if (!contents_only) + { + FREEMEM(st); + } } /* * Conversion routines. */ -int -OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { +int OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) +{ void *buf; - if(st == 0 || (str == 0 && len)) { - errno = EINVAL; - return -1; - } + if (st == 0 || (str == 0 && len)) + { + errno = EINVAL; + return -1; + } /* * Clear the OCTET STRING. */ - if(str == NULL) { - FREEMEM(st->buf); - st->buf = 0; - st->size = 0; - return 0; - } + if (str == NULL) + { + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + return 0; + } /* Determine the original string size, if not explicitly given */ - if(len < 0) - len = strlen(str); + if (len < 0) len = strlen(str); /* Allocate and fill the memory */ buf = MALLOC(len + 1); - if(buf == NULL) - return -1; + if (buf == NULL) return -1; memcpy(buf, str, len); - ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ + ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ FREEMEM(st->buf); st->buf = (uint8_t *)buf; st->size = len; @@ -1790,18 +2101,20 @@ OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { return 0; } -OCTET_STRING_t * -OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; +OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, + const char *str, int len) +{ + asn_OCTET_STRING_specifics_t *specs = + td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; OCTET_STRING_t *st; st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); - if(st && str && OCTET_STRING_fromBuf(st, str, len)) { - FREEMEM(st); - st = NULL; - } + if (st && str && OCTET_STRING_fromBuf(st, str, len)) + { + FREEMEM(st); + st = NULL; + } return st; } diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.h b/src/core/libs/supl/asn-supl/OCTET_STRING.h index 7faccf62f..3aa1ba86b 100644 --- a/src/core/libs/supl/asn-supl/OCTET_STRING.h +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.h @@ -36,40 +36,40 @@ extern "C" per_type_encoder_f OCTET_STRING_encode_uper; /****************************** - * Handy conversion routines. * - ******************************/ + * Handy conversion routines. * + ******************************/ /* - * This function clears the previous value of the OCTET STRING (if any) - * and then allocates a new memory with the specified content (str/size). - * If size = -1, the size of the original string will be determined - * using strlen(str). - * If str equals to NULL, the function will silently clear the - * current contents of the OCTET STRING. - * Returns 0 if it was possible to perform operation, -1 otherwise. - */ + * This function clears the previous value of the OCTET STRING (if any) + * and then allocates a new memory with the specified content (str/size). + * If size = -1, the size of the original string will be determined + * using strlen(str). + * If str equals to NULL, the function will silently clear the + * current contents of the OCTET STRING. + * Returns 0 if it was possible to perform operation, -1 otherwise. + */ int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int len); /* Handy conversion from the C string into the OCTET STRING. */ #define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) /* - * Allocate and fill the new OCTET STRING and return a pointer to the newly - * allocated object. NULL is permitted in str: the function will just allocate - * empty OCTET STRING. - */ + * Allocate and fill the new OCTET STRING and return a pointer to the newly + * allocated object. NULL is permitted in str: the function will just + * allocate empty OCTET STRING. + */ OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, - const char *str, int len); + const char *str, int len); /**************************** - * Internally useful stuff. * - ****************************/ + * Internally useful stuff. * + ****************************/ typedef struct asn_OCTET_STRING_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the structure */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ diff --git a/src/core/libs/supl/asn-supl/Pathloss.c b/src/core/libs/supl/asn-supl/Pathloss.c index d25ce61d0..5fd48e72a 100644 --- a/src/core/libs/supl/asn-supl/Pathloss.c +++ b/src/core/libs/supl/asn-supl/Pathloss.c @@ -6,119 +6,130 @@ #include "Pathloss.h" -int -Pathloss_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int Pathloss_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 46 && value <= 173)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 46 && value <= 173)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -Pathloss_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void Pathloss_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -Pathloss_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void Pathloss_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ Pathloss_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -Pathloss_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int Pathloss_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ Pathloss_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -Pathloss_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t Pathloss_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ Pathloss_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -Pathloss_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Pathloss_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ Pathloss_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -Pathloss_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t Pathloss_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ Pathloss_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -Pathloss_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Pathloss_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ Pathloss_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -Pathloss_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t Pathloss_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ Pathloss_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -Pathloss_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t Pathloss_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ Pathloss_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_PATHLOSS_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 46, 173 } /* (46..173) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 46, 173} /* (46..173) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_Pathloss_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_Pathloss = { "Pathloss", "Pathloss", @@ -131,15 +142,15 @@ asn_TYPE_descriptor_t asn_DEF_Pathloss = { Pathloss_encode_xer, Pathloss_decode_uper, Pathloss_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Pathloss_tags_1, - sizeof(asn_DEF_Pathloss_tags_1) - /sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ - asn_DEF_Pathloss_tags_1, /* Same as above */ - sizeof(asn_DEF_Pathloss_tags_1) - /sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ + sizeof(asn_DEF_Pathloss_tags_1) / + sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ + asn_DEF_Pathloss_tags_1, /* Same as above */ + sizeof(asn_DEF_Pathloss_tags_1) / + sizeof(asn_DEF_Pathloss_tags_1[0]), /* 1 */ &ASN_PER_TYPE_PATHLOSS_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/Pathloss.h b/src/core/libs/supl/asn-supl/Pathloss.h index 3b79b63e6..34989cecb 100644 --- a/src/core/libs/supl/asn-supl/Pathloss.h +++ b/src/core/libs/supl/asn-supl/Pathloss.h @@ -7,7 +7,6 @@ #ifndef _Pathloss_H_ #define _Pathloss_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/PosMethod.c b/src/core/libs/supl/asn-supl/PosMethod.c index c00606e7a..7dd104756 100644 --- a/src/core/libs/supl/asn-supl/PosMethod.c +++ b/src/core/libs/supl/asn-supl/PosMethod.c @@ -6,9 +6,9 @@ #include "PosMethod.h" -int -PosMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int PosMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,125 +18,135 @@ PosMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -PosMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void PosMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -PosMethod_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void PosMethod_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ PosMethod_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -PosMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int PosMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ PosMethod_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -PosMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t PosMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ PosMethod_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -PosMethod_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PosMethod_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ PosMethod_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -PosMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t PosMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ PosMethod_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -PosMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PosMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ PosMethod_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -PosMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t PosMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ PosMethod_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -PosMethod_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t PosMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ PosMethod_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_POS_METHOD_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 9 } /* (0..9,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 0, 9} /* (0..9,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_PosMethod_value2enum_1[] = { - { 0, 15, "agpsSETassisted" }, - { 1, 12, "agpsSETbased" }, - { 2, 19, "agpsSETassistedpref" }, - { 3, 16, "agpsSETbasedpref" }, - { 4, 13, "autonomousGPS" }, - { 5, 4, "aFLT" }, - { 6, 4, "eCID" }, - { 7, 4, "eOTD" }, - { 8, 5, "oTDOA" }, - { 9, 10, "noPosition" } + {0, 15, "agpsSETassisted"}, + {1, 12, "agpsSETbased"}, + {2, 19, "agpsSETassistedpref"}, + {3, 16, "agpsSETbasedpref"}, + {4, 13, "autonomousGPS"}, + {5, 4, "aFLT"}, + {6, 4, "eCID"}, + {7, 4, "eOTD"}, + {8, 5, "oTDOA"}, + {9, 10, "noPosition"} /* This list is extensible */ }; static unsigned int asn_MAP_PosMethod_enum2value_1[] = { - 5, /* aFLT(5) */ - 0, /* agpsSETassisted(0) */ - 2, /* agpsSETassistedpref(2) */ - 1, /* agpsSETbased(1) */ - 3, /* agpsSETbasedpref(3) */ - 4, /* autonomousGPS(4) */ - 6, /* eCID(6) */ - 7, /* eOTD(7) */ - 9, /* noPosition(9) */ - 8 /* oTDOA(8) */ - /* This list is extensible */ + 5, /* aFLT(5) */ + 0, /* agpsSETassisted(0) */ + 2, /* agpsSETassistedpref(2) */ + 1, /* agpsSETbased(1) */ + 3, /* agpsSETbasedpref(3) */ + 4, /* autonomousGPS(4) */ + 6, /* eCID(6) */ + 7, /* eOTD(7) */ + 9, /* noPosition(9) */ + 8 /* oTDOA(8) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_PosMethod_specs_1 = { - asn_MAP_PosMethod_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_PosMethod_enum2value_1, /* N => "tag"; sorted by N */ - 10, /* Number of elements in the maps */ - 11, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_PosMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PosMethod_enum2value_1, /* N => "tag"; sorted by N */ + 10, /* Number of elements in the maps */ + 11, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_PosMethod_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_PosMethod = { "PosMethod", "PosMethod", @@ -149,15 +159,15 @@ asn_TYPE_descriptor_t asn_DEF_PosMethod = { PosMethod_encode_xer, PosMethod_decode_uper, PosMethod_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PosMethod_tags_1, - sizeof(asn_DEF_PosMethod_tags_1) - /sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ - asn_DEF_PosMethod_tags_1, /* Same as above */ - sizeof(asn_DEF_PosMethod_tags_1) - /sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ + sizeof(asn_DEF_PosMethod_tags_1) / + sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ + asn_DEF_PosMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PosMethod_tags_1) / + sizeof(asn_DEF_PosMethod_tags_1[0]), /* 1 */ &ASN_PER_TYPE_POS_METHOD_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_PosMethod_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_PosMethod_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PosMethod.h b/src/core/libs/supl/asn-supl/PosMethod.h index 06ca2a728..76c73e44f 100644 --- a/src/core/libs/supl/asn-supl/PosMethod.h +++ b/src/core/libs/supl/asn-supl/PosMethod.h @@ -7,7 +7,6 @@ #ifndef _PosMethod_H_ #define _PosMethod_H_ - #include /* Including external dependencies */ @@ -32,8 +31,8 @@ extern "C" PosMethod_oTDOA = 8, PosMethod_noPosition = 9 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_PosMethod; /* PosMethod */ diff --git a/src/core/libs/supl/asn-supl/PosPayLoad.c b/src/core/libs/supl/asn-supl/PosPayLoad.c index 259bde132..cf9a2c57d 100644 --- a/src/core/libs/supl/asn-supl/PosPayLoad.c +++ b/src/core/libs/supl/asn-supl/PosPayLoad.c @@ -6,137 +6,137 @@ #include "PosPayLoad.h" -static int -memb_tia801payload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_tia801payload_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 8192)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 8192)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_rrcPayload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_rrcPayload_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 8192)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 8192)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_rrlpPayload_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_rrlpPayload_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + size = st->size; - - if((size >= 1 && size <= 8192)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((size >= 1 && size <= 8192)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_TIA801PAYLOAD_CONSTR_2 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 13, 13, 1, 8192} /* (SIZE(1..8192)) */, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RRC_PAYLOAD_CONSTR_3 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 13, 13, 1, 8192} /* (SIZE(1..8192)) */, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_RRLP_PAYLOAD_CONSTR_4 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 13, 13, 1, 8192 } /* (SIZE(1..8192)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 13, 13, 1, 8192} /* (SIZE(1..8192)) */, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_TYPE_POS_PAY_LOAD_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_PosPayLoad_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.tia801payload), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_tia801payload_constraint_1, - &ASN_PER_MEMB_TIA801PAYLOAD_CONSTR_2, - 0, - "tia801payload" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrcPayload), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_rrcPayload_constraint_1, - &ASN_PER_MEMB_RRC_PAYLOAD_CONSTR_3, - 0, - "rrcPayload" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrlpPayload), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_rrlpPayload_constraint_1, - &ASN_PER_MEMB_RRLP_PAYLOAD_CONSTR_4, - 0, - "rrlpPayload" - }, + {ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.tia801payload), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_tia801payload_constraint_1, + &ASN_PER_MEMB_TIA801PAYLOAD_CONSTR_2, 0, "tia801payload"}, + {ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrcPayload), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_rrcPayload_constraint_1, + &ASN_PER_MEMB_RRC_PAYLOAD_CONSTR_3, 0, "rrcPayload"}, + {ATF_NOFLAGS, 0, offsetof(struct PosPayLoad, choice.rrlpPayload), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_rrlpPayload_constraint_1, + &ASN_PER_MEMB_RRLP_PAYLOAD_CONSTR_4, 0, "rrlpPayload"}, }; static asn_TYPE_tag2member_t asn_MAP_PosPayLoad_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* tia801payload at 15 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rrcPayload at 16 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rrlpPayload at 17 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* tia801payload at 15 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* rrcPayload at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* rrlpPayload at 17 */ }; static asn_CHOICE_specifics_t asn_SPC_PosPayLoad_specs_1 = { sizeof(struct PosPayLoad), @@ -144,9 +144,9 @@ static asn_CHOICE_specifics_t asn_SPC_PosPayLoad_specs_1 = { offsetof(struct PosPayLoad, present), sizeof(((struct PosPayLoad *)0)->present), asn_MAP_PosPayLoad_tag2el_1, - 3, /* Count of tags in the map */ + 3, /* Count of tags in the map */ 0, - 3 /* Extensions start */ + 3 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_PosPayLoad = { "PosPayLoad", @@ -161,13 +161,12 @@ asn_TYPE_descriptor_t asn_DEF_PosPayLoad = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_POS_PAY_LOAD_CONSTR_1, asn_MBR_PosPayLoad_1, - 3, /* Elements count */ - &asn_SPC_PosPayLoad_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_PosPayLoad_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PosPayLoad.h b/src/core/libs/supl/asn-supl/PosPayLoad.h index 54d3c6471..ca79faa15 100644 --- a/src/core/libs/supl/asn-supl/PosPayLoad.h +++ b/src/core/libs/supl/asn-supl/PosPayLoad.h @@ -7,7 +7,6 @@ #ifndef _PosPayLoad_H_ #define _PosPayLoad_H_ - #include /* Including external dependencies */ @@ -39,9 +38,9 @@ extern "C" OCTET_STRING_t rrcPayload; OCTET_STRING_t rrlpPayload; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/PosProtocol.c b/src/core/libs/supl/asn-supl/PosProtocol.c index 80650c4f1..2e157aae0 100644 --- a/src/core/libs/supl/asn-supl/PosProtocol.c +++ b/src/core/libs/supl/asn-supl/PosProtocol.c @@ -7,50 +7,39 @@ #include "PosProtocol.h" static asn_TYPE_member_t asn_MBR_PosProtocol_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, tia801), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "tia801" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrlp), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rrlp" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrc), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "rrc" - }, + {ATF_NOFLAGS, 0, offsetof(struct PosProtocol, tia801), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "tia801"}, + {ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrlp), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rrlp"}, + {ATF_NOFLAGS, 0, offsetof(struct PosProtocol, rrc), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "rrc"}, }; static ber_tlv_tag_t asn_DEF_PosProtocol_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PosProtocol_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* tia801 at 35 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rrlp at 36 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* rrc at 37 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* tia801 at 35 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* rrlp at 36 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* rrc at 37 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PosProtocol_specs_1 = { sizeof(struct PosProtocol), offsetof(struct PosProtocol, _asn_ctx), asn_MAP_PosProtocol_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PosProtocol = { "PosProtocol", @@ -64,16 +53,15 @@ asn_TYPE_descriptor_t asn_DEF_PosProtocol = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PosProtocol_tags_1, - sizeof(asn_DEF_PosProtocol_tags_1) - /sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ - asn_DEF_PosProtocol_tags_1, /* Same as above */ - sizeof(asn_DEF_PosProtocol_tags_1) - /sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PosProtocol_tags_1) / + sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ + asn_DEF_PosProtocol_tags_1, /* Same as above */ + sizeof(asn_DEF_PosProtocol_tags_1) / + sizeof(asn_DEF_PosProtocol_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PosProtocol_1, - 3, /* Elements count */ - &asn_SPC_PosProtocol_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_PosProtocol_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PosProtocol.h b/src/core/libs/supl/asn-supl/PosProtocol.h index 627c20747..9742c06cb 100644 --- a/src/core/libs/supl/asn-supl/PosProtocol.h +++ b/src/core/libs/supl/asn-supl/PosProtocol.h @@ -7,7 +7,6 @@ #ifndef _PosProtocol_H_ #define _PosProtocol_H_ - #include /* Including external dependencies */ @@ -26,9 +25,9 @@ extern "C" BOOLEAN_t rrlp; BOOLEAN_t rrc; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/PosTechnology.c b/src/core/libs/supl/asn-supl/PosTechnology.c index 5f7195659..8ed7b2f7c 100644 --- a/src/core/libs/supl/asn-supl/PosTechnology.c +++ b/src/core/libs/supl/asn-supl/PosTechnology.c @@ -7,90 +7,63 @@ #include "PosTechnology.h" static asn_TYPE_member_t asn_MBR_PosTechnology_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETassisted), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "agpsSETassisted" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETBased), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "agpsSETBased" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, autonomousGPS), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "autonomousGPS" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, aFLT), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "aFLT" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eCID), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "eCID" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eOTD), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "eOTD" - }, - { ATF_NOFLAGS, 0, offsetof(struct PosTechnology, oTDOA), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "oTDOA" - }, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETassisted), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "agpsSETassisted"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, agpsSETBased), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "agpsSETBased"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, autonomousGPS), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "autonomousGPS"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, aFLT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "aFLT"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eCID), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "eCID"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, eOTD), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "eOTD"}, + {ATF_NOFLAGS, 0, offsetof(struct PosTechnology, oTDOA), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "oTDOA"}, }; static ber_tlv_tag_t asn_DEF_PosTechnology_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PosTechnology_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* agpsSETassisted at 22 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* agpsSETBased at 23 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* autonomousGPS at 24 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* aFLT at 25 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* eCID at 26 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* eOTD at 27 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* oTDOA at 28 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* agpsSETassisted at 22 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* agpsSETBased at 23 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* autonomousGPS at 24 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* aFLT at 25 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* eCID at 26 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* eOTD at 27 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0} /* oTDOA at 28 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PosTechnology_specs_1 = { sizeof(struct PosTechnology), offsetof(struct PosTechnology, _asn_ctx), asn_MAP_PosTechnology_tag2el_1, - 7, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 6, /* Start extensions */ - 8 /* Stop extensions */ + 7, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 6, /* Start extensions */ + 8 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PosTechnology = { "PosTechnology", @@ -104,16 +77,15 @@ asn_TYPE_descriptor_t asn_DEF_PosTechnology = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PosTechnology_tags_1, - sizeof(asn_DEF_PosTechnology_tags_1) - /sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ - asn_DEF_PosTechnology_tags_1, /* Same as above */ - sizeof(asn_DEF_PosTechnology_tags_1) - /sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PosTechnology_tags_1) / + sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ + asn_DEF_PosTechnology_tags_1, /* Same as above */ + sizeof(asn_DEF_PosTechnology_tags_1) / + sizeof(asn_DEF_PosTechnology_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PosTechnology_1, - 7, /* Elements count */ - &asn_SPC_PosTechnology_specs_1 /* Additional specs */ + 7, /* Elements count */ + &asn_SPC_PosTechnology_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PosTechnology.h b/src/core/libs/supl/asn-supl/PosTechnology.h index f42f12c11..77a06bcca 100644 --- a/src/core/libs/supl/asn-supl/PosTechnology.h +++ b/src/core/libs/supl/asn-supl/PosTechnology.h @@ -7,7 +7,6 @@ #ifndef _PosTechnology_H_ #define _PosTechnology_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" BOOLEAN_t eOTD; BOOLEAN_t oTDOA; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/Position.c b/src/core/libs/supl/asn-supl/Position.c index cd55b097e..87d66fec4 100644 --- a/src/core/libs/supl/asn-supl/Position.c +++ b/src/core/libs/supl/asn-supl/Position.c @@ -7,52 +7,41 @@ #include "Position.h" static asn_TYPE_member_t asn_MBR_Position_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Position, timestamp), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_UTCTime, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "timestamp" - }, - { ATF_NOFLAGS, 0, offsetof(struct Position, positionEstimate), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PositionEstimate, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "positionEstimate" - }, - { ATF_POINTER, 1, offsetof(struct Position, velocity), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_Velocity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "velocity" - }, + {ATF_NOFLAGS, 0, offsetof(struct Position, timestamp), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_UTCTime, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "timestamp"}, + {ATF_NOFLAGS, 0, offsetof(struct Position, positionEstimate), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PositionEstimate, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "positionEstimate"}, + {ATF_POINTER, 1, offsetof(struct Position, velocity), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_Velocity, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "velocity"}, }; -static int asn_MAP_Position_oms_1[] = { 2 }; +static int asn_MAP_Position_oms_1[] = {2}; static ber_tlv_tag_t asn_DEF_Position_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Position_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* timestamp at 67 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* positionEstimate at 68 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* velocity at 69 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* timestamp at 67 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* positionEstimate at 68 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* velocity at 69 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Position_specs_1 = { sizeof(struct Position), offsetof(struct Position, _asn_ctx), asn_MAP_Position_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_Position_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_Position_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Position = { "Position", @@ -66,16 +55,15 @@ asn_TYPE_descriptor_t asn_DEF_Position = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Position_tags_1, - sizeof(asn_DEF_Position_tags_1) - /sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ - asn_DEF_Position_tags_1, /* Same as above */ - sizeof(asn_DEF_Position_tags_1) - /sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Position_tags_1) / + sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ + asn_DEF_Position_tags_1, /* Same as above */ + sizeof(asn_DEF_Position_tags_1) / + sizeof(asn_DEF_Position_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Position_1, - 3, /* Elements count */ - &asn_SPC_Position_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Position_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/Position.h b/src/core/libs/supl/asn-supl/Position.h index f31496723..0ec959c08 100644 --- a/src/core/libs/supl/asn-supl/Position.h +++ b/src/core/libs/supl/asn-supl/Position.h @@ -7,7 +7,6 @@ #ifndef _Position_H_ #define _Position_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" PositionEstimate_t positionEstimate; struct Velocity *velocity /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/PositionEstimate.c b/src/core/libs/supl/asn-supl/PositionEstimate.c index c489785d6..c4481cd56 100644 --- a/src/core/libs/supl/asn-supl/PositionEstimate.c +++ b/src/core/libs/supl/asn-supl/PositionEstimate.c @@ -6,9 +6,11 @@ #include "PositionEstimate.h" -static int -latitudeSign_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int latitudeSign_2_constraint(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,463 +20,470 @@ latitudeSign_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -latitudeSign_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void latitudeSign_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -static void -latitudeSign_2_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +static void latitudeSign_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ latitudeSign_2_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -static int -latitudeSign_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +static int latitudeSign_2_print(asn_TYPE_descriptor_t *td, + const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ latitudeSign_2_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -static asn_dec_rval_t -latitudeSign_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +static asn_dec_rval_t latitudeSign_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ latitudeSign_2_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -static asn_enc_rval_t -latitudeSign_2_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t latitudeSign_2_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ latitudeSign_2_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -static asn_dec_rval_t -latitudeSign_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +static asn_dec_rval_t latitudeSign_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ latitudeSign_2_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -static asn_enc_rval_t -latitudeSign_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t latitudeSign_2_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ latitudeSign_2_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -static asn_dec_rval_t -latitudeSign_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +static asn_dec_rval_t latitudeSign_2_decode_uper( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, + asn_per_data_t *per_data) +{ latitudeSign_2_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -static asn_enc_rval_t -latitudeSign_2_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +static asn_enc_rval_t latitudeSign_2_encode_uper( + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ latitudeSign_2_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } -static int -memb_uncertaintySemiMajor_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_uncertaintySemiMajor_constraint_7( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_uncertaintySemiMinor_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_uncertaintySemiMinor_constraint_7( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_orientationMajorAxis_constraint_7(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_orientationMajorAxis_constraint_7( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 180)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 180)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_latitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_latitude_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_longitude_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_longitude_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= -8388608 && value <= 8388607)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= -8388608 && value <= 8388607)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_confidence_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_confidence_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 100)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 100)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_TYPE_LATITUDE_SIGN_CONSTR_2 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UNCERTAINTY_SEMI_MAJOR_CONSTR_8 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_UNCERTAINTY_SEMI_MINOR_CONSTR_9 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_ORIENTATION_MAJOR_AXIS_CONSTR_10 = { - { APC_CONSTRAINED, 8, 8, 0, 180 } /* (0..180) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 180} /* (0..180) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_LATITUDE_CONSTR_5 = { - { APC_CONSTRAINED, 23, -1, 0, 8388607 } /* (0..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 23, -1, 0, 8388607} /* (0..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_LONGITUDE_CONSTR_6 = { - { APC_CONSTRAINED, 24, -1, -8388608, 8388607 } /* (-8388608..8388607) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 24, -1, -8388608, 8388607} /* (-8388608..8388607) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_CONFIDENCE_CONSTR_11 = { - { APC_CONSTRAINED, 7, 7, 0, 100 } /* (0..100) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 100} /* (0..100) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_latitudeSign_value2enum_2[] = { - { 0, 5, "north" }, - { 1, 5, "south" } -}; + {0, 5, "north"}, {1, 5, "south"}}; static unsigned int asn_MAP_latitudeSign_enum2value_2[] = { - 0, /* north(0) */ - 1 /* south(1) */ + 0, /* north(0) */ + 1 /* south(1) */ }; static asn_INTEGER_specifics_t asn_SPC_latitudeSign_specs_2 = { - asn_MAP_latitudeSign_value2enum_2, /* "tag" => N; sorted by tag */ - asn_MAP_latitudeSign_enum2value_2, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_latitudeSign_value2enum_2, /* "tag" => N; sorted by tag */ + asn_MAP_latitudeSign_enum2value_2, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_latitudeSign_tags_2[] = { - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_latitudeSign_2 = { - "latitudeSign", - "latitudeSign", - latitudeSign_2_free, - latitudeSign_2_print, - latitudeSign_2_constraint, - latitudeSign_2_decode_ber, - latitudeSign_2_encode_der, - latitudeSign_2_decode_xer, - latitudeSign_2_encode_xer, - latitudeSign_2_decode_uper, - latitudeSign_2_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_latitudeSign_tags_2, - sizeof(asn_DEF_latitudeSign_tags_2) - /sizeof(asn_DEF_latitudeSign_tags_2[0]) - 1, /* 1 */ - asn_DEF_latitudeSign_tags_2, /* Same as above */ - sizeof(asn_DEF_latitudeSign_tags_2) - /sizeof(asn_DEF_latitudeSign_tags_2[0]), /* 2 */ - &ASN_PER_TYPE_LATITUDE_SIGN_CONSTR_2, - 0, 0, /* Defined elsewhere */ - &asn_SPC_latitudeSign_specs_2 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_latitudeSign_2 = { + "latitudeSign", + "latitudeSign", + latitudeSign_2_free, + latitudeSign_2_print, + latitudeSign_2_constraint, + latitudeSign_2_decode_ber, + latitudeSign_2_encode_der, + latitudeSign_2_decode_xer, + latitudeSign_2_encode_xer, + latitudeSign_2_decode_uper, + latitudeSign_2_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_latitudeSign_tags_2, + sizeof(asn_DEF_latitudeSign_tags_2) / + sizeof(asn_DEF_latitudeSign_tags_2[0]) - + 1, /* 1 */ + asn_DEF_latitudeSign_tags_2, /* Same as above */ + sizeof(asn_DEF_latitudeSign_tags_2) / + sizeof(asn_DEF_latitudeSign_tags_2[0]), /* 2 */ + &ASN_PER_TYPE_LATITUDE_SIGN_CONSTR_2, + 0, + 0, /* Defined elsewhere */ + &asn_SPC_latitudeSign_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_uncertainty_7[] = { - { ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMajor), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_uncertaintySemiMajor_constraint_7, - &ASN_PER_MEMB_UNCERTAINTY_SEMI_MAJOR_CONSTR_8, - 0, - "uncertaintySemiMajor" - }, - { ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMinor), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_uncertaintySemiMinor_constraint_7, - &ASN_PER_MEMB_UNCERTAINTY_SEMI_MINOR_CONSTR_9, - 0, - "uncertaintySemiMinor" - }, - { ATF_NOFLAGS, 0, offsetof(struct uncertainty, orientationMajorAxis), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_orientationMajorAxis_constraint_7, - &ASN_PER_MEMB_ORIENTATION_MAJOR_AXIS_CONSTR_10, - 0, - "orientationMajorAxis" - }, + {ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMajor), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_uncertaintySemiMajor_constraint_7, + &ASN_PER_MEMB_UNCERTAINTY_SEMI_MAJOR_CONSTR_8, 0, "uncertaintySemiMajor"}, + {ATF_NOFLAGS, 0, offsetof(struct uncertainty, uncertaintySemiMinor), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_uncertaintySemiMinor_constraint_7, + &ASN_PER_MEMB_UNCERTAINTY_SEMI_MINOR_CONSTR_9, 0, "uncertaintySemiMinor"}, + {ATF_NOFLAGS, 0, offsetof(struct uncertainty, orientationMajorAxis), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_orientationMajorAxis_constraint_7, + &ASN_PER_MEMB_ORIENTATION_MAJOR_AXIS_CONSTR_10, 0, "orientationMajorAxis"}, }; static ber_tlv_tag_t asn_DEF_uncertainty_tags_7[] = { - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_uncertainty_tag2el_7[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* uncertaintySemiMajor at 77 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uncertaintySemiMinor at 78 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* orientationMajorAxis at 79 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0}, /* uncertaintySemiMajor at 77 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* uncertaintySemiMinor at 78 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0} /* orientationMajorAxis at 79 */ }; static asn_SEQUENCE_specifics_t asn_SPC_uncertainty_specs_7 = { sizeof(struct uncertainty), offsetof(struct uncertainty, _asn_ctx), asn_MAP_uncertainty_tag2el_7, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ -asn_TYPE_descriptor_t asn_DEF_uncertainty_7 = { - "uncertainty", - "uncertainty", - SEQUENCE_free, - SEQUENCE_print, - SEQUENCE_constraint, - SEQUENCE_decode_ber, - SEQUENCE_encode_der, - SEQUENCE_decode_xer, - SEQUENCE_encode_xer, - SEQUENCE_decode_uper, - SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ - asn_DEF_uncertainty_tags_7, - sizeof(asn_DEF_uncertainty_tags_7) - /sizeof(asn_DEF_uncertainty_tags_7[0]) - 1, /* 1 */ - asn_DEF_uncertainty_tags_7, /* Same as above */ - sizeof(asn_DEF_uncertainty_tags_7) - /sizeof(asn_DEF_uncertainty_tags_7[0]), /* 2 */ - 0, /* No PER visible constraints */ - asn_MBR_uncertainty_7, - 3, /* Elements count */ - &asn_SPC_uncertainty_specs_7 /* Additional specs */ + asn_TYPE_descriptor_t asn_DEF_uncertainty_7 = { + "uncertainty", + "uncertainty", + SEQUENCE_free, + SEQUENCE_print, + SEQUENCE_constraint, + SEQUENCE_decode_ber, + SEQUENCE_encode_der, + SEQUENCE_decode_xer, + SEQUENCE_encode_xer, + SEQUENCE_decode_uper, + SEQUENCE_encode_uper, + 0, /* Use generic outmost tag fetcher */ + asn_DEF_uncertainty_tags_7, + sizeof(asn_DEF_uncertainty_tags_7) / + sizeof(asn_DEF_uncertainty_tags_7[0]) - + 1, /* 1 */ + asn_DEF_uncertainty_tags_7, /* Same as above */ + sizeof(asn_DEF_uncertainty_tags_7) / + sizeof(asn_DEF_uncertainty_tags_7[0]), /* 2 */ + 0, /* No PER visible constraints */ + asn_MBR_uncertainty_7, + 3, /* Elements count */ + &asn_SPC_uncertainty_specs_7 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_PositionEstimate_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitudeSign), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_latitudeSign_2, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "latitudeSign" - }, - { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitude), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_latitude_constraint_1, - &ASN_PER_MEMB_LATITUDE_CONSTR_5, - 0, - "latitude" - }, - { ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, longitude), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_longitude_constraint_1, - &ASN_PER_MEMB_LONGITUDE_CONSTR_6, - 0, - "longitude" - }, - { ATF_POINTER, 3, offsetof(struct PositionEstimate, uncertainty), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - 0, - &asn_DEF_uncertainty_7, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "uncertainty" - }, - { ATF_POINTER, 2, offsetof(struct PositionEstimate, confidence), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_confidence_constraint_1, - &ASN_PER_MEMB_CONFIDENCE_CONSTR_11, - 0, - "confidence" - }, - { ATF_POINTER, 1, offsetof(struct PositionEstimate, altitudeInfo), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_AltitudeInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "altitudeInfo" - }, + {ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitudeSign), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_latitudeSign_2, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "latitudeSign"}, + {ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, latitude), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_latitude_constraint_1, + &ASN_PER_MEMB_LATITUDE_CONSTR_5, 0, "latitude"}, + {ATF_NOFLAGS, 0, offsetof(struct PositionEstimate, longitude), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_longitude_constraint_1, + &ASN_PER_MEMB_LONGITUDE_CONSTR_6, 0, "longitude"}, + {ATF_POINTER, 3, offsetof(struct PositionEstimate, uncertainty), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, &asn_DEF_uncertainty_7, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "uncertainty"}, + {ATF_POINTER, 2, offsetof(struct PositionEstimate, confidence), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_confidence_constraint_1, + &ASN_PER_MEMB_CONFIDENCE_CONSTR_11, 0, "confidence"}, + {ATF_POINTER, 1, offsetof(struct PositionEstimate, altitudeInfo), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_AltitudeInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "altitudeInfo"}, }; -static int asn_MAP_PositionEstimate_oms_1[] = { 3, 4, 5 }; +static int asn_MAP_PositionEstimate_oms_1[] = {3, 4, 5}; static ber_tlv_tag_t asn_DEF_PositionEstimate_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PositionEstimate_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* latitudeSign at 73 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* latitude at 74 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* longitude at 75 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* uncertainty at 77 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* confidence at 81 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* altitudeInfo at 82 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* latitudeSign at 73 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* latitude at 74 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* longitude at 75 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* uncertainty at 77 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* confidence at 81 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* altitudeInfo at 82 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PositionEstimate_specs_1 = { sizeof(struct PositionEstimate), offsetof(struct PositionEstimate, _asn_ctx), asn_MAP_PositionEstimate_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_PositionEstimate_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_PositionEstimate_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PositionEstimate = { "PositionEstimate", @@ -488,16 +497,15 @@ asn_TYPE_descriptor_t asn_DEF_PositionEstimate = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PositionEstimate_tags_1, - sizeof(asn_DEF_PositionEstimate_tags_1) - /sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ - asn_DEF_PositionEstimate_tags_1, /* Same as above */ - sizeof(asn_DEF_PositionEstimate_tags_1) - /sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PositionEstimate_tags_1) / + sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ + asn_DEF_PositionEstimate_tags_1, /* Same as above */ + sizeof(asn_DEF_PositionEstimate_tags_1) / + sizeof(asn_DEF_PositionEstimate_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PositionEstimate_1, - 6, /* Elements count */ - &asn_SPC_PositionEstimate_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_PositionEstimate_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PositionEstimate.h b/src/core/libs/supl/asn-supl/PositionEstimate.h index 315607195..fcbee6845 100644 --- a/src/core/libs/supl/asn-supl/PositionEstimate.h +++ b/src/core/libs/supl/asn-supl/PositionEstimate.h @@ -7,7 +7,6 @@ #ifndef _PositionEstimate_H_ #define _PositionEstimate_H_ - #include /* Including external dependencies */ @@ -48,16 +47,17 @@ extern "C" long *confidence /* OPTIONAL */; struct AltitudeInfo *altitudeInfo /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PositionEstimate_t; /* Implementation */ - /* extern asn_TYPE_descriptor_t asn_DEF_latitudeSign_2; // (Use -fall-defs-global to expose) */ + /* extern asn_TYPE_descriptor_t asn_DEF_latitudeSign_2; // (Use + * -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_PositionEstimate; #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/PrefMethod.c b/src/core/libs/supl/asn-supl/PrefMethod.c index d597e6497..aab9c63a1 100644 --- a/src/core/libs/supl/asn-supl/PrefMethod.c +++ b/src/core/libs/supl/asn-supl/PrefMethod.c @@ -6,9 +6,9 @@ #include "PrefMethod.h" -int -PrefMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int PrefMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,109 +18,119 @@ PrefMethod_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -PrefMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void PrefMethod_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -PrefMethod_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void PrefMethod_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ PrefMethod_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -PrefMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int PrefMethod_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ PrefMethod_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -PrefMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t PrefMethod_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ PrefMethod_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -PrefMethod_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PrefMethod_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ PrefMethod_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -PrefMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t PrefMethod_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ PrefMethod_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -PrefMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PrefMethod_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ PrefMethod_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -PrefMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t PrefMethod_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ PrefMethod_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -PrefMethod_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t PrefMethod_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ PrefMethod_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_PREF_METHOD_CONSTR_1 = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 2, 2, 0, 2} /* (0..2) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_PrefMethod_value2enum_1[] = { - { 0, 24, "agpsSETassistedPreferred" }, - { 1, 21, "agpsSETBasedPreferred" }, - { 2, 12, "noPreference" } -}; + {0, 24, "agpsSETassistedPreferred"}, + {1, 21, "agpsSETBasedPreferred"}, + {2, 12, "noPreference"}}; static unsigned int asn_MAP_PrefMethod_enum2value_1[] = { - 1, /* agpsSETBasedPreferred(1) */ - 0, /* agpsSETassistedPreferred(0) */ - 2 /* noPreference(2) */ + 1, /* agpsSETBasedPreferred(1) */ + 0, /* agpsSETassistedPreferred(0) */ + 2 /* noPreference(2) */ }; static asn_INTEGER_specifics_t asn_SPC_PrefMethod_specs_1 = { - asn_MAP_PrefMethod_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_PrefMethod_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_PrefMethod_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_PrefMethod_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_PrefMethod_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_PrefMethod = { "PrefMethod", "PrefMethod", @@ -133,15 +143,15 @@ asn_TYPE_descriptor_t asn_DEF_PrefMethod = { PrefMethod_encode_xer, PrefMethod_decode_uper, PrefMethod_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PrefMethod_tags_1, - sizeof(asn_DEF_PrefMethod_tags_1) - /sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ - asn_DEF_PrefMethod_tags_1, /* Same as above */ - sizeof(asn_DEF_PrefMethod_tags_1) - /sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ + sizeof(asn_DEF_PrefMethod_tags_1) / + sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ + asn_DEF_PrefMethod_tags_1, /* Same as above */ + sizeof(asn_DEF_PrefMethod_tags_1) / + sizeof(asn_DEF_PrefMethod_tags_1[0]), /* 1 */ &ASN_PER_TYPE_PREF_METHOD_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_PrefMethod_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_PrefMethod_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PrefMethod.h b/src/core/libs/supl/asn-supl/PrefMethod.h index c19c3d45e..0d37e06ee 100644 --- a/src/core/libs/supl/asn-supl/PrefMethod.h +++ b/src/core/libs/supl/asn-supl/PrefMethod.h @@ -7,7 +7,6 @@ #ifndef _PrefMethod_H_ #define _PrefMethod_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c index cb9221778..6848d22fc 100644 --- a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c +++ b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.c @@ -6,119 +6,141 @@ #include "PrimaryCCPCH-RSCP.h" -int -PrimaryCCPCH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int PrimaryCCPCH_RSCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -PrimaryCCPCH_RSCP_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void PrimaryCCPCH_RSCP_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -PrimaryCCPCH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int PrimaryCCPCH_RSCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -PrimaryCCPCH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t PrimaryCCPCH_RSCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const void *bufptr, size_t size, + int tag_mode) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -PrimaryCCPCH_RSCP_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PrimaryCCPCH_RSCP_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -PrimaryCCPCH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t PrimaryCCPCH_RSCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -PrimaryCCPCH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t PrimaryCCPCH_RSCP_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -PrimaryCCPCH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t PrimaryCCPCH_RSCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -PrimaryCCPCH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t PrimaryCCPCH_RSCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ PrimaryCCPCH_RSCP_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_PRIMARY_CCPCH_RSCP_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_PrimaryCCPCH_RSCP_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_PrimaryCCPCH_RSCP = { "PrimaryCCPCH-RSCP", "PrimaryCCPCH-RSCP", @@ -131,15 +153,15 @@ asn_TYPE_descriptor_t asn_DEF_PrimaryCCPCH_RSCP = { PrimaryCCPCH_RSCP_encode_xer, PrimaryCCPCH_RSCP_decode_uper, PrimaryCCPCH_RSCP_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PrimaryCCPCH_RSCP_tags_1, - sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) - /sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ - asn_DEF_PrimaryCCPCH_RSCP_tags_1, /* Same as above */ - sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) - /sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) / + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ + asn_DEF_PrimaryCCPCH_RSCP_tags_1, /* Same as above */ + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1) / + sizeof(asn_DEF_PrimaryCCPCH_RSCP_tags_1[0]), /* 1 */ &ASN_PER_TYPE_PRIMARY_CCPCH_RSCP_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h index 180013a7b..dfa9d6d40 100644 --- a/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h +++ b/src/core/libs/supl/asn-supl/PrimaryCCPCH-RSCP.h @@ -7,7 +7,6 @@ #ifndef _PrimaryCCPCH_RSCP_H_ #define _PrimaryCCPCH_RSCP_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c index 249c4c2ef..64cfef469 100644 --- a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c +++ b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.c @@ -6,61 +6,63 @@ #include "PrimaryCPICH-Info.h" -static int -memb_primaryScramblingCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_primaryScramblingCode_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_2 = { - { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 9, 9, 0, 511} /* (0..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_PrimaryCPICH_Info_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct PrimaryCPICH_Info, primaryScramblingCode), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_primaryScramblingCode_constraint_1, - &ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_2, - 0, - "primaryScramblingCode" - }, + {ATF_NOFLAGS, 0, offsetof(struct PrimaryCPICH_Info, primaryScramblingCode), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_primaryScramblingCode_constraint_1, + &ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_2, 0, + "primaryScramblingCode"}, }; static ber_tlv_tag_t asn_DEF_PrimaryCPICH_Info_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_PrimaryCPICH_Info_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* primaryScramblingCode at 186 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, + 0} /* primaryScramblingCode at 186 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PrimaryCPICH_Info_specs_1 = { sizeof(struct PrimaryCPICH_Info), offsetof(struct PrimaryCPICH_Info, _asn_ctx), asn_MAP_PrimaryCPICH_Info_tag2el_1, - 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 1, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PrimaryCPICH_Info = { "PrimaryCPICH-Info", @@ -74,16 +76,15 @@ asn_TYPE_descriptor_t asn_DEF_PrimaryCPICH_Info = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_PrimaryCPICH_Info_tags_1, - sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) - /sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ - asn_DEF_PrimaryCPICH_Info_tags_1, /* Same as above */ - sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) - /sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) / + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ + asn_DEF_PrimaryCPICH_Info_tags_1, /* Same as above */ + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1) / + sizeof(asn_DEF_PrimaryCPICH_Info_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_PrimaryCPICH_Info_1, - 1, /* Elements count */ - &asn_SPC_PrimaryCPICH_Info_specs_1 /* Additional specs */ + 1, /* Elements count */ + &asn_SPC_PrimaryCPICH_Info_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h index cbc3e1fef..d089cebfc 100644 --- a/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h +++ b/src/core/libs/supl/asn-supl/PrimaryCPICH-Info.h @@ -7,7 +7,6 @@ #ifndef _PrimaryCPICH_Info_H_ #define _PrimaryCPICH_Info_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/QoP.c b/src/core/libs/supl/asn-supl/QoP.c index 683249b4c..efc9a9dcf 100644 --- a/src/core/libs/supl/asn-supl/QoP.c +++ b/src/core/libs/supl/asn-supl/QoP.c @@ -6,183 +6,180 @@ #include "QoP.h" -static int -memb_horacc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_horacc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_veracc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_veracc_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_maxLocAge_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_maxLocAge_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_delay_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_delay_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 7)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 7)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_HORACC_CONSTR_2 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_VERACC_CONSTR_3 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_MAX_LOC_AGE_CONSTR_4 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_DELAY_CONSTR_5 = { - { APC_CONSTRAINED, 3, 3, 0, 7 } /* (0..7) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 3, 3, 0, 7} /* (0..7) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_QoP_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct QoP, horacc), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_horacc_constraint_1, - &ASN_PER_MEMB_HORACC_CONSTR_2, - 0, - "horacc" - }, - { ATF_POINTER, 3, offsetof(struct QoP, veracc), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_veracc_constraint_1, - &ASN_PER_MEMB_VERACC_CONSTR_3, - 0, - "veracc" - }, - { ATF_POINTER, 2, offsetof(struct QoP, maxLocAge), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_maxLocAge_constraint_1, - &ASN_PER_MEMB_MAX_LOC_AGE_CONSTR_4, - 0, - "maxLocAge" - }, - { ATF_POINTER, 1, offsetof(struct QoP, delay), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_delay_constraint_1, - &ASN_PER_MEMB_DELAY_CONSTR_5, - 0, - "delay" - }, + {ATF_NOFLAGS, 0, offsetof(struct QoP, horacc), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_horacc_constraint_1, + &ASN_PER_MEMB_HORACC_CONSTR_2, 0, "horacc"}, + {ATF_POINTER, 3, offsetof(struct QoP, veracc), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_veracc_constraint_1, + &ASN_PER_MEMB_VERACC_CONSTR_3, 0, "veracc"}, + {ATF_POINTER, 2, offsetof(struct QoP, maxLocAge), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_maxLocAge_constraint_1, + &ASN_PER_MEMB_MAX_LOC_AGE_CONSTR_4, 0, "maxLocAge"}, + {ATF_POINTER, 1, offsetof(struct QoP, delay), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_delay_constraint_1, + &ASN_PER_MEMB_DELAY_CONSTR_5, 0, "delay"}, }; -static int asn_MAP_QoP_oms_1[] = { 1, 2, 3 }; +static int asn_MAP_QoP_oms_1[] = {1, 2, 3}; static ber_tlv_tag_t asn_DEF_QoP_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_QoP_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* horacc at 219 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* veracc at 220 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* maxLocAge at 221 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* delay at 222 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* horacc at 219 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* veracc at 220 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* maxLocAge at 221 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* delay at 222 */ }; static asn_SEQUENCE_specifics_t asn_SPC_QoP_specs_1 = { sizeof(struct QoP), offsetof(struct QoP, _asn_ctx), asn_MAP_QoP_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_QoP_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 3, /* Start extensions */ - 5 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_QoP_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 3, /* Start extensions */ + 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_QoP = { "QoP", @@ -196,16 +193,13 @@ asn_TYPE_descriptor_t asn_DEF_QoP = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_QoP_tags_1, - sizeof(asn_DEF_QoP_tags_1) - /sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ - asn_DEF_QoP_tags_1, /* Same as above */ - sizeof(asn_DEF_QoP_tags_1) - /sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_QoP_tags_1) / sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ + asn_DEF_QoP_tags_1, /* Same as above */ + sizeof(asn_DEF_QoP_tags_1) / sizeof(asn_DEF_QoP_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_QoP_1, - 4, /* Elements count */ - &asn_SPC_QoP_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_QoP_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/QoP.h b/src/core/libs/supl/asn-supl/QoP.h index a823de318..781b2d79f 100644 --- a/src/core/libs/supl/asn-supl/QoP.h +++ b/src/core/libs/supl/asn-supl/QoP.h @@ -7,7 +7,6 @@ #ifndef _QoP_H_ #define _QoP_H_ - #include /* Including external dependencies */ @@ -27,9 +26,9 @@ extern "C" long *maxLocAge /* OPTIONAL */; long *delay /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/RequestedAssistData.c b/src/core/libs/supl/asn-supl/RequestedAssistData.c index 722875743..3fd81c0c3 100644 --- a/src/core/libs/supl/asn-supl/RequestedAssistData.c +++ b/src/core/libs/supl/asn-supl/RequestedAssistData.c @@ -7,122 +7,98 @@ #include "RequestedAssistData.h" static asn_TYPE_member_t asn_MBR_RequestedAssistData_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, almanacRequested), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "almanacRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, utcModelRequested), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "utcModelRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, ionosphericModelRequested), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ionosphericModelRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, dgpsCorrectionsRequested), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "dgpsCorrectionsRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, referenceLocationRequested), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceLocationRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, referenceTimeRequested), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "referenceTimeRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, acquisitionAssistanceRequested), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "acquisitionAssistanceRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, realTimeIntegrityRequested), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "realTimeIntegrityRequested" - }, - { ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, navigationModelRequested), - (ASN_TAG_CLASS_CONTEXT | (8 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BOOLEAN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "navigationModelRequested" - }, - { ATF_POINTER, 1, offsetof(struct RequestedAssistData, navigationModelData), - (ASN_TAG_CLASS_CONTEXT | (9 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_XNavigationModel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "navigationModelData" - }, + {ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, almanacRequested), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "almanacRequested"}, + {ATF_NOFLAGS, 0, offsetof(struct RequestedAssistData, utcModelRequested), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "utcModelRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, ionosphericModelRequested), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ionosphericModelRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, dgpsCorrectionsRequested), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "dgpsCorrectionsRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, referenceLocationRequested), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceLocationRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, referenceTimeRequested), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "referenceTimeRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, acquisitionAssistanceRequested), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "acquisitionAssistanceRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, realTimeIntegrityRequested), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "realTimeIntegrityRequested"}, + {ATF_NOFLAGS, 0, + offsetof(struct RequestedAssistData, navigationModelRequested), + (ASN_TAG_CLASS_CONTEXT | (8 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BOOLEAN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "navigationModelRequested"}, + {ATF_POINTER, 1, offsetof(struct RequestedAssistData, navigationModelData), + (ASN_TAG_CLASS_CONTEXT | (9 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_XNavigationModel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "navigationModelData"}, }; -static int asn_MAP_RequestedAssistData_oms_1[] = { 9 }; +static int asn_MAP_RequestedAssistData_oms_1[] = {9}; static ber_tlv_tag_t asn_DEF_RequestedAssistData_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_RequestedAssistData_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* almanacRequested at 24 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* utcModelRequested at 25 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ionosphericModelRequested at 26 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* dgpsCorrectionsRequested at 27 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* referenceLocationRequested at 28 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* referenceTimeRequested at 29 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* acquisitionAssistanceRequested at 30 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* realTimeIntegrityRequested at 31 */ - { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* navigationModelRequested at 32 */ - { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* navigationModelData at 33 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* almanacRequested at 24 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* utcModelRequested at 25 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, + 0}, /* ionosphericModelRequested at 26 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, + 0}, /* dgpsCorrectionsRequested at 27 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* referenceLocationRequested at 28 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0}, /* referenceTimeRequested at 29 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, + 0}, /* acquisitionAssistanceRequested at 30 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, + 0}, /* realTimeIntegrityRequested at 31 */ + {(ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, + 0}, /* navigationModelRequested at 32 */ + {(ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, + 0} /* navigationModelData at 33 */ }; static asn_SEQUENCE_specifics_t asn_SPC_RequestedAssistData_specs_1 = { sizeof(struct RequestedAssistData), offsetof(struct RequestedAssistData, _asn_ctx), asn_MAP_RequestedAssistData_tag2el_1, - 10, /* Count of tags in the map */ - asn_MAP_RequestedAssistData_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 9, /* Start extensions */ - 11 /* Stop extensions */ + 10, /* Count of tags in the map */ + asn_MAP_RequestedAssistData_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 9, /* Start extensions */ + 11 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_RequestedAssistData = { "RequestedAssistData", @@ -136,16 +112,15 @@ asn_TYPE_descriptor_t asn_DEF_RequestedAssistData = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_RequestedAssistData_tags_1, - sizeof(asn_DEF_RequestedAssistData_tags_1) - /sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ - asn_DEF_RequestedAssistData_tags_1, /* Same as above */ - sizeof(asn_DEF_RequestedAssistData_tags_1) - /sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_RequestedAssistData_tags_1) / + sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ + asn_DEF_RequestedAssistData_tags_1, /* Same as above */ + sizeof(asn_DEF_RequestedAssistData_tags_1) / + sizeof(asn_DEF_RequestedAssistData_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_RequestedAssistData_1, - 10, /* Elements count */ - &asn_SPC_RequestedAssistData_specs_1 /* Additional specs */ + 10, /* Elements count */ + &asn_SPC_RequestedAssistData_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/RequestedAssistData.h b/src/core/libs/supl/asn-supl/RequestedAssistData.h index feeb593ce..6a31260fb 100644 --- a/src/core/libs/supl/asn-supl/RequestedAssistData.h +++ b/src/core/libs/supl/asn-supl/RequestedAssistData.h @@ -7,7 +7,6 @@ #ifndef _RequestedAssistData_H_ #define _RequestedAssistData_H_ - #include /* Including external dependencies */ @@ -36,9 +35,9 @@ extern "C" BOOLEAN_t navigationModelRequested; struct XNavigationModel *navigationModelData /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SETAuthKey.c b/src/core/libs/supl/asn-supl/SETAuthKey.c index c1f005586..191b18c66 100644 --- a/src/core/libs/supl/asn-supl/SETAuthKey.c +++ b/src/core/libs/supl/asn-supl/SETAuthKey.c @@ -6,18 +6,18 @@ #include "SETAuthKey.h" -static int -memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -38,25 +38,24 @@ memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -77,9 +76,8 @@ memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -87,35 +85,30 @@ memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_SHORT_KEY_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_LONG_KEY_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 256, 256} /* (SIZE(256..256)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_TYPE_SET_AUTH_KEY_CONSTR_1 = { {APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1} /* (0..1,...) */, {APC_UNCONSTRAINED, -1, -1, 0, 0}, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = { {ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.shortKey), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_shortKey_constraint_1, - &ASN_PER_MEMB_SHORT_KEY_CONSTR_2, - 0, - "shortKey"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_shortKey_constraint_1, + &ASN_PER_MEMB_SHORT_KEY_CONSTR_2, 0, "shortKey"}, {ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.longKey), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_longKey_constraint_1, - &ASN_PER_MEMB_LONG_KEY_CONSTR_3, - 0, - "longKey"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_longKey_constraint_1, + &ASN_PER_MEMB_LONG_KEY_CONSTR_3, 0, "longKey"}, }; static asn_TYPE_tag2member_t asn_MAP_SETAuthKey_tag2el_1[] = { {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* shortKey at 17 */ diff --git a/src/core/libs/supl/asn-supl/SETAuthKey.h b/src/core/libs/supl/asn-supl/SETAuthKey.h index 1a441078e..9e3a42221 100644 --- a/src/core/libs/supl/asn-supl/SETAuthKey.h +++ b/src/core/libs/supl/asn-supl/SETAuthKey.h @@ -7,7 +7,6 @@ #ifndef _SETAuthKey_H_ #define _SETAuthKey_H_ - #include /* Including external dependencies */ @@ -37,9 +36,9 @@ extern "C" BIT_STRING_t shortKey; BIT_STRING_t longKey; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/SETCapabilities.c b/src/core/libs/supl/asn-supl/SETCapabilities.c index 32327084b..3f2cff2e4 100644 --- a/src/core/libs/supl/asn-supl/SETCapabilities.c +++ b/src/core/libs/supl/asn-supl/SETCapabilities.c @@ -7,50 +7,41 @@ #include "SETCapabilities.h" static asn_TYPE_member_t asn_MBR_SETCapabilities_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posTechnology), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PosTechnology, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posTechnology" - }, - { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, prefMethod), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PrefMethod, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "prefMethod" - }, - { ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posProtocol), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PosProtocol, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posProtocol" - }, + {ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posTechnology), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosTechnology, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posTechnology"}, + {ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, prefMethod), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PrefMethod, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "prefMethod"}, + {ATF_NOFLAGS, 0, offsetof(struct SETCapabilities, posProtocol), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosProtocol, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posProtocol"}, }; static ber_tlv_tag_t asn_DEF_SETCapabilities_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SETCapabilities_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posTechnology at 16 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* prefMethod at 17 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* posProtocol at 18 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* posTechnology at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* prefMethod at 17 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* posProtocol at 18 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SETCapabilities_specs_1 = { sizeof(struct SETCapabilities), offsetof(struct SETCapabilities, _asn_ctx), asn_MAP_SETCapabilities_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SETCapabilities = { "SETCapabilities", @@ -64,16 +55,15 @@ asn_TYPE_descriptor_t asn_DEF_SETCapabilities = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SETCapabilities_tags_1, - sizeof(asn_DEF_SETCapabilities_tags_1) - /sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ - asn_DEF_SETCapabilities_tags_1, /* Same as above */ - sizeof(asn_DEF_SETCapabilities_tags_1) - /sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SETCapabilities_tags_1) / + sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ + asn_DEF_SETCapabilities_tags_1, /* Same as above */ + sizeof(asn_DEF_SETCapabilities_tags_1) / + sizeof(asn_DEF_SETCapabilities_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SETCapabilities_1, - 3, /* Elements count */ - &asn_SPC_SETCapabilities_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_SETCapabilities_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SETCapabilities.h b/src/core/libs/supl/asn-supl/SETCapabilities.h index 333ecbb62..f0aab53f7 100644 --- a/src/core/libs/supl/asn-supl/SETCapabilities.h +++ b/src/core/libs/supl/asn-supl/SETCapabilities.h @@ -7,7 +7,6 @@ #ifndef _SETCapabilities_H_ #define _SETCapabilities_H_ - #include /* Including external dependencies */ @@ -28,9 +27,9 @@ extern "C" PrefMethod_t prefMethod; PosProtocol_t posProtocol; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SETId.c b/src/core/libs/supl/asn-supl/SETId.c index d7c500d7a..e8688d518 100644 --- a/src/core/libs/supl/asn-supl/SETId.c +++ b/src/core/libs/supl/asn-supl/SETId.c @@ -21,18 +21,17 @@ static int check_permitted_alphabet_6(const void *sptr) return 0; } -static int -memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -45,25 +44,23 @@ memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -76,25 +73,23 @@ memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -115,25 +110,23 @@ memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -146,25 +139,23 @@ memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } -static int -memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -177,9 +168,8 @@ memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -187,82 +177,65 @@ memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_MSISDN_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_MDN_CONSTR_3 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_MIN_CONSTR_4 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 34, 34} /* (SIZE(34..34)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_IMSI_CONSTR_5 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_NAI_CONSTR_6 = { {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, {APC_CONSTRAINED, 10, 10, 1, 1000} /* (SIZE(1..1000)) */, - 0, 0 /* No PER character map necessary */ + 0, + 0 /* No PER character map necessary */ }; static asn_per_constraints_t ASN_PER_TYPE_SET_ID_CONSTR_1 = { {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5} /* (0..5,...) */, {APC_UNCONSTRAINED, -1, -1, 0, 0}, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SETId_1[] = { {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.msisdn), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_msisdn_constraint_1, - &ASN_PER_MEMB_MSISDN_CONSTR_2, - 0, - "msisdn"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_msisdn_constraint_1, + &ASN_PER_MEMB_MSISDN_CONSTR_2, 0, "msisdn"}, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.mdn), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_mdn_constraint_1, - &ASN_PER_MEMB_MDN_CONSTR_3, - 0, - "mdn"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_mdn_constraint_1, &ASN_PER_MEMB_MDN_CONSTR_3, + 0, "mdn"}, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.min), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_BIT_STRING, - memb_min_constraint_1, - &ASN_PER_MEMB_MIN_CONSTR_4, - 0, - "min"}, + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_BIT_STRING, memb_min_constraint_1, &ASN_PER_MEMB_MIN_CONSTR_4, 0, + "min"}, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_imsi_constraint_1, - &ASN_PER_MEMB_IMSI_CONSTR_5, - 0, - "imsi"}, + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_imsi_constraint_1, &ASN_PER_MEMB_IMSI_CONSTR_5, + 0, "imsi"}, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_IA5String, - memb_nai_constraint_1, - &ASN_PER_MEMB_NAI_CONSTR_6, - 0, - "nai"}, + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_IA5String, memb_nai_constraint_1, &ASN_PER_MEMB_NAI_CONSTR_6, 0, + "nai"}, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_IPAddress, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "iPAddress"}, + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_IPAddress, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "iPAddress"}, }; static asn_TYPE_tag2member_t asn_MAP_SETId_tag2el_1[] = { {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msisdn at 22 */ diff --git a/src/core/libs/supl/asn-supl/SETId.h b/src/core/libs/supl/asn-supl/SETId.h index 28f49c6b2..4325e0466 100644 --- a/src/core/libs/supl/asn-supl/SETId.h +++ b/src/core/libs/supl/asn-supl/SETId.h @@ -7,7 +7,6 @@ #ifndef _SETId_H_ #define _SETId_H_ - #include /* Including external dependencies */ @@ -48,9 +47,9 @@ extern "C" IA5String_t nai; IPAddress_t iPAddress; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/SLPAddress.c b/src/core/libs/supl/asn-supl/SLPAddress.c index 2a1233615..fa06110ea 100644 --- a/src/core/libs/supl/asn-supl/SLPAddress.c +++ b/src/core/libs/supl/asn-supl/SLPAddress.c @@ -7,33 +7,26 @@ #include "SLPAddress.h" static asn_per_constraints_t ASN_PER_TYPE_SLP_ADDRESS_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1} /* (0..1,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SLPAddress_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.iPAddress), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_IPAddress, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "iPAddress" - }, - { ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.fQDN), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FQDN, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "fQDN" - }, + {ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.iPAddress), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_IPAddress, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "iPAddress"}, + {ATF_NOFLAGS, 0, offsetof(struct SLPAddress, choice.fQDN), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FQDN, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "fQDN"}, }; static asn_TYPE_tag2member_t asn_MAP_SLPAddress_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* iPAddress at 44 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* fQDN at 45 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* iPAddress at 44 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* fQDN at 45 */ }; static asn_CHOICE_specifics_t asn_SPC_SLPAddress_specs_1 = { sizeof(struct SLPAddress), @@ -41,9 +34,9 @@ static asn_CHOICE_specifics_t asn_SPC_SLPAddress_specs_1 = { offsetof(struct SLPAddress, present), sizeof(((struct SLPAddress *)0)->present), asn_MAP_SLPAddress_tag2el_1, - 2, /* Count of tags in the map */ + 2, /* Count of tags in the map */ 0, - 2 /* Extensions start */ + 2 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_SLPAddress = { "SLPAddress", @@ -58,13 +51,12 @@ asn_TYPE_descriptor_t asn_DEF_SLPAddress = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_SLP_ADDRESS_CONSTR_1, asn_MBR_SLPAddress_1, - 2, /* Elements count */ - &asn_SPC_SLPAddress_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SLPAddress_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SLPAddress.h b/src/core/libs/supl/asn-supl/SLPAddress.h index bbcecf4a5..b11440882 100644 --- a/src/core/libs/supl/asn-supl/SLPAddress.h +++ b/src/core/libs/supl/asn-supl/SLPAddress.h @@ -7,7 +7,6 @@ #ifndef _SLPAddress_H_ #define _SLPAddress_H_ - #include /* Including external dependencies */ @@ -38,9 +37,9 @@ extern "C" IPAddress_t iPAddress; FQDN_t fQDN; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/SLPMode.c b/src/core/libs/supl/asn-supl/SLPMode.c index 00564fc55..242f06f91 100644 --- a/src/core/libs/supl/asn-supl/SLPMode.c +++ b/src/core/libs/supl/asn-supl/SLPMode.c @@ -6,9 +6,9 @@ #include "SLPMode.h" -int -SLPMode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SLPMode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,107 +18,114 @@ SLPMode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -SLPMode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void SLPMode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -SLPMode_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void SLPMode_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ SLPMode_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -SLPMode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int SLPMode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ SLPMode_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -SLPMode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t SLPMode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ SLPMode_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -SLPMode_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SLPMode_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ SLPMode_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -SLPMode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t SLPMode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ SLPMode_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -SLPMode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SLPMode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ SLPMode_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -SLPMode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t SLPMode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ SLPMode_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -SLPMode_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t SLPMode_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ SLPMode_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_SLP_MODE_CONSTR_1 = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_SLPMode_value2enum_1[] = { - { 0, 5, "proxy" }, - { 1, 8, "nonProxy" } -}; + {0, 5, "proxy"}, {1, 8, "nonProxy"}}; static unsigned int asn_MAP_SLPMode_enum2value_1[] = { - 1, /* nonProxy(1) */ - 0 /* proxy(0) */ + 1, /* nonProxy(1) */ + 0 /* proxy(0) */ }; static asn_INTEGER_specifics_t asn_SPC_SLPMode_specs_1 = { - asn_MAP_SLPMode_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_SLPMode_enum2value_1, /* N => "tag"; sorted by N */ - 2, /* Number of elements in the maps */ - 0, /* Enumeration is not extensible */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_SLPMode_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_SLPMode_enum2value_1, /* N => "tag"; sorted by N */ + 2, /* Number of elements in the maps */ + 0, /* Enumeration is not extensible */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_SLPMode_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_SLPMode = { "SLPMode", "SLPMode", @@ -131,15 +138,13 @@ asn_TYPE_descriptor_t asn_DEF_SLPMode = { SLPMode_encode_xer, SLPMode_decode_uper, SLPMode_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SLPMode_tags_1, - sizeof(asn_DEF_SLPMode_tags_1) - /sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ - asn_DEF_SLPMode_tags_1, /* Same as above */ - sizeof(asn_DEF_SLPMode_tags_1) - /sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SLPMode_tags_1) / sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ + asn_DEF_SLPMode_tags_1, /* Same as above */ + sizeof(asn_DEF_SLPMode_tags_1) / sizeof(asn_DEF_SLPMode_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SLP_MODE_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_SLPMode_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_SLPMode_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SLPMode.h b/src/core/libs/supl/asn-supl/SLPMode.h index 997473dd7..628bae243 100644 --- a/src/core/libs/supl/asn-supl/SLPMode.h +++ b/src/core/libs/supl/asn-supl/SLPMode.h @@ -7,7 +7,6 @@ #ifndef _SLPMode_H_ #define _SLPMode_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/SUPLEND.c b/src/core/libs/supl/asn-supl/SUPLEND.c index b9862b334..e38c58084 100644 --- a/src/core/libs/supl/asn-supl/SUPLEND.c +++ b/src/core/libs/supl/asn-supl/SUPLEND.c @@ -7,52 +7,40 @@ #include "SUPLEND.h" static asn_TYPE_member_t asn_MBR_SUPLEND_1[] = { - { ATF_POINTER, 3, offsetof(struct SUPLEND, position), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Position, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "position" - }, - { ATF_POINTER, 2, offsetof(struct SUPLEND, statusCode), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_StatusCode, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "statusCode" - }, - { ATF_POINTER, 1, offsetof(struct SUPLEND, ver), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ver, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ver" - }, + {ATF_POINTER, 3, offsetof(struct SUPLEND, position), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Position, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "position"}, + {ATF_POINTER, 2, offsetof(struct SUPLEND, statusCode), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_StatusCode, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "statusCode"}, + {ATF_POINTER, 1, offsetof(struct SUPLEND, ver), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ver, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ver"}, }; -static int asn_MAP_SUPLEND_oms_1[] = { 0, 1, 2 }; +static int asn_MAP_SUPLEND_oms_1[] = {0, 1, 2}; static ber_tlv_tag_t asn_DEF_SUPLEND_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLEND_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* position at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* statusCode at 11 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ver at 12 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* position at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* statusCode at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* ver at 12 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLEND_specs_1 = { sizeof(struct SUPLEND), offsetof(struct SUPLEND, _asn_ctx), asn_MAP_SUPLEND_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_SUPLEND_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_SUPLEND_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLEND = { "SUPLEND", @@ -66,16 +54,13 @@ asn_TYPE_descriptor_t asn_DEF_SUPLEND = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLEND_tags_1, - sizeof(asn_DEF_SUPLEND_tags_1) - /sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ - asn_DEF_SUPLEND_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLEND_tags_1) - /sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLEND_tags_1) / sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ + asn_DEF_SUPLEND_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLEND_tags_1) / sizeof(asn_DEF_SUPLEND_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLEND_1, - 3, /* Elements count */ - &asn_SPC_SUPLEND_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_SUPLEND_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLEND.h b/src/core/libs/supl/asn-supl/SUPLEND.h index 37bd2a00a..aa09a53c8 100644 --- a/src/core/libs/supl/asn-supl/SUPLEND.h +++ b/src/core/libs/supl/asn-supl/SUPLEND.h @@ -7,7 +7,6 @@ #ifndef _SUPLEND_H_ #define _SUPLEND_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" StatusCode_t *statusCode /* OPTIONAL */; Ver_t *ver /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SUPLINIT.c b/src/core/libs/supl/asn-supl/SUPLINIT.c index 6a1091bbd..2455edde4 100644 --- a/src/core/libs/supl/asn-supl/SUPLINIT.c +++ b/src/core/libs/supl/asn-supl/SUPLINIT.c @@ -7,92 +7,66 @@ #include "SUPLINIT.h" static asn_TYPE_member_t asn_MBR_SUPLINIT_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, posMethod), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PosMethod, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posMethod" - }, - { ATF_POINTER, 3, offsetof(struct SUPLINIT, notification), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Notification, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "notification" - }, - { ATF_POINTER, 2, offsetof(struct SUPLINIT, sLPAddress), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SLPAddress, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sLPAddress" - }, - { ATF_POINTER, 1, offsetof(struct SUPLINIT, qoP), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_QoP, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "qoP" - }, - { ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, sLPMode), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SLPMode, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sLPMode" - }, - { ATF_POINTER, 2, offsetof(struct SUPLINIT, mAC), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MAC, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "mAC" - }, - { ATF_POINTER, 1, offsetof(struct SUPLINIT, keyIdentity), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_KeyIdentity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "keyIdentity" - }, + {ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, posMethod), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosMethod, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posMethod"}, + {ATF_POINTER, 3, offsetof(struct SUPLINIT, notification), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Notification, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "notification"}, + {ATF_POINTER, 2, offsetof(struct SUPLINIT, sLPAddress), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sLPAddress"}, + {ATF_POINTER, 1, offsetof(struct SUPLINIT, qoP), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_QoP, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "qoP"}, + {ATF_NOFLAGS, 0, offsetof(struct SUPLINIT, sLPMode), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SLPMode, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sLPMode"}, + {ATF_POINTER, 2, offsetof(struct SUPLINIT, mAC), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MAC, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "mAC"}, + {ATF_POINTER, 1, offsetof(struct SUPLINIT, keyIdentity), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_KeyIdentity, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "keyIdentity"}, }; -static int asn_MAP_SUPLINIT_oms_1[] = { 1, 2, 3, 5, 6 }; +static int asn_MAP_SUPLINIT_oms_1[] = {1, 2, 3, 5, 6}; static ber_tlv_tag_t asn_DEF_SUPLINIT_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLINIT_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posMethod at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* notification at 11 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sLPAddress at 12 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* qoP at 13 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sLPMode at 14 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* mAC at 15 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 } /* keyIdentity at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* posMethod at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* notification at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* sLPAddress at 12 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* qoP at 13 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* sLPMode at 14 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* mAC at 15 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0} /* keyIdentity at 16 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLINIT_specs_1 = { sizeof(struct SUPLINIT), offsetof(struct SUPLINIT, _asn_ctx), asn_MAP_SUPLINIT_tag2el_1, - 7, /* Count of tags in the map */ - asn_MAP_SUPLINIT_oms_1, /* Optional members */ - 5, 0, /* Root/Additions */ - 6, /* Start extensions */ - 8 /* Stop extensions */ + 7, /* Count of tags in the map */ + asn_MAP_SUPLINIT_oms_1, /* Optional members */ + 5, + 0, /* Root/Additions */ + 6, /* Start extensions */ + 8 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLINIT = { "SUPLINIT", @@ -106,16 +80,15 @@ asn_TYPE_descriptor_t asn_DEF_SUPLINIT = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLINIT_tags_1, - sizeof(asn_DEF_SUPLINIT_tags_1) - /sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ - asn_DEF_SUPLINIT_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLINIT_tags_1) - /sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLINIT_tags_1) / + sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ + asn_DEF_SUPLINIT_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLINIT_tags_1) / + sizeof(asn_DEF_SUPLINIT_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLINIT_1, - 7, /* Elements count */ - &asn_SPC_SUPLINIT_specs_1 /* Additional specs */ + 7, /* Elements count */ + &asn_SPC_SUPLINIT_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLINIT.h b/src/core/libs/supl/asn-supl/SUPLINIT.h index 385772262..c79b4e04f 100644 --- a/src/core/libs/supl/asn-supl/SUPLINIT.h +++ b/src/core/libs/supl/asn-supl/SUPLINIT.h @@ -7,7 +7,6 @@ #ifndef _SUPLINIT_H_ #define _SUPLINIT_H_ - #include /* Including external dependencies */ @@ -38,9 +37,9 @@ extern "C" MAC_t *mAC /* OPTIONAL */; KeyIdentity_t *keyIdentity /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SUPLPOS.c b/src/core/libs/supl/asn-supl/SUPLPOS.c index 3df5b49ef..1f5e63c53 100644 --- a/src/core/libs/supl/asn-supl/SUPLPOS.c +++ b/src/core/libs/supl/asn-supl/SUPLPOS.c @@ -7,42 +7,34 @@ #include "SUPLPOS.h" static asn_TYPE_member_t asn_MBR_SUPLPOS_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SUPLPOS, posPayLoad), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_PosPayLoad, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posPayLoad" - }, - { ATF_POINTER, 1, offsetof(struct SUPLPOS, velocity), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_Velocity, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "velocity" - }, + {ATF_NOFLAGS, 0, offsetof(struct SUPLPOS, posPayLoad), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_PosPayLoad, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posPayLoad"}, + {ATF_POINTER, 1, offsetof(struct SUPLPOS, velocity), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_Velocity, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "velocity"}, }; -static int asn_MAP_SUPLPOS_oms_1[] = { 1 }; +static int asn_MAP_SUPLPOS_oms_1[] = {1}; static ber_tlv_tag_t asn_DEF_SUPLPOS_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLPOS_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posPayLoad at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* velocity at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* posPayLoad at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* velocity at 11 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLPOS_specs_1 = { sizeof(struct SUPLPOS), offsetof(struct SUPLPOS, _asn_ctx), asn_MAP_SUPLPOS_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_SUPLPOS_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_SUPLPOS_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLPOS = { "SUPLPOS", @@ -56,16 +48,13 @@ asn_TYPE_descriptor_t asn_DEF_SUPLPOS = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLPOS_tags_1, - sizeof(asn_DEF_SUPLPOS_tags_1) - /sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ - asn_DEF_SUPLPOS_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLPOS_tags_1) - /sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLPOS_tags_1) / sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ + asn_DEF_SUPLPOS_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLPOS_tags_1) / sizeof(asn_DEF_SUPLPOS_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLPOS_1, - 2, /* Elements count */ - &asn_SPC_SUPLPOS_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SUPLPOS_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLPOS.h b/src/core/libs/supl/asn-supl/SUPLPOS.h index 9f67ec3da..a8ca8d466 100644 --- a/src/core/libs/supl/asn-supl/SUPLPOS.h +++ b/src/core/libs/supl/asn-supl/SUPLPOS.h @@ -7,7 +7,6 @@ #ifndef _SUPLPOS_H_ #define _SUPLPOS_H_ - #include /* Including external dependencies */ @@ -28,9 +27,9 @@ extern "C" PosPayLoad_t posPayLoad; struct Velocity *velocity /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SUPLPOSINIT.c b/src/core/libs/supl/asn-supl/SUPLPOSINIT.c index 4ffd7b6a8..b8e38cf04 100644 --- a/src/core/libs/supl/asn-supl/SUPLPOSINIT.c +++ b/src/core/libs/supl/asn-supl/SUPLPOSINIT.c @@ -7,82 +7,61 @@ #include "SUPLPOSINIT.h" static asn_TYPE_member_t asn_MBR_SUPLPOSINIT_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, sETCapabilities), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SETCapabilities, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sETCapabilities" - }, - { ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, requestedAssistData), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_RequestedAssistData, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "requestedAssistData" - }, - { ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, locationId), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LocationId, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "locationId" - }, - { ATF_POINTER, 3, offsetof(struct SUPLPOSINIT, position), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Position, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "position" - }, - { ATF_POINTER, 2, offsetof(struct SUPLPOSINIT, sUPLPOS), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLPOS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sUPLPOS" - }, - { ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, ver), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Ver, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "ver" - }, + {ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, sETCapabilities), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SETCapabilities, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sETCapabilities"}, + {ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, requestedAssistData), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_RequestedAssistData, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "requestedAssistData"}, + {ATF_NOFLAGS, 0, offsetof(struct SUPLPOSINIT, locationId), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationId, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "locationId"}, + {ATF_POINTER, 3, offsetof(struct SUPLPOSINIT, position), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Position, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "position"}, + {ATF_POINTER, 2, offsetof(struct SUPLPOSINIT, sUPLPOS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOS, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sUPLPOS"}, + {ATF_POINTER, 1, offsetof(struct SUPLPOSINIT, ver), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Ver, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "ver"}, }; -static int asn_MAP_SUPLPOSINIT_oms_1[] = { 1, 3, 4, 5 }; +static int asn_MAP_SUPLPOSINIT_oms_1[] = {1, 3, 4, 5}; static ber_tlv_tag_t asn_DEF_SUPLPOSINIT_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLPOSINIT_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sETCapabilities at 15 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* requestedAssistData at 16 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* locationId at 17 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* position at 18 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* sUPLPOS at 19 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* ver at 20 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sETCapabilities at 15 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, + 0}, /* requestedAssistData at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* locationId at 17 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* position at 18 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* sUPLPOS at 19 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* ver at 20 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLPOSINIT_specs_1 = { sizeof(struct SUPLPOSINIT), offsetof(struct SUPLPOSINIT, _asn_ctx), asn_MAP_SUPLPOSINIT_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_SUPLPOSINIT_oms_1, /* Optional members */ - 4, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_SUPLPOSINIT_oms_1, /* Optional members */ + 4, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLPOSINIT = { "SUPLPOSINIT", @@ -96,16 +75,15 @@ asn_TYPE_descriptor_t asn_DEF_SUPLPOSINIT = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLPOSINIT_tags_1, - sizeof(asn_DEF_SUPLPOSINIT_tags_1) - /sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ - asn_DEF_SUPLPOSINIT_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLPOSINIT_tags_1) - /sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLPOSINIT_tags_1) / + sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ + asn_DEF_SUPLPOSINIT_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLPOSINIT_tags_1) / + sizeof(asn_DEF_SUPLPOSINIT_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLPOSINIT_1, - 6, /* Elements count */ - &asn_SPC_SUPLPOSINIT_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_SUPLPOSINIT_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLPOSINIT.h b/src/core/libs/supl/asn-supl/SUPLPOSINIT.h index 27794417e..789842aea 100644 --- a/src/core/libs/supl/asn-supl/SUPLPOSINIT.h +++ b/src/core/libs/supl/asn-supl/SUPLPOSINIT.h @@ -7,7 +7,6 @@ #ifndef _SUPLPOSINIT_H_ #define _SUPLPOSINIT_H_ - #include /* Including external dependencies */ @@ -36,9 +35,9 @@ extern "C" struct SUPLPOS *sUPLPOS /* OPTIONAL */; Ver_t *ver /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SUPLRESPONSE.c b/src/core/libs/supl/asn-supl/SUPLRESPONSE.c index 88704ba8b..c6f383aa8 100644 --- a/src/core/libs/supl/asn-supl/SUPLRESPONSE.c +++ b/src/core/libs/supl/asn-supl/SUPLRESPONSE.c @@ -7,62 +7,47 @@ #include "SUPLRESPONSE.h" static asn_TYPE_member_t asn_MBR_SUPLRESPONSE_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SUPLRESPONSE, posMethod), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_PosMethod, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "posMethod" - }, - { ATF_POINTER, 3, offsetof(struct SUPLRESPONSE, sLPAddress), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SLPAddress, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sLPAddress" - }, - { ATF_POINTER, 2, offsetof(struct SUPLRESPONSE, sETAuthKey), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SETAuthKey, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sETAuthKey" - }, - { ATF_POINTER, 1, offsetof(struct SUPLRESPONSE, keyIdentity4), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_KeyIdentity4, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "keyIdentity4" - }, + {ATF_NOFLAGS, 0, offsetof(struct SUPLRESPONSE, posMethod), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_PosMethod, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "posMethod"}, + {ATF_POINTER, 3, offsetof(struct SUPLRESPONSE, sLPAddress), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sLPAddress"}, + {ATF_POINTER, 2, offsetof(struct SUPLRESPONSE, sETAuthKey), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SETAuthKey, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sETAuthKey"}, + {ATF_POINTER, 1, offsetof(struct SUPLRESPONSE, keyIdentity4), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_KeyIdentity4, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "keyIdentity4"}, }; -static int asn_MAP_SUPLRESPONSE_oms_1[] = { 1, 2, 3 }; +static int asn_MAP_SUPLRESPONSE_oms_1[] = {1, 2, 3}; static ber_tlv_tag_t asn_DEF_SUPLRESPONSE_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLRESPONSE_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* posMethod at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sLPAddress at 11 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sETAuthKey at 12 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* keyIdentity4 at 13 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* posMethod at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* sLPAddress at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* sETAuthKey at 12 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* keyIdentity4 at 13 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLRESPONSE_specs_1 = { sizeof(struct SUPLRESPONSE), offsetof(struct SUPLRESPONSE, _asn_ctx), asn_MAP_SUPLRESPONSE_tag2el_1, - 4, /* Count of tags in the map */ - asn_MAP_SUPLRESPONSE_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 3, /* Start extensions */ - 5 /* Stop extensions */ + 4, /* Count of tags in the map */ + asn_MAP_SUPLRESPONSE_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 3, /* Start extensions */ + 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLRESPONSE = { "SUPLRESPONSE", @@ -76,16 +61,15 @@ asn_TYPE_descriptor_t asn_DEF_SUPLRESPONSE = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLRESPONSE_tags_1, - sizeof(asn_DEF_SUPLRESPONSE_tags_1) - /sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ - asn_DEF_SUPLRESPONSE_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLRESPONSE_tags_1) - /sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLRESPONSE_tags_1) / + sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ + asn_DEF_SUPLRESPONSE_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLRESPONSE_tags_1) / + sizeof(asn_DEF_SUPLRESPONSE_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLRESPONSE_1, - 4, /* Elements count */ - &asn_SPC_SUPLRESPONSE_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_SUPLRESPONSE_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLRESPONSE.h b/src/core/libs/supl/asn-supl/SUPLRESPONSE.h index e2ea5e329..1dc35f771 100644 --- a/src/core/libs/supl/asn-supl/SUPLRESPONSE.h +++ b/src/core/libs/supl/asn-supl/SUPLRESPONSE.h @@ -7,7 +7,6 @@ #ifndef _SUPLRESPONSE_H_ #define _SUPLRESPONSE_H_ - #include /* Including external dependencies */ @@ -32,9 +31,9 @@ extern "C" struct SETAuthKey *sETAuthKey /* OPTIONAL */; KeyIdentity4_t *keyIdentity4 /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SUPLSTART.c b/src/core/libs/supl/asn-supl/SUPLSTART.c index 6ee7881d8..b1c8f3b04 100644 --- a/src/core/libs/supl/asn-supl/SUPLSTART.c +++ b/src/core/libs/supl/asn-supl/SUPLSTART.c @@ -7,52 +7,41 @@ #include "SUPLSTART.h" static asn_TYPE_member_t asn_MBR_SUPLSTART_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, sETCapabilities), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SETCapabilities, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sETCapabilities" - }, - { ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, locationId), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_LocationId, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "locationId" - }, - { ATF_POINTER, 1, offsetof(struct SUPLSTART, qoP), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_QoP, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "qoP" - }, + {ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, sETCapabilities), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SETCapabilities, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sETCapabilities"}, + {ATF_NOFLAGS, 0, offsetof(struct SUPLSTART, locationId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_LocationId, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "locationId"}, + {ATF_POINTER, 1, offsetof(struct SUPLSTART, qoP), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_QoP, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "qoP"}, }; -static int asn_MAP_SUPLSTART_oms_1[] = { 2 }; +static int asn_MAP_SUPLSTART_oms_1[] = {2}; static ber_tlv_tag_t asn_DEF_SUPLSTART_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SUPLSTART_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sETCapabilities at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* locationId at 11 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* qoP at 12 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sETCapabilities at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* locationId at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* qoP at 12 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SUPLSTART_specs_1 = { sizeof(struct SUPLSTART), offsetof(struct SUPLSTART, _asn_ctx), asn_MAP_SUPLSTART_tag2el_1, - 3, /* Count of tags in the map */ - asn_MAP_SUPLSTART_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 2, /* Start extensions */ - 4 /* Stop extensions */ + 3, /* Count of tags in the map */ + asn_MAP_SUPLSTART_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 2, /* Start extensions */ + 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SUPLSTART = { "SUPLSTART", @@ -66,16 +55,15 @@ asn_TYPE_descriptor_t asn_DEF_SUPLSTART = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SUPLSTART_tags_1, - sizeof(asn_DEF_SUPLSTART_tags_1) - /sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ - asn_DEF_SUPLSTART_tags_1, /* Same as above */ - sizeof(asn_DEF_SUPLSTART_tags_1) - /sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SUPLSTART_tags_1) / + sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ + asn_DEF_SUPLSTART_tags_1, /* Same as above */ + sizeof(asn_DEF_SUPLSTART_tags_1) / + sizeof(asn_DEF_SUPLSTART_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SUPLSTART_1, - 3, /* Elements count */ - &asn_SPC_SUPLSTART_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_SUPLSTART_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SUPLSTART.h b/src/core/libs/supl/asn-supl/SUPLSTART.h index 10072e2ec..69fd8d9bc 100644 --- a/src/core/libs/supl/asn-supl/SUPLSTART.h +++ b/src/core/libs/supl/asn-supl/SUPLSTART.h @@ -7,7 +7,6 @@ #ifndef _SUPLSTART_H_ #define _SUPLSTART_H_ - #include /* Including external dependencies */ @@ -30,9 +29,9 @@ extern "C" LocationId_t locationId; struct QoP *qoP /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SatelliteInfo.c b/src/core/libs/supl/asn-supl/SatelliteInfo.c index 144a6b3d1..1aa2225ea 100644 --- a/src/core/libs/supl/asn-supl/SatelliteInfo.c +++ b/src/core/libs/supl/asn-supl/SatelliteInfo.c @@ -7,28 +7,23 @@ #include "SatelliteInfo.h" static asn_per_constraints_t ASN_PER_TYPE_SATELLITE_INFO_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 5, 5, 1, 31 } /* (SIZE(1..31)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 5, 5, 1, 31} /* (SIZE(1..31)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SatelliteInfo_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), - 0, - &asn_DEF_SatelliteInfoElement, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, + &asn_DEF_SatelliteInfoElement, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_SatelliteInfo_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_SatelliteInfo_specs_1 = { - sizeof(struct SatelliteInfo), - offsetof(struct SatelliteInfo, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + sizeof(struct SatelliteInfo), offsetof(struct SatelliteInfo, _asn_ctx), + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SatelliteInfo = { "SatelliteInfo", @@ -42,16 +37,15 @@ asn_TYPE_descriptor_t asn_DEF_SatelliteInfo = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SatelliteInfo_tags_1, - sizeof(asn_DEF_SatelliteInfo_tags_1) - /sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ - asn_DEF_SatelliteInfo_tags_1, /* Same as above */ - sizeof(asn_DEF_SatelliteInfo_tags_1) - /sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ + sizeof(asn_DEF_SatelliteInfo_tags_1) / + sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ + asn_DEF_SatelliteInfo_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteInfo_tags_1) / + sizeof(asn_DEF_SatelliteInfo_tags_1[0]), /* 1 */ &ASN_PER_TYPE_SATELLITE_INFO_CONSTR_1, asn_MBR_SatelliteInfo_1, - 1, /* Single element */ - &asn_SPC_SatelliteInfo_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_SatelliteInfo_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SatelliteInfo.h b/src/core/libs/supl/asn-supl/SatelliteInfo.h index 00d9dbb2a..1a6cacd5b 100644 --- a/src/core/libs/supl/asn-supl/SatelliteInfo.h +++ b/src/core/libs/supl/asn-supl/SatelliteInfo.h @@ -7,7 +7,6 @@ #ifndef _SatelliteInfo_H_ #define _SatelliteInfo_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/SatelliteInfoElement.c b/src/core/libs/supl/asn-supl/SatelliteInfoElement.c index 3710774d3..670b565d7 100644 --- a/src/core/libs/supl/asn-supl/SatelliteInfoElement.c +++ b/src/core/libs/supl/asn-supl/SatelliteInfoElement.c @@ -6,101 +6,100 @@ #include "SatelliteInfoElement.h" -static int -memb_satId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_satId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 63)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 63)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_iODE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_iODE_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_SAT_ID_CONSTR_2 = { - { APC_CONSTRAINED, 6, 6, 0, 63 } /* (0..63) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 6, 6, 0, 63} /* (0..63) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_I_ODE_CONSTR_3 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SatelliteInfoElement_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, satId), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_satId_constraint_1, - &ASN_PER_MEMB_SAT_ID_CONSTR_2, - 0, - "satId" - }, - { ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, iODE), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_iODE_constraint_1, - &ASN_PER_MEMB_I_ODE_CONSTR_3, - 0, - "iODE" - }, + {ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, satId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_satId_constraint_1, + &ASN_PER_MEMB_SAT_ID_CONSTR_2, 0, "satId"}, + {ATF_NOFLAGS, 0, offsetof(struct SatelliteInfoElement, iODE), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_iODE_constraint_1, + &ASN_PER_MEMB_I_ODE_CONSTR_3, 0, "iODE"}, }; static ber_tlv_tag_t asn_DEF_SatelliteInfoElement_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SatelliteInfoElement_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* satId at 50 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iODE at 51 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* satId at 50 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* iODE at 51 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SatelliteInfoElement_specs_1 = { sizeof(struct SatelliteInfoElement), offsetof(struct SatelliteInfoElement, _asn_ctx), asn_MAP_SatelliteInfoElement_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - 1, /* Start extensions */ - 3 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + 1, /* Start extensions */ + 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SatelliteInfoElement = { "SatelliteInfoElement", @@ -114,16 +113,15 @@ asn_TYPE_descriptor_t asn_DEF_SatelliteInfoElement = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SatelliteInfoElement_tags_1, - sizeof(asn_DEF_SatelliteInfoElement_tags_1) - /sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ - asn_DEF_SatelliteInfoElement_tags_1, /* Same as above */ - sizeof(asn_DEF_SatelliteInfoElement_tags_1) - /sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SatelliteInfoElement_tags_1) / + sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ + asn_DEF_SatelliteInfoElement_tags_1, /* Same as above */ + sizeof(asn_DEF_SatelliteInfoElement_tags_1) / + sizeof(asn_DEF_SatelliteInfoElement_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SatelliteInfoElement_1, - 2, /* Elements count */ - &asn_SPC_SatelliteInfoElement_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SatelliteInfoElement_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SatelliteInfoElement.h b/src/core/libs/supl/asn-supl/SatelliteInfoElement.h index d07673062..b54b8b323 100644 --- a/src/core/libs/supl/asn-supl/SatelliteInfoElement.h +++ b/src/core/libs/supl/asn-supl/SatelliteInfoElement.h @@ -7,7 +7,6 @@ #ifndef _SatelliteInfoElement_H_ #define _SatelliteInfoElement_H_ - #include /* Including external dependencies */ @@ -25,9 +24,9 @@ extern "C" long satId; long iODE; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/SessionID.c b/src/core/libs/supl/asn-supl/SessionID.c index 164c435cc..e2c00b553 100644 --- a/src/core/libs/supl/asn-supl/SessionID.c +++ b/src/core/libs/supl/asn-supl/SessionID.c @@ -7,42 +7,36 @@ #include "SessionID.h" static asn_TYPE_member_t asn_MBR_SessionID_1[] = { - { ATF_POINTER, 2, offsetof(struct SessionID, setSessionID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SetSessionID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "setSessionID" - }, - { ATF_POINTER, 1, offsetof(struct SessionID, slpSessionID), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SlpSessionID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "slpSessionID" - }, + {ATF_POINTER, 2, offsetof(struct SessionID, setSessionID), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SetSessionID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "setSessionID"}, + {ATF_POINTER, 1, offsetof(struct SessionID, slpSessionID), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SlpSessionID, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "slpSessionID"}, }; -static int asn_MAP_SessionID_oms_1[] = { 0, 1 }; +static int asn_MAP_SessionID_oms_1[] = {0, 1}; static ber_tlv_tag_t asn_DEF_SessionID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SessionID_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* setSessionID at 15 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* slpSessionID at 16 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* setSessionID at 15 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* slpSessionID at 16 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SessionID_specs_1 = { sizeof(struct SessionID), offsetof(struct SessionID, _asn_ctx), asn_MAP_SessionID_tag2el_1, - 2, /* Count of tags in the map */ - asn_MAP_SessionID_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + asn_MAP_SessionID_oms_1, /* Optional members */ + 2, + 0, /* Root/Additions */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SessionID = { "SessionID", @@ -56,16 +50,15 @@ asn_TYPE_descriptor_t asn_DEF_SessionID = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SessionID_tags_1, - sizeof(asn_DEF_SessionID_tags_1) - /sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ - asn_DEF_SessionID_tags_1, /* Same as above */ - sizeof(asn_DEF_SessionID_tags_1) - /sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SessionID_tags_1) / + sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ + asn_DEF_SessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SessionID_tags_1) / + sizeof(asn_DEF_SessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SessionID_1, - 2, /* Elements count */ - &asn_SPC_SessionID_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SessionID_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SessionID.h b/src/core/libs/supl/asn-supl/SessionID.h index 6f17da264..bf13a5bf8 100644 --- a/src/core/libs/supl/asn-supl/SessionID.h +++ b/src/core/libs/supl/asn-supl/SessionID.h @@ -7,7 +7,6 @@ #ifndef _SessionID_H_ #define _SessionID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/SetSessionID.c b/src/core/libs/supl/asn-supl/SetSessionID.c index 6cb243c40..5ad191d9b 100644 --- a/src/core/libs/supl/asn-supl/SetSessionID.c +++ b/src/core/libs/supl/asn-supl/SetSessionID.c @@ -6,71 +6,68 @@ #include "SetSessionID.h" -static int -memb_sessionId_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_sessionId_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_SESSION_ID_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SetSessionID_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct SetSessionID, sessionId), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_sessionId_constraint_1, - &ASN_PER_MEMB_SESSION_ID_CONSTR_2, - 0, - "sessionId" - }, - { ATF_NOFLAGS, 0, offsetof(struct SetSessionID, setId), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SETId, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "setId" - }, + {ATF_NOFLAGS, 0, offsetof(struct SetSessionID, sessionId), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_sessionId_constraint_1, + &ASN_PER_MEMB_SESSION_ID_CONSTR_2, 0, "sessionId"}, + {ATF_NOFLAGS, 0, offsetof(struct SetSessionID, setId), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SETId, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "setId"}, }; static ber_tlv_tag_t asn_DEF_SetSessionID_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_SetSessionID_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sessionId at 18 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* setId at 19 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sessionId at 18 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* setId at 19 */ }; static asn_SEQUENCE_specifics_t asn_SPC_SetSessionID_specs_1 = { sizeof(struct SetSessionID), offsetof(struct SetSessionID, _asn_ctx), asn_MAP_SetSessionID_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SetSessionID = { "SetSessionID", @@ -84,16 +81,15 @@ asn_TYPE_descriptor_t asn_DEF_SetSessionID = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_SetSessionID_tags_1, - sizeof(asn_DEF_SetSessionID_tags_1) - /sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ - asn_DEF_SetSessionID_tags_1, /* Same as above */ - sizeof(asn_DEF_SetSessionID_tags_1) - /sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SetSessionID_tags_1) / + sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ + asn_DEF_SetSessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SetSessionID_tags_1) / + sizeof(asn_DEF_SetSessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SetSessionID_1, - 2, /* Elements count */ - &asn_SPC_SetSessionID_specs_1 /* Additional specs */ + 2, /* Elements count */ + &asn_SPC_SetSessionID_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/SetSessionID.h b/src/core/libs/supl/asn-supl/SetSessionID.h index 5ffa20754..b8f17b5a9 100644 --- a/src/core/libs/supl/asn-supl/SetSessionID.h +++ b/src/core/libs/supl/asn-supl/SetSessionID.h @@ -7,7 +7,6 @@ #ifndef _SetSessionID_H_ #define _SetSessionID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/SlpSessionID.c b/src/core/libs/supl/asn-supl/SlpSessionID.c index 75ea261ab..2eb00447c 100644 --- a/src/core/libs/supl/asn-supl/SlpSessionID.c +++ b/src/core/libs/supl/asn-supl/SlpSessionID.c @@ -6,18 +6,18 @@ #include "SlpSessionID.h" -static int -memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) +static int memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -30,9 +30,8 @@ memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -40,25 +39,19 @@ memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static asn_per_constraints_t ASN_PER_MEMB_SESSION_ID_CONSTR_2 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 4, 4} /* (SIZE(4..4)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = { {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_OCTET_STRING, - memb_sessionID_constraint_1, - &ASN_PER_MEMB_SESSION_ID_CONSTR_2, - 0, - "sessionID"}, + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_OCTET_STRING, memb_sessionID_constraint_1, + &ASN_PER_MEMB_SESSION_ID_CONSTR_2, 0, "sessionID"}, {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_SLPAddress, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "slpId"}, + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_SLPAddress, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "slpId"}, }; static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; @@ -70,10 +63,12 @@ static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = { sizeof(struct SlpSessionID), offsetof(struct SlpSessionID, _asn_ctx), asn_MAP_SlpSessionID_tag2el_1, - 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 2, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SlpSessionID = { "SlpSessionID", @@ -89,10 +84,12 @@ asn_TYPE_descriptor_t asn_DEF_SlpSessionID = { SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SlpSessionID_tags_1, - sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ - asn_DEF_SlpSessionID_tags_1, /* Same as above */ - sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_SlpSessionID_tags_1) / + sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ + asn_DEF_SlpSessionID_tags_1, /* Same as above */ + sizeof(asn_DEF_SlpSessionID_tags_1) / + sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_SlpSessionID_1, 2, /* Elements count */ &asn_SPC_SlpSessionID_specs_1 /* Additional specs */ diff --git a/src/core/libs/supl/asn-supl/SlpSessionID.h b/src/core/libs/supl/asn-supl/SlpSessionID.h index 55fbec205..ba1662c9f 100644 --- a/src/core/libs/supl/asn-supl/SlpSessionID.h +++ b/src/core/libs/supl/asn-supl/SlpSessionID.h @@ -7,7 +7,6 @@ #ifndef _SlpSessionID_H_ #define _SlpSessionID_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/Status.c b/src/core/libs/supl/asn-supl/Status.c index 17b70c8b7..4a38f4fc0 100644 --- a/src/core/libs/supl/asn-supl/Status.c +++ b/src/core/libs/supl/asn-supl/Status.c @@ -6,9 +6,9 @@ #include "Status.h" -int -Status_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int Status_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,111 +18,117 @@ Status_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -Status_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void Status_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -Status_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void Status_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ Status_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -Status_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int Status_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ Status_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -Status_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t Status_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ Status_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -Status_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Status_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ Status_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -Status_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t Status_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ Status_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -Status_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t Status_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ Status_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -Status_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t Status_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ Status_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -Status_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t Status_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ Status_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_STATUS_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2} /* (0..2,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_Status_value2enum_1[] = { - { 0, 5, "stale" }, - { 1, 7, "current" }, - { 2, 7, "unknown" } + {0, 5, "stale"}, {1, 7, "current"}, {2, 7, "unknown"} /* This list is extensible */ }; static unsigned int asn_MAP_Status_enum2value_1[] = { - 1, /* current(1) */ - 0, /* stale(0) */ - 2 /* unknown(2) */ - /* This list is extensible */ + 1, /* current(1) */ + 0, /* stale(0) */ + 2 /* unknown(2) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_Status_specs_1 = { - asn_MAP_Status_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_Status_enum2value_1, /* N => "tag"; sorted by N */ - 3, /* Number of elements in the maps */ - 4, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_Status_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_Status_enum2value_1, /* N => "tag"; sorted by N */ + 3, /* Number of elements in the maps */ + 4, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_Status_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_Status = { "Status", "Status", @@ -135,15 +141,13 @@ asn_TYPE_descriptor_t asn_DEF_Status = { Status_encode_xer, Status_decode_uper, Status_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Status_tags_1, - sizeof(asn_DEF_Status_tags_1) - /sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ - asn_DEF_Status_tags_1, /* Same as above */ - sizeof(asn_DEF_Status_tags_1) - /sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ + sizeof(asn_DEF_Status_tags_1) / sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ + asn_DEF_Status_tags_1, /* Same as above */ + sizeof(asn_DEF_Status_tags_1) / sizeof(asn_DEF_Status_tags_1[0]), /* 1 */ &ASN_PER_TYPE_STATUS_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_Status_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_Status_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/Status.h b/src/core/libs/supl/asn-supl/Status.h index dbaac1846..02c8292c8 100644 --- a/src/core/libs/supl/asn-supl/Status.h +++ b/src/core/libs/supl/asn-supl/Status.h @@ -7,7 +7,6 @@ #ifndef _Status_H_ #define _Status_H_ - #include /* Including external dependencies */ @@ -25,8 +24,8 @@ extern "C" Status_current = 1, Status_unknown = 2 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_Status; /* Status */ diff --git a/src/core/libs/supl/asn-supl/StatusCode.c b/src/core/libs/supl/asn-supl/StatusCode.c index 1b1f6b805..d95c684f8 100644 --- a/src/core/libs/supl/asn-supl/StatusCode.c +++ b/src/core/libs/supl/asn-supl/StatusCode.c @@ -6,9 +6,9 @@ #include "StatusCode.h" -int -StatusCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int StatusCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); @@ -18,145 +18,156 @@ StatusCode_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ -static void -StatusCode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_ENUMERATED.free_struct; - td->print_struct = asn_DEF_ENUMERATED.print_struct; - td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; - td->der_encoder = asn_DEF_ENUMERATED.der_encoder; - td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; - td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; - td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; - td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; - if(!td->per_constraints) +static void StatusCode_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_ENUMERATED.free_struct; + td->print_struct = asn_DEF_ENUMERATED.print_struct; + td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; + td->der_encoder = asn_DEF_ENUMERATED.der_encoder; + td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; + td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; + td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; + td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; - td->elements = asn_DEF_ENUMERATED.elements; + td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; - /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ + /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined + * explicitly + */ } -void -StatusCode_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void StatusCode_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ StatusCode_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -StatusCode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int StatusCode_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ StatusCode_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -StatusCode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t StatusCode_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ StatusCode_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -StatusCode_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t StatusCode_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ StatusCode_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -StatusCode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t StatusCode_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ StatusCode_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -StatusCode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t StatusCode_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ StatusCode_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -StatusCode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t StatusCode_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ StatusCode_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -StatusCode_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t StatusCode_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ StatusCode_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_STATUS_CODE_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 0, 19 } /* (0..19,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 0, 19} /* (0..19,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_StatusCode_value2enum_1[] = { - { 0, 11, "unspecified" }, - { 1, 13, "systemFailure" }, - { 2, 17, "unexpectedMessage" }, - { 3, 13, "protocolError" }, - { 4, 11, "dataMissing" }, - { 5, 19, "unexpectedDataValue" }, - { 6, 16, "posMethodFailure" }, - { 7, 17, "posMethodMismatch" }, - { 8, 19, "posProtocolMismatch" }, - { 9, 21, "targetSETnotReachable" }, - { 10, 19, "versionNotSupported" }, - { 11, 16, "resourceShortage" }, - { 12, 16, "invalidSessionId" }, - { 13, 24, "nonProxyModeNotSupported" }, - { 14, 21, "proxyModeNotSupported" }, - { 15, 23, "positioningNotPermitted" }, - { 16, 14, "authNetFailure" }, - { 17, 19, "authSuplinitFailure" }, - { 100, 19, "consentDeniedByUser" }, - { 101, 20, "consentGrantedByUser" } + {0, 11, "unspecified"}, + {1, 13, "systemFailure"}, + {2, 17, "unexpectedMessage"}, + {3, 13, "protocolError"}, + {4, 11, "dataMissing"}, + {5, 19, "unexpectedDataValue"}, + {6, 16, "posMethodFailure"}, + {7, 17, "posMethodMismatch"}, + {8, 19, "posProtocolMismatch"}, + {9, 21, "targetSETnotReachable"}, + {10, 19, "versionNotSupported"}, + {11, 16, "resourceShortage"}, + {12, 16, "invalidSessionId"}, + {13, 24, "nonProxyModeNotSupported"}, + {14, 21, "proxyModeNotSupported"}, + {15, 23, "positioningNotPermitted"}, + {16, 14, "authNetFailure"}, + {17, 19, "authSuplinitFailure"}, + {100, 19, "consentDeniedByUser"}, + {101, 20, "consentGrantedByUser"} /* This list is extensible */ }; static unsigned int asn_MAP_StatusCode_enum2value_1[] = { - 16, /* authNetFailure(16) */ - 17, /* authSuplinitFailure(17) */ - 18, /* consentDeniedByUser(100) */ - 19, /* consentGrantedByUser(101) */ - 4, /* dataMissing(4) */ - 12, /* invalidSessionId(12) */ - 13, /* nonProxyModeNotSupported(13) */ - 6, /* posMethodFailure(6) */ - 7, /* posMethodMismatch(7) */ - 8, /* posProtocolMismatch(8) */ - 15, /* positioningNotPermitted(15) */ - 3, /* protocolError(3) */ - 14, /* proxyModeNotSupported(14) */ - 11, /* resourceShortage(11) */ - 1, /* systemFailure(1) */ - 9, /* targetSETnotReachable(9) */ - 5, /* unexpectedDataValue(5) */ - 2, /* unexpectedMessage(2) */ - 0, /* unspecified(0) */ - 10 /* versionNotSupported(10) */ - /* This list is extensible */ + 16, /* authNetFailure(16) */ + 17, /* authSuplinitFailure(17) */ + 18, /* consentDeniedByUser(100) */ + 19, /* consentGrantedByUser(101) */ + 4, /* dataMissing(4) */ + 12, /* invalidSessionId(12) */ + 13, /* nonProxyModeNotSupported(13) */ + 6, /* posMethodFailure(6) */ + 7, /* posMethodMismatch(7) */ + 8, /* posProtocolMismatch(8) */ + 15, /* positioningNotPermitted(15) */ + 3, /* protocolError(3) */ + 14, /* proxyModeNotSupported(14) */ + 11, /* resourceShortage(11) */ + 1, /* systemFailure(1) */ + 9, /* targetSETnotReachable(9) */ + 5, /* unexpectedDataValue(5) */ + 2, /* unexpectedMessage(2) */ + 0, /* unspecified(0) */ + 10 /* versionNotSupported(10) */ + /* This list is extensible */ }; static asn_INTEGER_specifics_t asn_SPC_StatusCode_specs_1 = { - asn_MAP_StatusCode_value2enum_1, /* "tag" => N; sorted by tag */ - asn_MAP_StatusCode_enum2value_1, /* N => "tag"; sorted by N */ - 20, /* Number of elements in the maps */ - 21, /* Extensions before this member */ - 1, /* Strict enumeration */ - 0, /* Native long size */ - 0 -}; + asn_MAP_StatusCode_value2enum_1, /* "tag" => N; sorted by tag */ + asn_MAP_StatusCode_enum2value_1, /* N => "tag"; sorted by N */ + 20, /* Number of elements in the maps */ + 21, /* Extensions before this member */ + 1, /* Strict enumeration */ + 0, /* Native long size */ + 0}; static ber_tlv_tag_t asn_DEF_StatusCode_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (10 << 2))}; asn_TYPE_descriptor_t asn_DEF_StatusCode = { "StatusCode", "StatusCode", @@ -169,15 +180,15 @@ asn_TYPE_descriptor_t asn_DEF_StatusCode = { StatusCode_encode_xer, StatusCode_decode_uper, StatusCode_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_StatusCode_tags_1, - sizeof(asn_DEF_StatusCode_tags_1) - /sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ - asn_DEF_StatusCode_tags_1, /* Same as above */ - sizeof(asn_DEF_StatusCode_tags_1) - /sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ + sizeof(asn_DEF_StatusCode_tags_1) / + sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ + asn_DEF_StatusCode_tags_1, /* Same as above */ + sizeof(asn_DEF_StatusCode_tags_1) / + sizeof(asn_DEF_StatusCode_tags_1[0]), /* 1 */ &ASN_PER_TYPE_STATUS_CODE_CONSTR_1, - 0, 0, /* Defined elsewhere */ - &asn_SPC_StatusCode_specs_1 /* Additional specs */ + 0, + 0, /* Defined elsewhere */ + &asn_SPC_StatusCode_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/StatusCode.h b/src/core/libs/supl/asn-supl/StatusCode.h index 2720fc541..7f1a28a07 100644 --- a/src/core/libs/supl/asn-supl/StatusCode.h +++ b/src/core/libs/supl/asn-supl/StatusCode.h @@ -7,7 +7,6 @@ #ifndef _StatusCode_H_ #define _StatusCode_H_ - #include /* Including external dependencies */ @@ -42,8 +41,8 @@ extern "C" StatusCode_consentDeniedByUser = 100, StatusCode_consentGrantedByUser = 101 /* - * Enumeration is extensible - */ + * Enumeration is extensible + */ } e_StatusCode; /* StatusCode */ diff --git a/src/core/libs/supl/asn-supl/TGSN.c b/src/core/libs/supl/asn-supl/TGSN.c index 1a5686729..a3fa10544 100644 --- a/src/core/libs/supl/asn-supl/TGSN.c +++ b/src/core/libs/supl/asn-supl/TGSN.c @@ -6,119 +6,128 @@ #include "TGSN.h" -int -TGSN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TGSN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 14)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 14)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TGSN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TGSN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TGSN_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TGSN_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ TGSN_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TGSN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TGSN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ TGSN_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TGSN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TGSN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ TGSN_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TGSN_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TGSN_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ TGSN_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TGSN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TGSN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ TGSN_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TGSN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TGSN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ TGSN_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TGSN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TGSN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ TGSN_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TGSN_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TGSN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ TGSN_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TGSN_CONSTR_1 = { - { APC_CONSTRAINED, 4, 4, 0, 14 } /* (0..14) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 14} /* (0..14) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TGSN_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TGSN = { "TGSN", "TGSN", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_TGSN = { TGSN_encode_xer, TGSN_decode_uper, TGSN_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TGSN_tags_1, - sizeof(asn_DEF_TGSN_tags_1) - /sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ - asn_DEF_TGSN_tags_1, /* Same as above */ - sizeof(asn_DEF_TGSN_tags_1) - /sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TGSN_tags_1) / sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ + asn_DEF_TGSN_tags_1, /* Same as above */ + sizeof(asn_DEF_TGSN_tags_1) / sizeof(asn_DEF_TGSN_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TGSN_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/TGSN.h b/src/core/libs/supl/asn-supl/TGSN.h index 48166ad63..f245e6563 100644 --- a/src/core/libs/supl/asn-supl/TGSN.h +++ b/src/core/libs/supl/asn-supl/TGSN.h @@ -7,7 +7,6 @@ #ifndef _TGSN_H_ #define _TGSN_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP-List.c b/src/core/libs/supl/asn-supl/TimeslotISCP-List.c index e2e977c5f..a3630541f 100644 --- a/src/core/libs/supl/asn-supl/TimeslotISCP-List.c +++ b/src/core/libs/supl/asn-supl/TimeslotISCP-List.c @@ -7,28 +7,24 @@ #include "TimeslotISCP-List.h" static asn_per_constraints_t ASN_PER_TYPE_TIMESLOT_ISCP_LIST_CONSTR_1 = { - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 4, 4, 1, 14 } /* (SIZE(1..14)) */, - 0, 0 /* No PER value map */ + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + {APC_CONSTRAINED, 4, 4, 1, 14} /* (SIZE(1..14)) */, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_TimeslotISCP_List_1[] = { - { ATF_POINTER, 0, 0, - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), - 0, - &asn_DEF_TimeslotISCP, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "" - }, + {ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, + &asn_DEF_TimeslotISCP, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, ""}, }; static ber_tlv_tag_t asn_DEF_TimeslotISCP_List_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_SET_OF_specifics_t asn_SPC_TimeslotISCP_List_specs_1 = { sizeof(struct TimeslotISCP_List), offsetof(struct TimeslotISCP_List, _asn_ctx), - 0, /* XER encoding is XMLDelimitedItemList */ + 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_TimeslotISCP_List = { "TimeslotISCP-List", @@ -42,16 +38,15 @@ asn_TYPE_descriptor_t asn_DEF_TimeslotISCP_List = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TimeslotISCP_List_tags_1, - sizeof(asn_DEF_TimeslotISCP_List_tags_1) - /sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ - asn_DEF_TimeslotISCP_List_tags_1, /* Same as above */ - sizeof(asn_DEF_TimeslotISCP_List_tags_1) - /sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TimeslotISCP_List_tags_1) / + sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ + asn_DEF_TimeslotISCP_List_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeslotISCP_List_tags_1) / + sizeof(asn_DEF_TimeslotISCP_List_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TIMESLOT_ISCP_LIST_CONSTR_1, asn_MBR_TimeslotISCP_List_1, - 1, /* Single element */ - &asn_SPC_TimeslotISCP_List_specs_1 /* Additional specs */ + 1, /* Single element */ + &asn_SPC_TimeslotISCP_List_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP-List.h b/src/core/libs/supl/asn-supl/TimeslotISCP-List.h index ff8346416..ab7e529e4 100644 --- a/src/core/libs/supl/asn-supl/TimeslotISCP-List.h +++ b/src/core/libs/supl/asn-supl/TimeslotISCP-List.h @@ -7,7 +7,6 @@ #ifndef _TimeslotISCP_List_H_ #define _TimeslotISCP_List_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP.c b/src/core/libs/supl/asn-supl/TimeslotISCP.c index 78911930c..0e3e84ee5 100644 --- a/src/core/libs/supl/asn-supl/TimeslotISCP.c +++ b/src/core/libs/supl/asn-supl/TimeslotISCP.c @@ -6,119 +6,137 @@ #include "TimeslotISCP.h" -int -TimeslotISCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int TimeslotISCP_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -TimeslotISCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void TimeslotISCP_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -TimeslotISCP_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void TimeslotISCP_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -TimeslotISCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int TimeslotISCP_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -TimeslotISCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t TimeslotISCP_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -TimeslotISCP_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeslotISCP_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -TimeslotISCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t TimeslotISCP_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const char *opt_mname, + const void *bufptr, size_t size) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -TimeslotISCP_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t TimeslotISCP_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -TimeslotISCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t TimeslotISCP_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -TimeslotISCP_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t TimeslotISCP_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ TimeslotISCP_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_TIMESLOT_ISCP_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_TimeslotISCP_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_TimeslotISCP = { "TimeslotISCP", "TimeslotISCP", @@ -131,15 +149,15 @@ asn_TYPE_descriptor_t asn_DEF_TimeslotISCP = { TimeslotISCP_encode_xer, TimeslotISCP_decode_uper, TimeslotISCP_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_TimeslotISCP_tags_1, - sizeof(asn_DEF_TimeslotISCP_tags_1) - /sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ - asn_DEF_TimeslotISCP_tags_1, /* Same as above */ - sizeof(asn_DEF_TimeslotISCP_tags_1) - /sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ + sizeof(asn_DEF_TimeslotISCP_tags_1) / + sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ + asn_DEF_TimeslotISCP_tags_1, /* Same as above */ + sizeof(asn_DEF_TimeslotISCP_tags_1) / + sizeof(asn_DEF_TimeslotISCP_tags_1[0]), /* 1 */ &ASN_PER_TYPE_TIMESLOT_ISCP_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/TimeslotISCP.h b/src/core/libs/supl/asn-supl/TimeslotISCP.h index 41136f7dd..073676f9a 100644 --- a/src/core/libs/supl/asn-supl/TimeslotISCP.h +++ b/src/core/libs/supl/asn-supl/TimeslotISCP.h @@ -7,7 +7,6 @@ #ifndef _TimeslotISCP_H_ #define _TimeslotISCP_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/UARFCN.c b/src/core/libs/supl/asn-supl/UARFCN.c index b88a4ebcd..f48704e63 100644 --- a/src/core/libs/supl/asn-supl/UARFCN.c +++ b/src/core/libs/supl/asn-supl/UARFCN.c @@ -6,119 +6,128 @@ #include "UARFCN.h" -int -UARFCN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int UARFCN_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 16383)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 16383)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -UARFCN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void UARFCN_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -UARFCN_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void UARFCN_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) +{ UARFCN_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -UARFCN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int UARFCN_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ UARFCN_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -UARFCN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t UARFCN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) +{ UARFCN_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -UARFCN_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UARFCN_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ UARFCN_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -UARFCN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t UARFCN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) +{ UARFCN_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -UARFCN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UARFCN_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ UARFCN_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -UARFCN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t UARFCN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) +{ UARFCN_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -UARFCN_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t UARFCN_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) +{ UARFCN_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_UARFCN_CONSTR_1 = { - { APC_CONSTRAINED, 14, 14, 0, 16383 } /* (0..16383) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 14, 14, 0, 16383} /* (0..16383) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_UARFCN_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_UARFCN = { "UARFCN", "UARFCN", @@ -131,15 +140,13 @@ asn_TYPE_descriptor_t asn_DEF_UARFCN = { UARFCN_encode_xer, UARFCN_decode_uper, UARFCN_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UARFCN_tags_1, - sizeof(asn_DEF_UARFCN_tags_1) - /sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ - asn_DEF_UARFCN_tags_1, /* Same as above */ - sizeof(asn_DEF_UARFCN_tags_1) - /sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ + sizeof(asn_DEF_UARFCN_tags_1) / sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ + asn_DEF_UARFCN_tags_1, /* Same as above */ + sizeof(asn_DEF_UARFCN_tags_1) / sizeof(asn_DEF_UARFCN_tags_1[0]), /* 1 */ &ASN_PER_TYPE_UARFCN_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/UARFCN.h b/src/core/libs/supl/asn-supl/UARFCN.h index 6123f2e43..cbdc9ee5b 100644 --- a/src/core/libs/supl/asn-supl/UARFCN.h +++ b/src/core/libs/supl/asn-supl/UARFCN.h @@ -7,7 +7,6 @@ #ifndef _UARFCN_H_ #define _UARFCN_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/ULP-PDU.c b/src/core/libs/supl/asn-supl/ULP-PDU.c index 91b75c72c..7440b0479 100644 --- a/src/core/libs/supl/asn-supl/ULP-PDU.c +++ b/src/core/libs/supl/asn-supl/ULP-PDU.c @@ -6,91 +6,79 @@ #include "ULP-PDU.h" -static int -memb_length_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_length_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 65535)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 65535)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_LENGTH_CONSTR_2 = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 16, 16, 0, 65535} /* (0..65535) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_ULP_PDU_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, length), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_length_constraint_1, - &ASN_PER_MEMB_LENGTH_CONSTR_2, - 0, - "length" - }, - { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, version), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Version, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "version" - }, - { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, sessionID), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SessionID, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "sessionID" - }, - { ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, message), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - +1, /* EXPLICIT tag at current level */ - &asn_DEF_UlpMessage, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "message" - }, + {ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, length), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_length_constraint_1, + &ASN_PER_MEMB_LENGTH_CONSTR_2, 0, "length"}, + {ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, version), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Version, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "version"}, + {ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, sessionID), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SessionID, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "sessionID"}, + {ATF_NOFLAGS, 0, offsetof(struct ULP_PDU, message), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), +1, /* EXPLICIT tag at current level */ + &asn_DEF_UlpMessage, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "message"}, }; static ber_tlv_tag_t asn_DEF_ULP_PDU_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_ULP_PDU_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* length at 31 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* version at 32 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sessionID at 33 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* message at 34 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* length at 31 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* version at 32 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* sessionID at 33 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* message at 34 */ }; static asn_SEQUENCE_specifics_t asn_SPC_ULP_PDU_specs_1 = { sizeof(struct ULP_PDU), offsetof(struct ULP_PDU, _asn_ctx), asn_MAP_ULP_PDU_tag2el_1, - 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 4, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ULP_PDU = { "ULP-PDU", @@ -104,16 +92,13 @@ asn_TYPE_descriptor_t asn_DEF_ULP_PDU = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_ULP_PDU_tags_1, - sizeof(asn_DEF_ULP_PDU_tags_1) - /sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ - asn_DEF_ULP_PDU_tags_1, /* Same as above */ - sizeof(asn_DEF_ULP_PDU_tags_1) - /sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_ULP_PDU_tags_1) / sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ + asn_DEF_ULP_PDU_tags_1, /* Same as above */ + sizeof(asn_DEF_ULP_PDU_tags_1) / sizeof(asn_DEF_ULP_PDU_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_ULP_PDU_1, - 4, /* Elements count */ - &asn_SPC_ULP_PDU_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_ULP_PDU_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/ULP-PDU.h b/src/core/libs/supl/asn-supl/ULP-PDU.h index 7c53dce7a..2200a42af 100644 --- a/src/core/libs/supl/asn-supl/ULP-PDU.h +++ b/src/core/libs/supl/asn-supl/ULP-PDU.h @@ -7,7 +7,6 @@ #ifndef _ULP_PDU_H_ #define _ULP_PDU_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/UTCTime.c b/src/core/libs/supl/asn-supl/UTCTime.c index 153a9494e..9108201c9 100644 --- a/src/core/libs/supl/asn-supl/UTCTime.c +++ b/src/core/libs/supl/asn-supl/UTCTime.c @@ -7,168 +7,175 @@ #include #include -#ifdef __CYGWIN__ +#ifdef __CYGWIN__ #include "/usr/include/time.h" #else #include -#endif /* __CYGWIN__ */ +#endif /* __CYGWIN__ */ -#ifndef __ASN_INTERNAL_TEST_MODE__ +#ifndef __ASN_INTERNAL_TEST_MODE__ /* * UTCTime basic type description. */ static ber_tlv_tag_t asn_DEF_UTCTime_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (23 << 2)), /* [UNIVERSAL 23] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ + (ASN_TAG_CLASS_UNIVERSAL | (23 << 2)), /* [UNIVERSAL 23] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t ASN_DEF_UTC_TIME_CONSTRAINTS = { - { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ - 0, 0 -}; + {APC_CONSTRAINED, 7, 7, 0x20, 0x7e}, /* Value */ + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, /* Size */ + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_UTCTime = { "UTCTime", "UTCTime", OCTET_STRING_free, UTCTime_print, UTCTime_constraint, - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ - OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ OCTET_STRING_decode_xer_utf8, UTCTime_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UTCTime_tags, - sizeof(asn_DEF_UTCTime_tags) - / sizeof(asn_DEF_UTCTime_tags[0]) - 2, + sizeof(asn_DEF_UTCTime_tags) / sizeof(asn_DEF_UTCTime_tags[0]) - 2, asn_DEF_UTCTime_tags, - sizeof(asn_DEF_UTCTime_tags) - / sizeof(asn_DEF_UTCTime_tags[0]), + sizeof(asn_DEF_UTCTime_tags) / sizeof(asn_DEF_UTCTime_tags[0]), &ASN_DEF_UTC_TIME_CONSTRAINTS, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -#endif /* __ASN_INTERNAL_TEST_MODE__ */ +#endif /* __ASN_INTERNAL_TEST_MODE__ */ /* * Check that the time looks like the time. */ -int -UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ const UTCTime_t *st = (const UTCTime_t *)sptr; time_t tloc; - errno = EPERM; /* Just an unlikely error code */ + errno = EPERM; /* Just an unlikely error code */ tloc = asn_UT2time(st, 0, 0); - if(tloc == -1 && errno != EPERM) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: Invalid time format: %s (%s:%d)", - td->name, strerror(errno), __FILE__, __LINE__); - return -1; - } + if (tloc == -1 && errno != EPERM) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: Invalid time format: %s (%s:%d)", td->name, + strerror(errno), __FILE__, __LINE__); + return -1; + } return 0; } -#ifndef __ASN_INTERNAL_TEST_MODE__ +#ifndef __ASN_INTERNAL_TEST_MODE__ -asn_enc_rval_t -UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ + if (flags & XER_F_CANONICAL) + { + asn_enc_rval_t rv; + UTCTime_t *ut; + struct tm tm; - if(flags & XER_F_CANONICAL) { - asn_enc_rval_t rv; - UTCTime_t *ut; - struct tm tm; + errno = EPERM; + if (asn_UT2time((UTCTime_t *)sptr, &tm, 1) == -1 && errno != EPERM) + _ASN_ENCODE_FAILED; - errno = EPERM; - if(asn_UT2time((UTCTime_t *)sptr, &tm, 1) == -1 - && errno != EPERM) - _ASN_ENCODE_FAILED; + /* Fractions are not allowed in UTCTime */ + ut = asn_time2GT(0, 0, 1); + if (!ut) _ASN_ENCODE_FAILED; - /* Fractions are not allowed in UTCTime */ - ut = asn_time2GT(0, 0, 1); - if(!ut) _ASN_ENCODE_FAILED; - - rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, - cb, app_key); - OCTET_STRING_free(&asn_DEF_UTCTime, ut, 0); - return rv; - } else { - return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, - cb, app_key); - } + rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, + app_key); + OCTET_STRING_free(&asn_DEF_UTCTime, ut, 0); + return rv; + } + else + { + return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, + app_key); + } } -#endif /* __ASN_INTERNAL_TEST_MODE__ */ +#endif /* __ASN_INTERNAL_TEST_MODE__ */ -int -UTCTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int UTCTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ const UTCTime_t *st = (const UTCTime_t *)sptr; - (void)td; /* Unused argument */ - (void)ilevel; /* Unused argument */ + (void)td; /* Unused argument */ + (void)ilevel; /* Unused argument */ - if(st && st->buf) { - char buf[32]; - struct tm tm; - int ret; + if (st && st->buf) + { + char buf[32]; + struct tm tm; + int ret; - errno = EPERM; - if(asn_UT2time(st, &tm, 1) == -1 && errno != EPERM) - return (cb("", 11, app_key) < 0) ? -1 : 0; + errno = EPERM; + if (asn_UT2time(st, &tm, 1) == -1 && errno != EPERM) + return (cb("", 11, app_key) < 0) ? -1 : 0; - ret = snprintf(buf, sizeof(buf), - "%04d-%02d-%02d %02d:%02d:%02d (GMT)", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); - assert(ret > 0 && ret < (int)sizeof(buf)); - return (cb(buf, ret, app_key) < 0) ? -1 : 0; - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } + ret = snprintf(buf, sizeof(buf), + "%04d-%02d-%02d %02d:%02d:%02d (GMT)", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + assert(ret > 0 && ret < (int)sizeof(buf)); + return (cb(buf, ret, app_key) < 0) ? -1 : 0; + } + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; + } } -time_t -asn_UT2time(const UTCTime_t *st, struct tm *_tm, int as_gmt) { - char buf[24]; /* "AAMMJJhhmmss+hhmm" + cushion */ +time_t asn_UT2time(const UTCTime_t *st, struct tm *_tm, int as_gmt) +{ + char buf[24]; /* "AAMMJJhhmmss+hhmm" + cushion */ GeneralizedTime_t gt; - if(!st || !st->buf - || st->size < 11 || st->size >= ((int)sizeof(buf) - 2)) { - errno = EINVAL; - return -1; - } + if (!st || !st->buf || st->size < 11 || st->size >= ((int)sizeof(buf) - 2)) + { + errno = EINVAL; + return -1; + } gt.buf = (unsigned char *)buf; gt.size = st->size + 2; memcpy(gt.buf + 2, st->buf, st->size); - if(st->buf[0] > 0x35) { - /* 19xx */ - gt.buf[0] = 0x31; - gt.buf[1] = 0x39; - } else { - /* 20xx */ - gt.buf[0] = 0x32; - gt.buf[1] = 0x30; - } + if (st->buf[0] > 0x35) + { + /* 19xx */ + gt.buf[0] = 0x31; + gt.buf[1] = 0x39; + } + else + { + /* 20xx */ + gt.buf[0] = 0x32; + gt.buf[1] = 0x30; + } return asn_GT2time(>, _tm, as_gmt); } -UTCTime_t * -asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm, int force_gmt) { +UTCTime_t *asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm, int force_gmt) +{ GeneralizedTime_t *gt = (GeneralizedTime_t *)opt_ut; gt = asn_time2GT(gt, tm, force_gmt); - if(gt == 0) return 0; + if (gt == 0) return 0; assert(gt->size >= 2); gt->size -= 2; @@ -176,4 +183,3 @@ asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm, int force_gmt) { return (UTCTime_t *)gt; } - diff --git a/src/core/libs/supl/asn-supl/UTCTime.h b/src/core/libs/supl/asn-supl/UTCTime.h index c8e73785c..be576d991 100644 --- a/src/core/libs/supl/asn-supl/UTCTime.h +++ b/src/core/libs/supl/asn-supl/UTCTime.h @@ -21,8 +21,8 @@ extern "C" xer_type_encoder_f UTCTime_encode_xer; /*********************** - * Some handy helpers. * - ***********************/ + * Some handy helpers. * + ***********************/ struct tm; /* */ @@ -30,7 +30,8 @@ extern "C" time_t asn_UT2time(const UTCTime_t * /*st*/, struct tm *_tm, int as_gmt); /* See asn_time2GT() in GeneralizedTime.h */ - UTCTime_t *asn_time2UT(UTCTime_t *__opt_ut, const struct tm * /*tm*/, int force_gmt); + UTCTime_t *asn_time2UT(UTCTime_t *__opt_ut, const struct tm * /*tm*/, + int force_gmt); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c index a43309926..1a55707bd 100644 --- a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c +++ b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.c @@ -6,119 +6,140 @@ #include "UTRA-CarrierRSSI.h" -int -UTRA_CarrierRSSI_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int UTRA_CarrierRSSI_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 127)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 127)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ -static void -UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { - td->free_struct = asn_DEF_NativeInteger.free_struct; - td->print_struct = asn_DEF_NativeInteger.print_struct; - td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; - td->der_encoder = asn_DEF_NativeInteger.der_encoder; - td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; - td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; - td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; - td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; - if(!td->per_constraints) +static void UTRA_CarrierRSSI_1_inherit_TYPE_descriptor( + asn_TYPE_descriptor_t *td) +{ + td->free_struct = asn_DEF_NativeInteger.free_struct; + td->print_struct = asn_DEF_NativeInteger.print_struct; + td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; + td->der_encoder = asn_DEF_NativeInteger.der_encoder; + td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; + td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; + td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; + td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + if (!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; - td->elements = asn_DEF_NativeInteger.elements; + td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; - td->specifics = asn_DEF_NativeInteger.specifics; + td->specifics = asn_DEF_NativeInteger.specifics; } -void -UTRA_CarrierRSSI_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) { +void UTRA_CarrierRSSI_free(asn_TYPE_descriptor_t *td, void *struct_ptr, + int contents_only) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int -UTRA_CarrierRSSI_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { +int UTRA_CarrierRSSI_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, + int ilevel, asn_app_consume_bytes_f *cb, + void *app_key) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -UTRA_CarrierRSSI_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) { +asn_dec_rval_t UTRA_CarrierRSSI_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, const void *bufptr, + size_t size, int tag_mode) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -UTRA_CarrierRSSI_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UTRA_CarrierRSSI_encode_der(asn_TYPE_descriptor_t *td, + void *structure, int tag_mode, + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -UTRA_CarrierRSSI_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) { +asn_dec_rval_t UTRA_CarrierRSSI_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + void **structure, + const char *opt_mname, + const void *bufptr, size_t size) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -UTRA_CarrierRSSI_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t UTRA_CarrierRSSI_encode_xer(asn_TYPE_descriptor_t *td, + void *structure, int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -UTRA_CarrierRSSI_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { +asn_dec_rval_t UTRA_CarrierRSSI_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, + asn_per_data_t *per_data) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -UTRA_CarrierRSSI_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) { +asn_enc_rval_t UTRA_CarrierRSSI_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, + asn_per_outp_t *per_out) +{ UTRA_CarrierRSSI_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t ASN_PER_TYPE_UTRA_CARRIER_RSSI_CONSTR_1 = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_UTRA_CarrierRSSI_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))}; asn_TYPE_descriptor_t asn_DEF_UTRA_CarrierRSSI = { "UTRA-CarrierRSSI", "UTRA-CarrierRSSI", @@ -131,15 +152,15 @@ asn_TYPE_descriptor_t asn_DEF_UTRA_CarrierRSSI = { UTRA_CarrierRSSI_encode_xer, UTRA_CarrierRSSI_decode_uper, UTRA_CarrierRSSI_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_UTRA_CarrierRSSI_tags_1, - sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) - /sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ - asn_DEF_UTRA_CarrierRSSI_tags_1, /* Same as above */ - sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) - /sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) / + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ + asn_DEF_UTRA_CarrierRSSI_tags_1, /* Same as above */ + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1) / + sizeof(asn_DEF_UTRA_CarrierRSSI_tags_1[0]), /* 1 */ &ASN_PER_TYPE_UTRA_CARRIER_RSSI_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; - diff --git a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h index f8f26e2d4..e68c575a5 100644 --- a/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h +++ b/src/core/libs/supl/asn-supl/UTRA-CarrierRSSI.h @@ -7,7 +7,6 @@ #ifndef _UTRA_CarrierRSSI_H_ #define _UTRA_CarrierRSSI_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/UlpMessage.c b/src/core/libs/supl/asn-supl/UlpMessage.c index b90e1e0ce..24940238c 100644 --- a/src/core/libs/supl/asn-supl/UlpMessage.c +++ b/src/core/libs/supl/asn-supl/UlpMessage.c @@ -7,93 +7,64 @@ #include "UlpMessage.h" static asn_per_constraints_t ASN_PER_TYPE_ULP_MESSAGE_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7 } /* (0..7,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 7} /* (0..7,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_UlpMessage_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLINIT), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLINIT, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLINIT" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLSTART), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLSTART, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLSTART" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLRESPONSE), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLRESPONSE, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLRESPONSE" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOSINIT), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLPOSINIT, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLPOSINIT" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOS), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLPOS, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLPOS" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLEND), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SUPLEND, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msSUPLEND" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY2), - (ASN_TAG_CLASS_CONTEXT | (6 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_DUMMY, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msDUMMY2" - }, - { ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY3), - (ASN_TAG_CLASS_CONTEXT | (7 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_DUMMY, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "msDUMMY3" - }, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLINIT), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLINIT, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLINIT"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLSTART), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLSTART, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLSTART"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLRESPONSE), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLRESPONSE, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLRESPONSE"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOSINIT), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOSINIT, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLPOSINIT"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLPOS), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLPOS, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLPOS"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msSUPLEND), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SUPLEND, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msSUPLEND"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY2), + (ASN_TAG_CLASS_CONTEXT | (6 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_DUMMY, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msDUMMY2"}, + {ATF_NOFLAGS, 0, offsetof(struct UlpMessage, choice.msDUMMY3), + (ASN_TAG_CLASS_CONTEXT | (7 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_DUMMY, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "msDUMMY3"}, }; static asn_TYPE_tag2member_t asn_MAP_UlpMessage_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* msSUPLINIT at 37 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* msSUPLSTART at 38 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* msSUPLRESPONSE at 39 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* msSUPLPOSINIT at 40 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* msSUPLPOS at 41 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* msSUPLEND at 42 */ - { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* msDUMMY2 at 44 */ - { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* msDUMMY3 at 46 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msSUPLINIT at 37 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* msSUPLSTART at 38 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* msSUPLRESPONSE at 39 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* msSUPLPOSINIT at 40 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* msSUPLPOS at 41 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0}, /* msSUPLEND at 42 */ + {(ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0}, /* msDUMMY2 at 44 */ + {(ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0} /* msDUMMY3 at 46 */ }; static asn_CHOICE_specifics_t asn_SPC_UlpMessage_specs_1 = { sizeof(struct UlpMessage), @@ -101,9 +72,9 @@ static asn_CHOICE_specifics_t asn_SPC_UlpMessage_specs_1 = { offsetof(struct UlpMessage, present), sizeof(((struct UlpMessage *)0)->present), asn_MAP_UlpMessage_tag2el_1, - 8, /* Count of tags in the map */ + 8, /* Count of tags in the map */ 0, - 8 /* Extensions start */ + 8 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_UlpMessage = { "UlpMessage", @@ -118,13 +89,12 @@ asn_TYPE_descriptor_t asn_DEF_UlpMessage = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_ULP_MESSAGE_CONSTR_1, asn_MBR_UlpMessage_1, - 8, /* Elements count */ - &asn_SPC_UlpMessage_specs_1 /* Additional specs */ + 8, /* Elements count */ + &asn_SPC_UlpMessage_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/UlpMessage.h b/src/core/libs/supl/asn-supl/UlpMessage.h index 81f5893b8..901801104 100644 --- a/src/core/libs/supl/asn-supl/UlpMessage.h +++ b/src/core/libs/supl/asn-supl/UlpMessage.h @@ -7,7 +7,6 @@ #ifndef _UlpMessage_H_ #define _UlpMessage_H_ - #include /* Including external dependencies */ @@ -55,9 +54,9 @@ extern "C" DUMMY_t msDUMMY2; DUMMY_t msDUMMY3; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/Velocity.c b/src/core/libs/supl/asn-supl/Velocity.c index ac1341680..c36506b26 100644 --- a/src/core/libs/supl/asn-supl/Velocity.c +++ b/src/core/libs/supl/asn-supl/Velocity.c @@ -7,53 +7,41 @@ #include "Velocity.h" static asn_per_constraints_t ASN_PER_TYPE_VELOCITY_CONSTR_1 = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 3 } /* (0..3,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 3} /* (0..3,...) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Velocity_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horvel), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Horvel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "horvel" - }, - { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandvervel), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Horandvervel, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "horandvervel" - }, - { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horveluncert), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Horveluncert, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "horveluncert" - }, - { ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandveruncert), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_Horandveruncert, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "horandveruncert" - }, + {ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horvel), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horvel, 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "horvel"}, + {ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandvervel), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horandvervel, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "horandvervel"}, + {ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horveluncert), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horveluncert, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "horveluncert"}, + {ATF_NOFLAGS, 0, offsetof(struct Velocity, choice.horandveruncert), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_Horandveruncert, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "horandveruncert"}, }; static asn_TYPE_tag2member_t asn_MAP_Velocity_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* horvel at 226 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* horandvervel at 227 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horveluncert at 228 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* horandveruncert at 229 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* horvel at 226 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* horandvervel at 227 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* horveluncert at 228 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* horandveruncert at 229 */ }; static asn_CHOICE_specifics_t asn_SPC_Velocity_specs_1 = { sizeof(struct Velocity), @@ -61,9 +49,9 @@ static asn_CHOICE_specifics_t asn_SPC_Velocity_specs_1 = { offsetof(struct Velocity, present), sizeof(((struct Velocity *)0)->present), asn_MAP_Velocity_tag2el_1, - 4, /* Count of tags in the map */ + 4, /* Count of tags in the map */ 0, - 4 /* Extensions start */ + 4 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Velocity = { "Velocity", @@ -78,13 +66,12 @@ asn_TYPE_descriptor_t asn_DEF_Velocity = { CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, - 0, /* No effective tags (pointer) */ - 0, /* No effective tags (count) */ - 0, /* No tags (pointer) */ - 0, /* No tags (count) */ + 0, /* No effective tags (pointer) */ + 0, /* No effective tags (count) */ + 0, /* No tags (pointer) */ + 0, /* No tags (count) */ &ASN_PER_TYPE_VELOCITY_CONSTR_1, asn_MBR_Velocity_1, - 4, /* Elements count */ - &asn_SPC_Velocity_specs_1 /* Additional specs */ + 4, /* Elements count */ + &asn_SPC_Velocity_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/Velocity.h b/src/core/libs/supl/asn-supl/Velocity.h index 876fc21f7..d0cf33508 100644 --- a/src/core/libs/supl/asn-supl/Velocity.h +++ b/src/core/libs/supl/asn-supl/Velocity.h @@ -7,7 +7,6 @@ #ifndef _Velocity_H_ #define _Velocity_H_ - #include /* Including external dependencies */ @@ -44,9 +43,9 @@ extern "C" Horveluncert_t horveluncert; Horandveruncert_t horandveruncert; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ } choice; /* Context for parsing across buffer boundaries */ diff --git a/src/core/libs/supl/asn-supl/Ver.c b/src/core/libs/supl/asn-supl/Ver.c index 99707fa96..3eab8557b 100644 --- a/src/core/libs/supl/asn-supl/Ver.c +++ b/src/core/libs/supl/asn-supl/Ver.c @@ -7,16 +7,15 @@ #include "Ver.h" int Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) + asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if (!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -37,9 +36,8 @@ int Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr, } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } @@ -48,8 +46,7 @@ int Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr, * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ -static void -Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) +static void Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; @@ -66,66 +63,67 @@ Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) td->specifics = asn_DEF_BIT_STRING.specifics; } -void Ver_free(asn_TYPE_descriptor_t *td, - void *struct_ptr, int contents_only) +void Ver_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Ver_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } -int Ver_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, - int ilevel, asn_app_consume_bytes_f *cb, void *app_key) +int Ver_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) { Ver_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } -asn_dec_rval_t -Ver_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const void *bufptr, size_t size, int tag_mode) +asn_dec_rval_t Ver_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const void *bufptr, size_t size, int tag_mode) { Ver_1_inherit_TYPE_descriptor(td); - return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); + return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, + tag_mode); } -asn_enc_rval_t -Ver_encode_der(asn_TYPE_descriptor_t *td, - void *structure, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t Ver_encode_der(asn_TYPE_descriptor_t *td, void *structure, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) { Ver_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } -asn_dec_rval_t -Ver_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **structure, const char *opt_mname, const void *bufptr, size_t size) +asn_dec_rval_t Ver_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **structure, + const char *opt_mname, const void *bufptr, + size_t size) { Ver_1_inherit_TYPE_descriptor(td); - return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); + return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, + size); } -asn_enc_rval_t -Ver_encode_xer(asn_TYPE_descriptor_t *td, void *structure, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) +asn_enc_rval_t Ver_encode_xer(asn_TYPE_descriptor_t *td, void *structure, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) { Ver_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } -asn_dec_rval_t -Ver_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) +asn_dec_rval_t Ver_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **structure, asn_per_data_t *per_data) { Ver_1_inherit_TYPE_descriptor(td); - return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); + return td->uper_decoder(opt_codec_ctx, td, constraints, structure, + per_data); } -asn_enc_rval_t -Ver_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, - void *structure, asn_per_outp_t *per_out) +asn_enc_rval_t Ver_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { Ver_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); @@ -134,7 +132,8 @@ Ver_encode_uper(asn_TYPE_descriptor_t *td, static asn_per_constraints_t ASN_PER_TYPE_VER_CONSTR_1 = { {APC_UNCONSTRAINED, -1, -1, 0, 0}, {APC_CONSTRAINED, 0, 0, 64, 64} /* (SIZE(64..64)) */, - 0, 0 /* No PER value map */ + 0, + 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_Ver_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))}; @@ -153,9 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_Ver = { 0, /* Use generic outmost tag fetcher */ asn_DEF_Ver_tags_1, sizeof(asn_DEF_Ver_tags_1) / sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */ - asn_DEF_Ver_tags_1, /* Same as above */ + asn_DEF_Ver_tags_1, /* Same as above */ sizeof(asn_DEF_Ver_tags_1) / sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */ &ASN_PER_TYPE_VER_CONSTR_1, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; diff --git a/src/core/libs/supl/asn-supl/Ver.h b/src/core/libs/supl/asn-supl/Ver.h index cdd4253e0..184df7522 100644 --- a/src/core/libs/supl/asn-supl/Ver.h +++ b/src/core/libs/supl/asn-supl/Ver.h @@ -7,7 +7,6 @@ #ifndef _Ver_H_ #define _Ver_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/Version.c b/src/core/libs/supl/asn-supl/Version.c index 8bc00d33a..68e337180 100644 --- a/src/core/libs/supl/asn-supl/Version.c +++ b/src/core/libs/supl/asn-supl/Version.c @@ -6,141 +6,140 @@ #include "Version.h" -static int -memb_maj_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_maj_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_servind_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_servind_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 255)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 255)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_MAJ_CONSTR_2 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_MIN_CONSTR_3 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_SERVIND_CONSTR_4 = { - { APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 255} /* (0..255) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_Version_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct Version, maj), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_maj_constraint_1, - &ASN_PER_MEMB_MAJ_CONSTR_2, - 0, - "maj" - }, - { ATF_NOFLAGS, 0, offsetof(struct Version, min), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_min_constraint_1, - &ASN_PER_MEMB_MIN_CONSTR_3, - 0, - "min" - }, - { ATF_NOFLAGS, 0, offsetof(struct Version, servind), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_servind_constraint_1, - &ASN_PER_MEMB_SERVIND_CONSTR_4, - 0, - "servind" - }, + {ATF_NOFLAGS, 0, offsetof(struct Version, maj), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_maj_constraint_1, &ASN_PER_MEMB_MAJ_CONSTR_2, + 0, "maj"}, + {ATF_NOFLAGS, 0, offsetof(struct Version, min), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_min_constraint_1, &ASN_PER_MEMB_MIN_CONSTR_3, + 0, "min"}, + {ATF_NOFLAGS, 0, offsetof(struct Version, servind), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_servind_constraint_1, + &ASN_PER_MEMB_SERVIND_CONSTR_4, 0, "servind"}, }; static ber_tlv_tag_t asn_DEF_Version_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_Version_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* maj at 10 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* min at 11 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* servind at 12 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* maj at 10 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* min at 11 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* servind at 12 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Version_specs_1 = { sizeof(struct Version), offsetof(struct Version, _asn_ctx), asn_MAP_Version_tag2el_1, - 3, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ - -1, /* Start extensions */ - -1 /* Stop extensions */ + 3, /* Count of tags in the map */ + 0, + 0, + 0, /* Optional elements (not needed) */ + -1, /* Start extensions */ + -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Version = { "Version", @@ -154,16 +153,13 @@ asn_TYPE_descriptor_t asn_DEF_Version = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_Version_tags_1, - sizeof(asn_DEF_Version_tags_1) - /sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ - asn_DEF_Version_tags_1, /* Same as above */ - sizeof(asn_DEF_Version_tags_1) - /sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_Version_tags_1) / sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ + asn_DEF_Version_tags_1, /* Same as above */ + sizeof(asn_DEF_Version_tags_1) / sizeof(asn_DEF_Version_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_Version_1, - 3, /* Elements count */ - &asn_SPC_Version_specs_1 /* Additional specs */ + 3, /* Elements count */ + &asn_SPC_Version_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/Version.h b/src/core/libs/supl/asn-supl/Version.h index 2ca67dbda..e06fe109e 100644 --- a/src/core/libs/supl/asn-supl/Version.h +++ b/src/core/libs/supl/asn-supl/Version.h @@ -7,7 +7,6 @@ #ifndef _Version_H_ #define _Version_H_ - #include /* Including external dependencies */ diff --git a/src/core/libs/supl/asn-supl/VisibleString.c b/src/core/libs/supl/asn-supl/VisibleString.c index 3c1dd77cc..f4382431b 100644 --- a/src/core/libs/supl/asn-supl/VisibleString.c +++ b/src/core/libs/supl/asn-supl/VisibleString.c @@ -9,21 +9,21 @@ * VisibleString basic type description. */ static ber_tlv_tag_t asn_DEF_VisibleString_tags[] = { - (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ - (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ + (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ + (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t ASN_DEF_VISIBLE_STRING_CONSTRAINTS = { - { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ - 0, 0 -}; + {APC_CONSTRAINED, 7, 7, 0x20, 0x7e}, /* Value */ + {APC_SEMI_CONSTRAINED, -1, -1, 0, 0}, /* Size */ + 0, + 0}; asn_TYPE_descriptor_t asn_DEF_VisibleString = { "VisibleString", "VisibleString", OCTET_STRING_free, - OCTET_STRING_print_utf8, /* ASCII subset */ + OCTET_STRING_print_utf8, /* ASCII subset */ VisibleString_constraint, - OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ + OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, @@ -31,49 +31,52 @@ asn_TYPE_descriptor_t asn_DEF_VisibleString = { OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleString_tags, - sizeof(asn_DEF_VisibleString_tags) - / sizeof(asn_DEF_VisibleString_tags[0]) - 1, + sizeof(asn_DEF_VisibleString_tags) / sizeof(asn_DEF_VisibleString_tags[0]) - + 1, asn_DEF_VisibleString_tags, - sizeof(asn_DEF_VisibleString_tags) - / sizeof(asn_DEF_VisibleString_tags[0]), + sizeof(asn_DEF_VisibleString_tags) / sizeof(asn_DEF_VisibleString_tags[0]), &ASN_DEF_VISIBLE_STRING_CONSTRAINTS, - 0, 0, /* No members */ - 0 /* No specifics */ + 0, + 0, /* No members */ + 0 /* No specifics */ }; -int -VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ const VisibleString_t *st = (const VisibleString_t *)sptr; - if(st && st->buf) { - uint8_t *buf = st->buf; - uint8_t *end = buf + st->size; + if (st && st->buf) + { + uint8_t *buf = st->buf; + uint8_t *end = buf + st->size; - /* - * Check the alphabet of the VisibleString. - * ISO646, ISOReg#6 - * The alphabet is a subset of ASCII between the space - * and "~" (tilde). - */ - for(; buf < end; buf++) { - if(*buf < 0x20 || *buf > 0x7e) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value byte %ld (%d) " - "not in VisibleString alphabet (%s:%d)", - td->name, - ((buf - st->buf) + 1), - *buf, - __FILE__, __LINE__); - return -1; - } + /* + * Check the alphabet of the VisibleString. + * ISO646, ISOReg#6 + * The alphabet is a subset of ASCII between the space + * and "~" (tilde). + */ + for (; buf < end; buf++) + { + if (*buf < 0x20 || *buf > 0x7e) + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: value byte %ld (%d) " + "not in VisibleString alphabet (%s:%d)", + td->name, ((buf - st->buf) + 1), *buf, + __FILE__, __LINE__); + return -1; + } + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } return 0; } diff --git a/src/core/libs/supl/asn-supl/WcdmaCellInformation.c b/src/core/libs/supl/asn-supl/WcdmaCellInformation.c index 2ae543ee1..dafa0a0ce 100644 --- a/src/core/libs/supl/asn-supl/WcdmaCellInformation.c +++ b/src/core/libs/supl/asn-supl/WcdmaCellInformation.c @@ -6,203 +6,197 @@ #include "WcdmaCellInformation.h" -static int -memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refMCC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refMNC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 999)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 999)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_refUC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_refUC_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 268435455)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 268435455)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_primaryScramblingCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_primaryScramblingCode_constraint_1( + asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 511)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 511)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_REF_MCC_CONSTR_2 = { - { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 999} /* (0..999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_MNC_CONSTR_3 = { - { APC_CONSTRAINED, 10, 10, 0, 999 } /* (0..999) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 999} /* (0..999) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_REF_UC_CONSTR_4 = { - { APC_CONSTRAINED, 28, -1, 0, 268435455 } /* (0..268435455) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 28, -1, 0, 268435455} /* (0..268435455) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_6 = { - { APC_CONSTRAINED, 9, 9, 0, 511 } /* (0..511) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 9, 9, 0, 511} /* (0..511) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_WcdmaCellInformation_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMCC), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refMCC_constraint_1, - &ASN_PER_MEMB_REF_MCC_CONSTR_2, - 0, - "refMCC" - }, - { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMNC), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refMNC_constraint_1, - &ASN_PER_MEMB_REF_MNC_CONSTR_3, - 0, - "refMNC" - }, - { ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refUC), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_refUC_constraint_1, - &ASN_PER_MEMB_REF_UC_CONSTR_4, - 0, - "refUC" - }, - { ATF_POINTER, 3, offsetof(struct WcdmaCellInformation, frequencyInfo), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_FrequencyInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "frequencyInfo" - }, - { ATF_POINTER, 2, offsetof(struct WcdmaCellInformation, primaryScramblingCode), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_primaryScramblingCode_constraint_1, - &ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_6, - 0, - "primaryScramblingCode" - }, - { ATF_POINTER, 1, offsetof(struct WcdmaCellInformation, measuredResultsList), - (ASN_TAG_CLASS_CONTEXT | (5 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_MeasuredResultsList, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "measuredResultsList" - }, + {ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMCC), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refMCC_constraint_1, + &ASN_PER_MEMB_REF_MCC_CONSTR_2, 0, "refMCC"}, + {ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refMNC), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refMNC_constraint_1, + &ASN_PER_MEMB_REF_MNC_CONSTR_3, 0, "refMNC"}, + {ATF_NOFLAGS, 0, offsetof(struct WcdmaCellInformation, refUC), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_refUC_constraint_1, + &ASN_PER_MEMB_REF_UC_CONSTR_4, 0, "refUC"}, + {ATF_POINTER, 3, offsetof(struct WcdmaCellInformation, frequencyInfo), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_FrequencyInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "frequencyInfo"}, + {ATF_POINTER, 2, + offsetof(struct WcdmaCellInformation, primaryScramblingCode), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_primaryScramblingCode_constraint_1, + &ASN_PER_MEMB_PRIMARY_SCRAMBLING_CODE_CONSTR_6, 0, + "primaryScramblingCode"}, + {ATF_POINTER, 1, offsetof(struct WcdmaCellInformation, measuredResultsList), + (ASN_TAG_CLASS_CONTEXT | (5 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_MeasuredResultsList, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "measuredResultsList"}, }; -static int asn_MAP_WcdmaCellInformation_oms_1[] = { 3, 4, 5 }; +static int asn_MAP_WcdmaCellInformation_oms_1[] = {3, 4, 5}; static ber_tlv_tag_t asn_DEF_WcdmaCellInformation_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_WcdmaCellInformation_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* refMCC at 112 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* refMNC at 113 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* refUC at 114 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* frequencyInfo at 115 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* primaryScramblingCode at 116 */ - { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* measuredResultsList at 117 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* refMCC at 112 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* refMNC at 113 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* refUC at 114 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* frequencyInfo at 115 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, + 0}, /* primaryScramblingCode at 116 */ + {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, + 0} /* measuredResultsList at 117 */ }; static asn_SEQUENCE_specifics_t asn_SPC_WcdmaCellInformation_specs_1 = { sizeof(struct WcdmaCellInformation), offsetof(struct WcdmaCellInformation, _asn_ctx), asn_MAP_WcdmaCellInformation_tag2el_1, - 6, /* Count of tags in the map */ - asn_MAP_WcdmaCellInformation_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ - 5, /* Start extensions */ - 7 /* Stop extensions */ + 6, /* Count of tags in the map */ + asn_MAP_WcdmaCellInformation_oms_1, /* Optional members */ + 3, + 0, /* Root/Additions */ + 5, /* Start extensions */ + 7 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_WcdmaCellInformation = { "WcdmaCellInformation", @@ -216,16 +210,15 @@ asn_TYPE_descriptor_t asn_DEF_WcdmaCellInformation = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_WcdmaCellInformation_tags_1, - sizeof(asn_DEF_WcdmaCellInformation_tags_1) - /sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ - asn_DEF_WcdmaCellInformation_tags_1, /* Same as above */ - sizeof(asn_DEF_WcdmaCellInformation_tags_1) - /sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_WcdmaCellInformation_tags_1) / + sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ + asn_DEF_WcdmaCellInformation_tags_1, /* Same as above */ + sizeof(asn_DEF_WcdmaCellInformation_tags_1) / + sizeof(asn_DEF_WcdmaCellInformation_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_WcdmaCellInformation_1, - 6, /* Elements count */ - &asn_SPC_WcdmaCellInformation_specs_1 /* Additional specs */ + 6, /* Elements count */ + &asn_SPC_WcdmaCellInformation_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/WcdmaCellInformation.h b/src/core/libs/supl/asn-supl/WcdmaCellInformation.h index ab1a63ab8..b88fb3253 100644 --- a/src/core/libs/supl/asn-supl/WcdmaCellInformation.h +++ b/src/core/libs/supl/asn-supl/WcdmaCellInformation.h @@ -7,7 +7,6 @@ #ifndef _WcdmaCellInformation_H_ #define _WcdmaCellInformation_H_ - #include /* Including external dependencies */ @@ -33,9 +32,9 @@ extern "C" long *primaryScramblingCode /* OPTIONAL */; struct MeasuredResultsList *measuredResultsList /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/XNavigationModel.c b/src/core/libs/supl/asn-supl/XNavigationModel.c index 2ae7bd5b9..3f9dd7164 100644 --- a/src/core/libs/supl/asn-supl/XNavigationModel.c +++ b/src/core/libs/supl/asn-supl/XNavigationModel.c @@ -6,193 +6,188 @@ #include "XNavigationModel.h" -static int -memb_gpsWeek_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsWeek_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 1023)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 1023)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_gpsToe_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_gpsToe_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 167)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 167)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_nSAT_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_nSAT_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 31)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 31)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } -static int -memb_toeLimit_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +static int memb_toeLimit_constraint_1(asn_TYPE_descriptor_t *td, + const void *sptr, + asn_app_constraint_failed_f *ctfailcb, + void *app_key) +{ long value; - - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } - + + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } + value = *(const long *)sptr; - - if((value >= 0 && value <= 10)) { - /* Constraint check succeeded */ - return 0; - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: constraint failed (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + + if ((value >= 0 && value <= 10)) + { + /* Constraint check succeeded */ + return 0; + } + else + { + _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } } static asn_per_constraints_t ASN_PER_MEMB_GPS_WEEK_CONSTR_2 = { - { APC_CONSTRAINED, 10, 10, 0, 1023 } /* (0..1023) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 10, 10, 0, 1023} /* (0..1023) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_GPS_TOE_CONSTR_3 = { - { APC_CONSTRAINED, 8, 8, 0, 167 } /* (0..167) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 8, 8, 0, 167} /* (0..167) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_N_SAT_CONSTR_4 = { - { APC_CONSTRAINED, 5, 5, 0, 31 } /* (0..31) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 5, 5, 0, 31} /* (0..31) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_per_constraints_t ASN_PER_MEMB_TOE_LIMIT_CONSTR_5 = { - { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ + {APC_CONSTRAINED, 4, 4, 0, 10} /* (0..10) */, + {APC_UNCONSTRAINED, -1, -1, 0, 0}, + 0, + 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_XNavigationModel_1[] = { - { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsWeek), - (ASN_TAG_CLASS_CONTEXT | (0 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsWeek_constraint_1, - &ASN_PER_MEMB_GPS_WEEK_CONSTR_2, - 0, - "gpsWeek" - }, - { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsToe), - (ASN_TAG_CLASS_CONTEXT | (1 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_gpsToe_constraint_1, - &ASN_PER_MEMB_GPS_TOE_CONSTR_3, - 0, - "gpsToe" - }, - { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, nSAT), - (ASN_TAG_CLASS_CONTEXT | (2 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_nSAT_constraint_1, - &ASN_PER_MEMB_N_SAT_CONSTR_4, - 0, - "nSAT" - }, - { ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, toeLimit), - (ASN_TAG_CLASS_CONTEXT | (3 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_NativeInteger, - memb_toeLimit_constraint_1, - &ASN_PER_MEMB_TOE_LIMIT_CONSTR_5, - 0, - "toeLimit" - }, - { ATF_POINTER, 1, offsetof(struct XNavigationModel, satInfo), - (ASN_TAG_CLASS_CONTEXT | (4 << 2)), - -1, /* IMPLICIT tag at current level */ - &asn_DEF_SatelliteInfo, - 0, /* Defer constraints checking to the member type */ - 0, /* No PER visible constraints */ - 0, - "satInfo" - }, + {ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsWeek), + (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsWeek_constraint_1, + &ASN_PER_MEMB_GPS_WEEK_CONSTR_2, 0, "gpsWeek"}, + {ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, gpsToe), + (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_gpsToe_constraint_1, + &ASN_PER_MEMB_GPS_TOE_CONSTR_3, 0, "gpsToe"}, + {ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, nSAT), + (ASN_TAG_CLASS_CONTEXT | (2 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_nSAT_constraint_1, + &ASN_PER_MEMB_N_SAT_CONSTR_4, 0, "nSAT"}, + {ATF_NOFLAGS, 0, offsetof(struct XNavigationModel, toeLimit), + (ASN_TAG_CLASS_CONTEXT | (3 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_NativeInteger, memb_toeLimit_constraint_1, + &ASN_PER_MEMB_TOE_LIMIT_CONSTR_5, 0, "toeLimit"}, + {ATF_POINTER, 1, offsetof(struct XNavigationModel, satInfo), + (ASN_TAG_CLASS_CONTEXT | (4 << 2)), -1, /* IMPLICIT tag at current level */ + &asn_DEF_SatelliteInfo, + 0, /* Defer constraints checking to the member type */ + 0, /* No PER visible constraints */ + 0, "satInfo"}, }; -static int asn_MAP_XNavigationModel_oms_1[] = { 4 }; +static int asn_MAP_XNavigationModel_oms_1[] = {4}; static ber_tlv_tag_t asn_DEF_XNavigationModel_tags_1[] = { - (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) -}; + (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))}; static asn_TYPE_tag2member_t asn_MAP_XNavigationModel_tag2el_1[] = { - { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gpsWeek at 38 */ - { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gpsToe at 39 */ - { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* nSAT at 40 */ - { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* toeLimit at 41 */ - { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* satInfo at 42 */ + {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* gpsWeek at 38 */ + {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* gpsToe at 39 */ + {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* nSAT at 40 */ + {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* toeLimit at 41 */ + {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0} /* satInfo at 42 */ }; static asn_SEQUENCE_specifics_t asn_SPC_XNavigationModel_specs_1 = { sizeof(struct XNavigationModel), offsetof(struct XNavigationModel, _asn_ctx), asn_MAP_XNavigationModel_tag2el_1, - 5, /* Count of tags in the map */ - asn_MAP_XNavigationModel_oms_1, /* Optional members */ - 1, 0, /* Root/Additions */ - 4, /* Start extensions */ - 6 /* Stop extensions */ + 5, /* Count of tags in the map */ + asn_MAP_XNavigationModel_oms_1, /* Optional members */ + 1, + 0, /* Root/Additions */ + 4, /* Start extensions */ + 6 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_XNavigationModel = { "XNavigationModel", @@ -206,16 +201,15 @@ asn_TYPE_descriptor_t asn_DEF_XNavigationModel = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, - 0, /* Use generic outmost tag fetcher */ + 0, /* Use generic outmost tag fetcher */ asn_DEF_XNavigationModel_tags_1, - sizeof(asn_DEF_XNavigationModel_tags_1) - /sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ - asn_DEF_XNavigationModel_tags_1, /* Same as above */ - sizeof(asn_DEF_XNavigationModel_tags_1) - /sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ - 0, /* No PER visible constraints */ + sizeof(asn_DEF_XNavigationModel_tags_1) / + sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ + asn_DEF_XNavigationModel_tags_1, /* Same as above */ + sizeof(asn_DEF_XNavigationModel_tags_1) / + sizeof(asn_DEF_XNavigationModel_tags_1[0]), /* 1 */ + 0, /* No PER visible constraints */ asn_MBR_XNavigationModel_1, - 5, /* Elements count */ - &asn_SPC_XNavigationModel_specs_1 /* Additional specs */ + 5, /* Elements count */ + &asn_SPC_XNavigationModel_specs_1 /* Additional specs */ }; - diff --git a/src/core/libs/supl/asn-supl/XNavigationModel.h b/src/core/libs/supl/asn-supl/XNavigationModel.h index b8c753d78..814d16983 100644 --- a/src/core/libs/supl/asn-supl/XNavigationModel.h +++ b/src/core/libs/supl/asn-supl/XNavigationModel.h @@ -7,7 +7,6 @@ #ifndef _XNavigationModel_H_ #define _XNavigationModel_H_ - #include /* Including external dependencies */ @@ -31,9 +30,9 @@ extern "C" long toeLimit; struct SatelliteInfo *satInfo /* OPTIONAL */; /* - * This type is extensible, - * possible extensions are below. - */ + * This type is extensible, + * possible extensions are below. + */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; diff --git a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c index b26c996e8..924cb150e 100644 --- a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c +++ b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.c @@ -7,34 +7,38 @@ typedef A_SEQUENCE_OF(void) asn_sequence; -void -asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { +void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) +{ asn_sequence *as = (asn_sequence *)asn_sequence_of_x; - if(as) { - void *ptr; - int n; + if (as) + { + void *ptr; + int n; - if(number < 0 || number >= as->count) - return; /* Nothing to delete */ + if (number < 0 || number >= as->count) + return; /* Nothing to delete */ - if(_do_free && as->free) { - ptr = as->array[number]; - } else { - ptr = 0; + if (_do_free && as->free) + { + ptr = as->array[number]; + } + else + { + ptr = 0; + } + + /* + * Shift all elements to the left to hide the gap. + */ + --as->count; + for (n = number; n < as->count; n++) + as->array[n] = as->array[n + 1]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if (ptr) as->free(ptr); } - - /* - * Shift all elements to the left to hide the gap. - */ - --as->count; - for(n = number; n < as->count; n++) - as->array[n] = as->array[n+1]; - - /* - * Invoke the third-party function only when the state - * of the parent structure is consistent. - */ - if(ptr) as->free(ptr); - } } diff --git a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h index 2ad8287a0..7907b2ca9 100644 --- a/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h +++ b/src/core/libs/supl/asn-supl/asn_SEQUENCE_OF.h @@ -19,29 +19,28 @@ extern "C" */ #define A_SEQUENCE_OF(type) A_SET_OF(type) -#define ASN_SEQUENCE_ADD(headptr, ptr) \ - asn_sequence_add((headptr), (ptr)) +#define ASN_SEQUENCE_ADD(headptr, ptr) asn_sequence_add((headptr), (ptr)) /*********************************************** - * Implementation of the SEQUENCE OF structure. - */ + * Implementation of the SEQUENCE OF structure. + */ #define asn_sequence_add asn_set_add #define asn_sequence_empty asn_set_empty /* - * Delete the element from the set by its number (base 0). - * This is NOT a constant-time operation. - * The order of elements is preserved. - * If _do_free is given AND the (*free) is initialized, the element - * will be freed using the custom (*free) function as well. - */ + * Delete the element from the set by its number (base 0). + * This is NOT a constant-time operation. + * The order of elements is preserved. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); /* - * Cope with different conversions requirements to/from void in C and C++. - * This is mostly useful for support library. - */ + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; #define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) #define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) diff --git a/src/core/libs/supl/asn-supl/asn_SET_OF.c b/src/core/libs/supl/asn-supl/asn_SET_OF.c index b9a11f2f6..2239dbe58 100644 --- a/src/core/libs/supl/asn-supl/asn_SET_OF.c +++ b/src/core/libs/supl/asn-supl/asn_SET_OF.c @@ -9,79 +9,88 @@ /* * Add another element into the set. */ -int -asn_set_add(void *asn_set_of_x, void *ptr) { +int asn_set_add(void *asn_set_of_x, void *ptr) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as == 0 || ptr == 0) { - errno = EINVAL; /* Invalid arguments */ - return -1; - } + if (as == 0 || ptr == 0) + { + errno = EINVAL; /* Invalid arguments */ + return -1; + } /* * Make sure there's enough space to insert an element. */ - if(as->count == as->size) { - int _newsize = as->size ? (as->size << 1) : 4; - void *_new_arr; - _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); - if(_new_arr) { - as->array = (void **)_new_arr; - as->size = _newsize; - } else { - /* ENOMEM */ - return -1; + if (as->count == as->size) + { + int _newsize = as->size ? (as->size << 1) : 4; + void *_new_arr; + _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); + if (_new_arr) + { + as->array = (void **)_new_arr; + as->size = _newsize; + } + else + { + /* ENOMEM */ + return -1; + } } - } as->array[as->count++] = ptr; return 0; } -void -asn_set_del(void *asn_set_of_x, int number, int _do_free) { +void asn_set_del(void *asn_set_of_x, int number, int _do_free) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as) { - void *ptr; - if(number < 0 || number >= as->count) - return; + if (as) + { + void *ptr; + if (number < 0 || number >= as->count) return; - if(_do_free && as->free) { - ptr = as->array[number]; - } else { - ptr = 0; + if (_do_free && as->free) + { + ptr = as->array[number]; + } + else + { + ptr = 0; + } + + as->array[number] = as->array[--as->count]; + + /* + * Invoke the third-party function only when the state + * of the parent structure is consistent. + */ + if (ptr) as->free(ptr); } - - as->array[number] = as->array[--as->count]; - - /* - * Invoke the third-party function only when the state - * of the parent structure is consistent. - */ - if(ptr) as->free(ptr); - } } /* * Free the contents of the set, do not free the set itself. */ -void -asn_set_empty(void *asn_set_of_x) { +void asn_set_empty(void *asn_set_of_x) +{ asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); - if(as) { - if(as->array) { - if(as->free) { - while(as->count--) - as->free(as->array[as->count]); - } - FREEMEM(as->array); - as->array = 0; + if (as) + { + if (as->array) + { + if (as->free) + { + while (as->count--) as->free(as->array[as->count]); + } + FREEMEM(as->array); + as->array = 0; + } + as->count = 0; + as->size = 0; } - as->count = 0; - as->size = 0; - } - } diff --git a/src/core/libs/supl/asn-supl/asn_SET_OF.h b/src/core/libs/supl/asn-supl/asn_SET_OF.h index 0edc0abc4..64264e091 100644 --- a/src/core/libs/supl/asn-supl/asn_SET_OF.h +++ b/src/core/libs/supl/asn-supl/asn_SET_OF.h @@ -19,40 +19,39 @@ extern "C" void (*free)(type *); \ } -#define ASN_SET_ADD(headptr, ptr) \ - asn_set_add((headptr), (ptr)) +#define ASN_SET_ADD(headptr, ptr) asn_set_add((headptr), (ptr)) /******************************************* - * Implementation of the SET OF structure. - */ + * Implementation of the SET OF structure. + */ /* - * Add another structure into the set by its pointer. - * RETURN VALUES: - * 0 for success and -1/errno for failure. - */ + * Add another structure into the set by its pointer. + * RETURN VALUES: + * 0 for success and -1/errno for failure. + */ int asn_set_add(void *asn_set_of_x, void *ptr); /* - * Delete the element from the set by its number (base 0). - * This is a constant-time operation. The order of elements before the - * deleted ones is guaranteed, the order of elements after the deleted - * one is NOT guaranteed. - * If _do_free is given AND the (*free) is initialized, the element - * will be freed using the custom (*free) function as well. - */ + * Delete the element from the set by its number (base 0). + * This is a constant-time operation. The order of elements before the + * deleted ones is guaranteed, the order of elements after the deleted + * one is NOT guaranteed. + * If _do_free is given AND the (*free) is initialized, the element + * will be freed using the custom (*free) function as well. + */ void asn_set_del(void *asn_set_of_x, int number, int _do_free); /* - * Empty the contents of the set. Will free the elements, if (*free) is given. - * Will NOT free the set itself. - */ + * Empty the contents of the set. Will free the elements, if (*free) is + * given. Will NOT free the set itself. + */ void asn_set_empty(void *asn_set_of_x); /* - * Cope with different conversions requirements to/from void in C and C++. - * This is mostly useful for support library. - */ + * Cope with different conversions requirements to/from void in C and C++. + * This is mostly useful for support library. + */ typedef A_SET_OF(void) asn_anonymous_set_; #define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) #define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) diff --git a/src/core/libs/supl/asn-supl/asn_application.h b/src/core/libs/supl/asn-supl/asn_application.h index 43904afb0..ec8567737 100644 --- a/src/core/libs/supl/asn-supl/asn_application.h +++ b/src/core/libs/supl/asn-supl/asn_application.h @@ -17,24 +17,25 @@ extern "C" #endif /* - * Generic type of an application-defined callback to return various - * types of data to the application. - * EXPECTED RETURN VALUES: - * -1: Failed to consume bytes. Abort the mission. - * Non-negative return values indicate success, and ignored. - */ + * Generic type of an application-defined callback to return various + * types of data to the application. + * EXPECTED RETURN VALUES: + * -1: Failed to consume bytes. Abort the mission. + * Non-negative return values indicate success, and ignored. + */ typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size, - void *application_specific_key); + void *application_specific_key); /* - * A callback of this type is called whenever constraint validation fails - * on some ASN.1 type. See "constraints.h" for more details on constraint - * validation. - * This callback specifies a descriptor of the ASN.1 type which failed - * the constraint check, as well as human readable message on what - * particular constraint has failed. - */ - typedef void(asn_app_constraint_failed_f)(void *application_specific_key, + * A callback of this type is called whenever constraint validation fails + * on some ASN.1 type. See "constraints.h" for more details on constraint + * validation. + * This callback specifies a descriptor of the ASN.1 type which failed + * the constraint check, as well as human readable message on what + * particular constraint has failed. + */ + typedef void(asn_app_constraint_failed_f)( + void *application_specific_key, struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); diff --git a/src/core/libs/supl/asn-supl/asn_codecs.h b/src/core/libs/supl/asn-supl/asn_codecs.h index aee15e8fc..dd6b68bcc 100644 --- a/src/core/libs/supl/asn-supl/asn_codecs.h +++ b/src/core/libs/supl/asn-supl/asn_codecs.h @@ -14,45 +14,46 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * This structure defines a set of parameters that may be passed - * to every ASN.1 encoder or decoder function. - * WARNING: if max_stack_size member is set, and you are calling the - * function pointers of the asn_TYPE_descriptor_t directly, - * this structure must be ALLOCATED ON THE STACK! - * If you can't always satisfy this requirement, use ber_decode(), - * xer_decode() and uper_decode() functions instead. - */ + * This structure defines a set of parameters that may be passed + * to every ASN.1 encoder or decoder function. + * WARNING: if max_stack_size member is set, and you are calling the + * function pointers of the asn_TYPE_descriptor_t directly, + * this structure must be ALLOCATED ON THE STACK! + * If you can't always satisfy this requirement, use ber_decode(), + * xer_decode() and uper_decode() functions instead. + */ typedef struct asn_codec_ctx_s { /* - * Limit the decoder routines to use no (much) more stack than a given - * number of bytes. Most of decoders are stack-based, and this - * would protect against stack overflows if the number of nested - * encodings is high. - * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, - * and are safe from this kind of overflow. - * A value from getrlimit(RLIMIT_STACK) may be used to initialize - * this variable. Be careful in multithreaded environments, as the - * stack size is rather limited. - */ + * Limit the decoder routines to use no (much) more stack than a given + * number of bytes. Most of decoders are stack-based, and this + * would protect against stack overflows if the number of nested + * encodings is high. + * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, + * and are safe from this kind of overflow. + * A value from getrlimit(RLIMIT_STACK) may be used to initialize + * this variable. Be careful in multithreaded environments, as the + * stack size is rather limited. + */ size_t max_stack_size; /* 0 disables stack bounds checking */ } asn_codec_ctx_t; /* - * Type of the return value of the encoding functions (der_encode, xer_encode). - */ + * Type of the return value of the encoding functions (der_encode, + * xer_encode). + */ typedef struct asn_enc_rval_s { /* - * Number of bytes encoded. - * -1 indicates failure to encode the structure. - * In this case, the members below this one are meaningful. - */ + * Number of bytes encoded. + * -1 indicates failure to encode the structure. + * In this case, the members below this one are meaningful. + */ ssize_t encoded; /* - * Members meaningful when (encoded == -1), for post mortem analysis. - */ + * Members meaningful when (encoded == -1), for post mortem analysis. + */ /* Type which cannot be encoded */ struct asn_TYPE_descriptor_s *failed_type; @@ -81,13 +82,14 @@ extern "C" while (0) /* - * Type of the return value of the decoding functions (ber_decode, xer_decode) - * - * Please note that the number of consumed bytes is ALWAYS meaningful, - * even if code==RC_FAIL. This is to indicate the number of successfully - * decoded bytes, hence providing a possibility to fail with more diagnostics - * (i.e., print the offending remainder of the buffer). - */ + * Type of the return value of the decoding functions (ber_decode, + * xer_decode) + * + * Please note that the number of consumed bytes is ALWAYS meaningful, + * even if code==RC_FAIL. This is to indicate the number of successfully + * decoded bytes, hence providing a possibility to fail with more + * diagnostics (i.e., print the offending remainder of the buffer). + */ enum asn_dec_rval_code_e { RC_OK, /* Decoded successfully */ diff --git a/src/core/libs/supl/asn-supl/asn_codecs_prim.c b/src/core/libs/supl/asn-supl/asn_codecs_prim.c index 2ad102eca..692601c17 100644 --- a/src/core/libs/supl/asn-supl/asn_codecs_prim.c +++ b/src/core/libs/supl/asn-supl/asn_codecs_prim.c @@ -9,10 +9,11 @@ /* * Decode an always-primitive type. */ -asn_dec_rval_t -ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, const void *buf_ptr, size_t size, int tag_mode) { +asn_dec_rval_t ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buf_ptr, size_t size, + int tag_mode) +{ ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; asn_dec_rval_t rval; ber_tlv_len_t length; @@ -20,22 +21,21 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * If the structure is not there, allocate it. */ - if(st == NULL) { - st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); - if(st == NULL) _ASN_DECODE_FAILED; - *sptr = (void *)st; - } + if (st == NULL) + { + st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); + if (st == NULL) _ASN_DECODE_FAILED; + *sptr = (void *)st; + } - ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", - td->name, tag_mode); + ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", td->name, tag_mode); /* * Check tags and extract value length. */ - rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, - tag_mode, 0, &length, 0); - if(rval.code != RC_OK) - return rval; + rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, + &length, 0); + if (rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); @@ -44,35 +44,36 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; - if(length > (ber_tlv_len_t)size) { - rval.code = RC_WMORE; - rval.consumed = 0; - return rval; - } + if (length > (ber_tlv_len_t)size) + { + rval.code = RC_WMORE; + rval.consumed = 0; + return rval; + } st->size = (int)length; /* The following better be optimized away. */ - if(sizeof(st->size) != sizeof(length) - && (ber_tlv_len_t)st->size != length) { - st->size = 0; - _ASN_DECODE_FAILED; - } + if (sizeof(st->size) != sizeof(length) && (ber_tlv_len_t)st->size != length) + { + st->size = 0; + _ASN_DECODE_FAILED; + } st->buf = (uint8_t *)MALLOC(length + 1); - if(!st->buf) { - st->size = 0; - _ASN_DECODE_FAILED; - } + if (!st->buf) + { + st->size = 0; + _ASN_DECODE_FAILED; + } memcpy(st->buf, buf_ptr, length); - st->buf[length] = '\0'; /* Just in case */ + st->buf[length] = '\0'; /* Just in case */ rval.code = RC_OK; rval.consumed += length; - ASN_DEBUG("Took %ld/%ld bytes to encode %s", - (long)rval.consumed, - (long)length, td->name); + ASN_DEBUG("Took %ld/%ld bytes to encode %s", (long)rval.consumed, + (long)length, td->name); return rval; } @@ -80,62 +81,63 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * Encode an always-primitive type using DER. */ -asn_enc_rval_t -der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t erval; ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; ASN_DEBUG("%s %s as a primitive type (tm=%d)", - cb?"Encoding":"Estimating", td->name, tag_mode); + cb ? "Encoding" : "Estimating", td->name, tag_mode); - erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, - cb, app_key); + erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, cb, app_key); ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); - if(erval.encoded == -1) { - erval.failed_type = td; - erval.structure_ptr = sptr; - return erval; - } - - if(cb && st->buf) { - if(cb(st->buf, st->size, app_key) < 0) { - erval.encoded = -1; + if (erval.encoded == -1) + { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } - } else { - assert(st->buf || st->size == 0); - } + + if (cb && st->buf) + { + if (cb(st->buf, st->size, app_key) < 0) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = sptr; + return erval; + } + } + else + { + assert(st->buf || st->size == 0); + } erval.encoded += st->size; _ASN_ENCODED_OK(erval); } -void -ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, - int contents_only) { +void ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, + int contents_only) +{ ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; - if(!td || !sptr) - return; + if (!td || !sptr) return; ASN_DEBUG("Freeing %s as a primitive type", td->name); - if(st->buf) - FREEMEM(st->buf); + if (st->buf) FREEMEM(st->buf); - if(!contents_only) - FREEMEM(st); + if (!contents_only) FREEMEM(st); } - /* * Local internal type passed around as an argument. */ -struct xdp_arg_s { +struct xdp_arg_s +{ asn_TYPE_descriptor_t *type_descriptor; void *struct_key; xer_primitive_body_decoder_f *prim_body_decoder; @@ -143,94 +145,94 @@ struct xdp_arg_s { int want_more; }; - -static int -xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { +static int xer_decode__unexpected_tag(void *key, const void *chunk_buf, + size_t chunk_size) +{ struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; - if(arg->decoded_something) { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return 0; /* Skip it. */ - /* - * Decoding was done once already. Prohibit doing it again. - */ - return -1; - } + if (arg->decoded_something) + { + if (xer_is_whitespace(chunk_buf, chunk_size)) + return 0; /* Skip it. */ + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } - bret = arg->prim_body_decoder(arg->type_descriptor, - arg->struct_key, chunk_buf, chunk_size); - switch(bret) { - case XPBD_SYSTEM_FAILURE: - case XPBD_DECODER_LIMIT: - case XPBD_BROKEN_ENCODING: - break; - case XPBD_BODY_CONSUMED: - /* Tag decoded successfully */ - arg->decoded_something = 1; - /* Fall through */ - case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ - return 0; - } + bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, + chunk_buf, chunk_size); + switch (bret) + { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return 0; + } return -1; } -static ssize_t -xer_decode__body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { +static ssize_t xer_decode__body(void *key, const void *chunk_buf, + size_t chunk_size, int have_more) +{ struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; - if(arg->decoded_something) { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return chunk_size; - /* - * Decoding was done once already. Prohibit doing it again. - */ - return -1; - } + if (arg->decoded_something) + { + if (xer_is_whitespace(chunk_buf, chunk_size)) return chunk_size; + /* + * Decoding was done once already. Prohibit doing it again. + */ + return -1; + } - if(!have_more) { - /* - * If we've received something like "1", we can't really - * tell whether it is really `1` or `123`, until we know - * that there is no more data coming. - * The have_more argument will be set to 1 once something - * like this is available to the caller of this callback: - * "1want_more = 1; - return -1; - } + if (!have_more) + { + /* + * If we've received something like "1", we can't really + * tell whether it is really `1` or `123`, until we know + * that there is no more data coming. + * The have_more argument will be set to 1 once something + * like this is available to the caller of this callback: + * "1want_more = 1; + return -1; + } - bret = arg->prim_body_decoder(arg->type_descriptor, - arg->struct_key, chunk_buf, chunk_size); - switch(bret) { - case XPBD_SYSTEM_FAILURE: - case XPBD_DECODER_LIMIT: - case XPBD_BROKEN_ENCODING: - break; - case XPBD_BODY_CONSUMED: - /* Tag decoded successfully */ - arg->decoded_something = 1; - /* Fall through */ - case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ - return chunk_size; - } + bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, + chunk_buf, chunk_size); + switch (bret) + { + case XPBD_SYSTEM_FAILURE: + case XPBD_DECODER_LIMIT: + case XPBD_BROKEN_ENCODING: + break; + case XPBD_BODY_CONSUMED: + /* Tag decoded successfully */ + arg->decoded_something = 1; + /* Fall through */ + case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ + return chunk_size; + } return -1; } - -asn_dec_rval_t -xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, - size_t struct_size, - const char *opt_mname, - const void *buf_ptr, size_t size, - xer_primitive_body_decoder_f *prim_body_decoder -) { +asn_dec_rval_t xer_decode_primitive( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, + size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, + xer_primitive_body_decoder_f *prim_body_decoder) +{ const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; asn_struct_ctx_t s_ctx; struct xdp_arg_s s_arg; @@ -239,10 +241,11 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, /* * Create the structure if does not exist. */ - if(!*sptr) { - *sptr = CALLOC(1, struct_size); - if(!*sptr) _ASN_DECODE_FAILED; - } + if (!*sptr) + { + *sptr = CALLOC(1, struct_size); + if (!*sptr) _ASN_DECODE_FAILED; + } memset(&s_ctx, 0, sizeof(s_ctx)); s_arg.type_descriptor = td; @@ -251,44 +254,47 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, s_arg.decoded_something = 0; s_arg.want_more = 0; - rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, - xml_tag, buf_ptr, size, - xer_decode__unexpected_tag, xer_decode__body); - switch(rc.code) { - case RC_OK: - if(!s_arg.decoded_something) { - char ch; - ASN_DEBUG("Primitive body is not recognized, " - "supplying empty one"); - /* - * Decoding opportunity has come and gone. - * Where's the result? - * Try to feed with empty body, see if it eats it. - */ - if(prim_body_decoder(s_arg.type_descriptor, - s_arg.struct_key, &ch, 0) - != XPBD_BODY_CONSUMED) { + rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, xml_tag, buf_ptr, + size, xer_decode__unexpected_tag, xer_decode__body); + switch (rc.code) + { + case RC_OK: + if (!s_arg.decoded_something) + { + char ch; + ASN_DEBUG( + "Primitive body is not recognized, " + "supplying empty one"); + /* + * Decoding opportunity has come and gone. + * Where's the result? + * Try to feed with empty body, see if it eats it. + */ + if (prim_body_decoder(s_arg.type_descriptor, + s_arg.struct_key, &ch, + 0) != XPBD_BODY_CONSUMED) + { + /* + * This decoder does not like empty stuff. + */ + _ASN_DECODE_FAILED; + } + } + break; + case RC_WMORE: /* - * This decoder does not like empty stuff. + * Redo the whole thing later. + * We don't have a context to save intermediate parsing state. */ - _ASN_DECODE_FAILED; - } + rc.consumed = 0; + break; + case RC_FAIL: + rc.consumed = 0; + if (s_arg.want_more) + rc.code = RC_WMORE; + else + _ASN_DECODE_FAILED; + break; } - break; - case RC_WMORE: - /* - * Redo the whole thing later. - * We don't have a context to save intermediate parsing state. - */ - rc.consumed = 0; - break; - case RC_FAIL: - rc.consumed = 0; - if(s_arg.want_more) - rc.code = RC_WMORE; - else - _ASN_DECODE_FAILED; - break; - } return rc; } diff --git a/src/core/libs/supl/asn-supl/asn_codecs_prim.h b/src/core/libs/supl/asn-supl/asn_codecs_prim.h index 6ebaefb87..275fbbdbb 100644 --- a/src/core/libs/supl/asn-supl/asn_codecs_prim.h +++ b/src/core/libs/supl/asn-supl/asn_codecs_prim.h @@ -14,8 +14,8 @@ extern "C" typedef struct ASN__PRIMITIVE_TYPE_s { - uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ - int size; /* Size of the buffer */ + uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ + int size; /* Size of the buffer */ } ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ asn_struct_free_f ASN__PRIMITIVE_TYPE_free; @@ -23,8 +23,8 @@ extern "C" der_type_encoder_f der_encode_primitive; /* - * A callback specification for the xer_decode_primitive() function below. - */ + * A callback specification for the xer_decode_primitive() function below. + */ enum xer_pbd_rval { XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ @@ -33,19 +33,18 @@ extern "C" XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ XPBD_BODY_CONSUMED /* Body is recognized and consumed */ }; - typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)(asn_TYPE_descriptor_t *td, void *struct_ptr, - const void *chunk_buf, size_t chunk_size); + typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)( + asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf, + size_t chunk_size); /* - * Specific function to decode simple primitive types. - * Also see xer_decode_general() in xer_decoder.h - */ - asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, - void **sptr, size_t struct_size, - const char *opt_mname, - const void *buf_ptr, size_t size, - xer_primitive_body_decoder_f *prim_body_decoder); + * Specific function to decode simple primitive types. + * Also see xer_decode_general() in xer_decoder.h + */ + asn_dec_rval_t xer_decode_primitive( + asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, + size_t struct_size, const char *opt_mname, const void *buf_ptr, + size_t size, xer_primitive_body_decoder_f *prim_body_decoder); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/asn_internal.h b/src/core/libs/supl/asn-supl/asn_internal.h index 299c4e0e7..339dc86e4 100644 --- a/src/core/libs/supl/asn-supl/asn_internal.h +++ b/src/core/libs/supl/asn-supl/asn_internal.h @@ -41,25 +41,21 @@ extern "C" #else /* !ASN_THREAD_SAFE */ int asn_debug_indent; #endif /* ASN_THREAD_SAFE */ -#define ASN_DEBUG(fmt, args...) \ - do \ - { \ - int adi = asn_debug_indent; \ - while (adi--) fprintf(stderr, " "); \ - fprintf(stderr, fmt, ##args); \ - fprintf(stderr, " (%s:%d)\n", \ - __FILE__, __LINE__); \ - } \ +#define ASN_DEBUG(fmt, args...) \ + do \ + { \ + int adi = asn_debug_indent; \ + while (adi--) fprintf(stderr, " "); \ + fprintf(stderr, fmt, ##args); \ + fprintf(stderr, " (%s:%d)\n", __FILE__, __LINE__); \ + } \ while (0) #else /* !__GNUC__ */ void ASN_DEBUG_f(const char *fmt, ...); #define ASN_DEBUG ASN_DEBUG_f #endif /* __GNUC__ */ #else /* EMIT_ASN_DEBUG != 1 */ - static inline void ASN_DEBUG(const char *fmt, ...) - { - (void)fmt; - } + static inline void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } #endif /* EMIT_ASN_DEBUG */ #endif /* ASN_DEBUG */ @@ -73,25 +69,24 @@ extern "C" if (foo) goto cb_failed; \ } \ while (0) -#define _ASN_CALLBACK(buf, size) \ - _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) +#define _ASN_CALLBACK(buf, size) _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) #define _ASN_CALLBACK2(buf1, size1, buf2, size2) \ _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2)) -#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ - _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2) || __ASN_E_cbc(buf3, size3)) +#define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ + _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2) || \ + __ASN_E_cbc(buf3, size3)) -#define _i_ASN_TEXT_INDENT(nl, level) \ - do \ - { \ - int __level = (level); \ - int __nl = ((nl) != 0); \ - int __i; \ - if (__nl) _ASN_CALLBACK("\n", 1); \ - if (__level < 0) __level = 0; \ - for (__i = 0; __i < __level; __i++) \ - _ASN_CALLBACK(" ", 4); \ - er.encoded += __nl + 4 * __level; \ - } \ +#define _i_ASN_TEXT_INDENT(nl, level) \ + do \ + { \ + int __level = (level); \ + int __nl = ((nl) != 0); \ + int __i; \ + if (__nl) _ASN_CALLBACK("\n", 1); \ + if (__level < 0) __level = 0; \ + for (__i = 0; __i < __level; __i++) _ASN_CALLBACK(" ", 4); \ + er.encoded += __nl + 4 * __level; \ + } \ while (0) #define _i_INDENT(nl) \ @@ -108,8 +103,7 @@ extern "C" * Check stack against overflow, if limit is set. */ #define _ASN_DEFAULT_STACK_MAX (30000) - static inline int - _ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) + static inline int _ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { if (ctx && ctx->max_stack_size) { @@ -121,7 +115,7 @@ extern "C" if (usedstack < -(ptrdiff_t)ctx->max_stack_size) { ASN_DEBUG("Stack limit %ld reached", - (long)ctx->max_stack_size); + (long)ctx->max_stack_size); return -1; } } diff --git a/src/core/libs/supl/asn-supl/asn_system.h b/src/core/libs/supl/asn-supl/asn_system.h index 4c175d3d3..5eacc2ecb 100644 --- a/src/core/libs/supl/asn-supl/asn_system.h +++ b/src/core/libs/supl/asn-supl/asn_system.h @@ -28,7 +28,9 @@ #define vsnprintf _vsnprintf /* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ -#define sys_ntohl(l) ((((l) << 24) & 0xff000000) | (((l) << 16) & 0xff0000) | (((l) << 8) & 0xff00) | ((l)&0xff)) +#define sys_ntohl(l) \ + ((((l) << 24) & 0xff000000) | (((l) << 16) & 0xff0000) | \ + (((l) << 8) & 0xff00) | ((l)&0xff)) #ifdef _MSC_VER /* MSVS.Net */ #ifndef __cplusplus @@ -116,8 +118,12 @@ typedef unsigned int uint32_t; #ifndef MIN /* Suitable for comparing primitive types (integers) */ #if defined(__GNUC__) -#define MIN(a, b) ({ __typeof a _a = a; __typeof b _b = b; \ - ((_a)<(_b)?(_a):(_b)); }) +#define MIN(a, b) \ + ({ \ + __typeof a _a = a; \ + __typeof b _b = b; \ + ((_a) < (_b) ? (_a) : (_b)); \ + }) #else /* !__GNUC__ */ #define MIN(a, b) ((a) < (b) ? (a) : (b)) /* Unsafe variant */ #endif /* __GNUC__ */ diff --git a/src/core/libs/supl/asn-supl/ber_decoder.c b/src/core/libs/supl/asn-supl/ber_decoder.c index 89c1475e8..36fc4b9d2 100644 --- a/src/core/libs/supl/asn-supl/ber_decoder.c +++ b/src/core/libs/supl/asn-supl/ber_decoder.c @@ -4,68 +4,80 @@ */ #include -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) -#undef RETURN -#define RETURN(_code) do { \ - asn_dec_rval_t rval; \ - rval.code = _code; \ - if(opt_ctx) opt_ctx->step = step; /* Save context */ \ - if((_code) == RC_OK || opt_ctx) \ - rval.consumed = consumed_myself; \ - else \ - rval.consumed = 0; /* Context-free */ \ - return rval; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + asn_dec_rval_t rval; \ + rval.code = _code; \ + if (opt_ctx) opt_ctx->step = step; /* Save context */ \ + if ((_code) == RC_OK || opt_ctx) \ + rval.consumed = consumed_myself; \ + else \ + rval.consumed = 0; /* Context-free */ \ + return rval; \ + } \ + while (0) /* * The BER decoder of any type. */ -asn_dec_rval_t -ber_decode(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *type_descriptor, - void **struct_ptr, const void *ptr, size_t size) { +asn_dec_rval_t ber_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *type_descriptor, + void **struct_ptr, const void *ptr, size_t size) +{ asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* * Invoke type-specific decoder. */ - return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, - struct_ptr, /* Pointer to the destination structure */ - ptr, size, /* Buffer and its size */ - 0 /* Default tag mode is 0 */ - ); + return type_descriptor->ber_decoder( + opt_codec_ctx, type_descriptor, + struct_ptr, /* Pointer to the destination structure */ + ptr, size, /* Buffer and its size */ + 0 /* Default tag mode is 0 */ + ); } /* * Check the set of >> tags matches the definition. */ -asn_dec_rval_t -ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, - asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, - const void *ptr, size_t size, int tag_mode, int last_tag_form, - ber_tlv_len_t *last_length, int *opt_tlv_form) { +asn_dec_rval_t ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_struct_ctx_t *opt_ctx, const void *ptr, + size_t size, int tag_mode, int last_tag_form, + ber_tlv_len_t *last_length, int *opt_tlv_form) +{ ssize_t consumed_myself = 0; ssize_t tag_len; ssize_t len_len; @@ -73,15 +85,14 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, ber_tlv_len_t tlv_len; ber_tlv_len_t limit_len = -1; int expect_00_terminators = 0; - int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ - int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ + int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ + int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ int tagno; /* * Make sure we didn't exceed the maximum stack size. */ - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - RETURN(RC_FAIL); + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) RETURN(RC_FAIL); /* * So what does all this implicit skip stuff mean? @@ -105,176 +116,209 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, * it appropriately. */ - tagno = step /* Continuing where left previously */ - + (tag_mode==1?-1:0) - ; + tagno = step /* Continuing where left previously */ + + (tag_mode == 1 ? -1 : 0); ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", - td->name, (long)size, tag_mode, step, tagno); + td->name, (long)size, tag_mode, step, tagno); /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ - if(tag_mode == 0 && tagno == td->tags_count) { - /* - * This must be the _untagged_ ANY type, - * which outermost tag isn't known in advance. - * Fetch the tag and length separately. - */ - tag_len = ber_fetch_tag(ptr, size, &tlv_tag); - switch(tag_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - tlv_constr = BER_TLV_CONSTRUCTED(ptr); - len_len = ber_fetch_length(tlv_constr, - (const char *)ptr + tag_len, size - tag_len, &tlv_len); - switch(len_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - ASN_DEBUG("Advancing %ld in ANY case", - (tag_len + len_len)); - ADVANCE(tag_len + len_len); - } else { - assert(tagno < td->tags_count); /* At least one loop */ - } - for((void)tagno; tagno < td->tags_count; tagno++, step++) { - - /* - * Fetch and process T from TLV. - */ - tag_len = ber_fetch_tag(ptr, size, &tlv_tag); - ASN_DEBUG("Fetching tag from {%p,%ld}: " - "len %ld, step %d, tagno %d got %s", - ptr, (long)size, - (long)tag_len, step, tagno, - ber_tlv_tag_string(tlv_tag)); - switch(tag_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - tlv_constr = BER_TLV_CONSTRUCTED(ptr); - - /* - * If {I}, don't check anything. - * If {I,B,C}, check B and C unless we're at I. - */ - if(tag_mode != 0 && step == 0) { + if (tag_mode == 0 && tagno == td->tags_count) + { /* - * We don't expect tag to match here. - * It's just because we don't know how the tag - * is supposed to look like. + * This must be the _untagged_ ANY type, + * which outermost tag isn't known in advance. + * Fetch the tag and length separately. */ - } else { - assert(tagno >= 0); /* Guaranteed by the code above */ - if(tlv_tag != td->tags[tagno]) { - /* - * Unexpected tag. Too bad. - */ - ASN_DEBUG("Expected: %s, " - "expectation failed (tn=%d, tm=%d)", - ber_tlv_tag_string(td->tags[tagno]), - tagno, tag_mode - ); + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + switch (tag_len) + { + case -1: RETURN(RC_FAIL); - } - } - - /* - * Attention: if there are more tags expected, - * ensure that the current tag is presented - * in constructed form (it contains other tags!). - * If this one is the last one, check that the tag form - * matches the one given in descriptor. - */ - if(tagno < (td->tags_count - 1)) { - if(tlv_constr == 0) { - ASN_DEBUG("tlv_constr = %d, expfail", - tlv_constr); - RETURN(RC_FAIL); - } - } else { - if(last_tag_form != tlv_constr - && last_tag_form != -1) { - ASN_DEBUG("last_tag_form %d != %d", - last_tag_form, tlv_constr); - RETURN(RC_FAIL); - } - } - - /* - * Fetch and process L from TLV. - */ - len_len = ber_fetch_length(tlv_constr, - (const char *)ptr + tag_len, size - tag_len, &tlv_len); - ASN_DEBUG("Fetchinig len = %ld", (long)len_len); - switch(len_len) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - } - - /* - * FIXME - * As of today, the chain of tags - * must either contain several indefinite length TLVs, - * or several definite length ones. - * No mixing is allowed. - */ - if(tlv_len == -1) { - /* - * Indefinite length. - */ - if(limit_len == -1) { - expect_00_terminators++; - } else { - ASN_DEBUG("Unexpected indefinite length " - "in a chain of definite lengths"); - RETURN(RC_FAIL); - } + case 0: + RETURN(RC_WMORE); + } + tlv_constr = BER_TLV_CONSTRUCTED(ptr); + len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, + size - tag_len, &tlv_len); + switch (len_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + ASN_DEBUG("Advancing %ld in ANY case", (tag_len + len_len)); ADVANCE(tag_len + len_len); - continue; - } else { - if(expect_00_terminators) { - ASN_DEBUG("Unexpected definite length " - "in a chain of indefinite lengths"); - RETURN(RC_FAIL); - } } - - /* - * Check that multiple TLVs specify ever decreasing length, - * which is consistent. - */ - if(limit_len == -1) { - limit_len = tlv_len + tag_len + len_len; - if(limit_len < 0) { - /* Too great tlv_len value? */ - RETURN(RC_FAIL); - } - } else if(limit_len != tlv_len + tag_len + len_len) { + else + { + assert(tagno < td->tags_count); /* At least one loop */ + } + for ((void)tagno; tagno < td->tags_count; tagno++, step++) + { /* - * Inner TLV specifies length which is inconsistent - * with the outer TLV's length value. + * Fetch and process T from TLV. */ - ASN_DEBUG("Outer TLV is %ld and inner is %ld", - (long)limit_len, (long)tlv_len); - RETURN(RC_FAIL); - } + tag_len = ber_fetch_tag(ptr, size, &tlv_tag); + ASN_DEBUG( + "Fetching tag from {%p,%ld}: " + "len %ld, step %d, tagno %d got %s", + ptr, (long)size, (long)tag_len, step, tagno, + ber_tlv_tag_string(tlv_tag)); + switch (tag_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } - ADVANCE(tag_len + len_len); + tlv_constr = BER_TLV_CONSTRUCTED(ptr); - limit_len -= (tag_len + len_len); - if((ssize_t)size > limit_len) { /* - * Make sure that we won't consume more bytes - * from the parent frame than the inferred limit. + * If {I}, don't check anything. + * If {I,B,C}, check B and C unless we're at I. */ - size = limit_len; - } - } + if (tag_mode != 0 && step == 0) + { + /* + * We don't expect tag to match here. + * It's just because we don't know how the tag + * is supposed to look like. + */ + } + else + { + assert(tagno >= 0); /* Guaranteed by the code above */ + if (tlv_tag != td->tags[tagno]) + { + /* + * Unexpected tag. Too bad. + */ + ASN_DEBUG( + "Expected: %s, " + "expectation failed (tn=%d, tm=%d)", + ber_tlv_tag_string(td->tags[tagno]), tagno, + tag_mode); + RETURN(RC_FAIL); + } + } - if(opt_tlv_form) - *opt_tlv_form = tlv_constr; - if(expect_00_terminators) + /* + * Attention: if there are more tags expected, + * ensure that the current tag is presented + * in constructed form (it contains other tags!). + * If this one is the last one, check that the tag form + * matches the one given in descriptor. + */ + if (tagno < (td->tags_count - 1)) + { + if (tlv_constr == 0) + { + ASN_DEBUG("tlv_constr = %d, expfail", tlv_constr); + RETURN(RC_FAIL); + } + } + else + { + if (last_tag_form != tlv_constr && last_tag_form != -1) + { + ASN_DEBUG("last_tag_form %d != %d", last_tag_form, + tlv_constr); + RETURN(RC_FAIL); + } + } + + /* + * Fetch and process L from TLV. + */ + len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, + size - tag_len, &tlv_len); + ASN_DEBUG("Fetchinig len = %ld", (long)len_len); + switch (len_len) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + } + + /* + * FIXME + * As of today, the chain of tags + * must either contain several indefinite length TLVs, + * or several definite length ones. + * No mixing is allowed. + */ + if (tlv_len == -1) + { + /* + * Indefinite length. + */ + if (limit_len == -1) + { + expect_00_terminators++; + } + else + { + ASN_DEBUG( + "Unexpected indefinite length " + "in a chain of definite lengths"); + RETURN(RC_FAIL); + } + ADVANCE(tag_len + len_len); + continue; + } + else + { + if (expect_00_terminators) + { + ASN_DEBUG( + "Unexpected definite length " + "in a chain of indefinite lengths"); + RETURN(RC_FAIL); + } + } + + /* + * Check that multiple TLVs specify ever decreasing length, + * which is consistent. + */ + if (limit_len == -1) + { + limit_len = tlv_len + tag_len + len_len; + if (limit_len < 0) + { + /* Too great tlv_len value? */ + RETURN(RC_FAIL); + } + } + else if (limit_len != tlv_len + tag_len + len_len) + { + /* + * Inner TLV specifies length which is inconsistent + * with the outer TLV's length value. + */ + ASN_DEBUG("Outer TLV is %ld and inner is %ld", + (long)limit_len, (long)tlv_len); + RETURN(RC_FAIL); + } + + ADVANCE(tag_len + len_len); + + limit_len -= (tag_len + len_len); + if ((ssize_t)size > limit_len) + { + /* + * Make sure that we won't consume more bytes + * from the parent frame than the inferred limit. + */ + size = limit_len; + } + } + + if (opt_tlv_form) *opt_tlv_form = tlv_constr; + if (expect_00_terminators) *last_length = -expect_00_terminators; else *last_length = tlv_len; diff --git a/src/core/libs/supl/asn-supl/ber_decoder.h b/src/core/libs/supl/asn-supl/ber_decoder.h index 629aff043..b142a9eed 100644 --- a/src/core/libs/supl/asn-supl/ber_decoder.h +++ b/src/core/libs/supl/asn-supl/ber_decoder.h @@ -16,37 +16,38 @@ extern "C" struct asn_codec_ctx_s; /* Forward declaration */ /* - * The BER decoder of any type. - * This function may be invoked directly from the application. - * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). - */ - asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, + * The BER decoder of any type. + * This function may be invoked directly from the application. + * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). + */ + asn_dec_rval_t ber_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, - void **struct_ptr, /* Pointer to a target structure's pointer */ - const void *ptr, /* Data to be decoded */ - size_t size /* Size of that buffer */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *ptr, /* Data to be decoded */ + size_t size /* Size of that buffer */ ); /* - * Type of generic function which decodes the byte stream into the structure. - */ + * Type of generic function which decodes the byte stream into the + * structure. + */ typedef asn_dec_rval_t(ber_type_decoder_f)( struct asn_codec_ctx_s *opt_codec_ctx, - struct asn_TYPE_descriptor_s *type_descriptor, - void **struct_ptr, const void *buf_ptr, size_t size, - int tag_mode); + struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, + const void *buf_ptr, size_t size, int tag_mode); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Check that all tags correspond to the type definition (as given in head). - * On return, last_length would contain either a non-negative length of the - * value part of the last TLV, or the negative number of expected - * "end of content" sequences. The number may only be negative if the - * head->last_tag_form is non-zero. - */ + * Check that all tags correspond to the type definition (as given in head). + * On return, last_length would contain either a non-negative length of the + * value part of the last TLV, or the negative number of expected + * "end of content" sequences. The number may only be negative if the + * head->last_tag_form is non-zero. + */ asn_dec_rval_t ber_check_tags( struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ struct asn_TYPE_descriptor_s *td, @@ -54,8 +55,7 @@ extern "C" const void *ptr, size_t size, int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ int last_tag_form, /* {-1,0:1}: any, primitive, constr */ - ber_tlv_len_t *last_length, - int *opt_tlv_form /* optional tag form */ + ber_tlv_len_t *last_length, int *opt_tlv_form /* optional tag form */ ); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/ber_tlv_length.c b/src/core/libs/supl/asn-supl/ber_tlv_length.c index fc1f9a169..9d6e2998d 100644 --- a/src/core/libs/supl/asn-supl/ber_tlv_length.c +++ b/src/core/libs/supl/asn-supl/ber_tlv_length.c @@ -6,172 +6,176 @@ #include #include -ssize_t -ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, - ber_tlv_len_t *len_r) { +ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, + ber_tlv_len_t *len_r) +{ const uint8_t *buf = (const uint8_t *)bufptr; unsigned oct; - if(size == 0) - return 0; /* Want more */ + if (size == 0) return 0; /* Want more */ oct = *buf; - if((oct & 0x80) == 0) { - /* - * Short definite length. - */ - *len_r = oct; /* & 0x7F */ - return 1; - } else { - ber_tlv_len_t len; - size_t skipped; - - if(_is_constructed && oct == 0x80) { - *len_r = -1; /* Indefinite length */ + if ((oct & 0x80) == 0) + { + /* + * Short definite length. + */ + *len_r = oct; /* & 0x7F */ return 1; } + else + { + ber_tlv_len_t len; + size_t skipped; - if(oct == 0xff) { - /* Reserved in standard for future use. */ - return -1; + if (_is_constructed && oct == 0x80) + { + *len_r = -1; /* Indefinite length */ + return 1; + } + + if (oct == 0xff) + { + /* Reserved in standard for future use. */ + return -1; + } + + oct &= 0x7F; /* Leave only the 7 LS bits */ + for (len = 0, buf++, skipped = 1; oct && (++skipped <= size); + buf++, oct--) + { + len = (len << 8) | *buf; + if (len < 0 || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) + { + /* + * Too large length value. + */ + return -1; + } + } + + if (oct == 0) + { + ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; + /* + * Here length may be very close or equal to 2G. + * However, the arithmetics used in some decoders + * may add some (small) quantities to the length, + * to check the resulting value against some limits. + * This may result in integer wrap-around, which + * we try to avoid by checking it earlier here. + */ + if (lenplusepsilon < 0) + { + /* Too large length value */ + return -1; + } + + *len_r = len; + return skipped; + } + + return 0; /* Want more */ } - - oct &= 0x7F; /* Leave only the 7 LS bits */ - for(len = 0, buf++, skipped = 1; - oct && (++skipped <= size); buf++, oct--) { - - len = (len << 8) | *buf; - if(len < 0 - || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { - /* - * Too large length value. - */ - return -1; - } - } - - if(oct == 0) { - ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; - /* - * Here length may be very close or equal to 2G. - * However, the arithmetics used in some decoders - * may add some (small) quantities to the length, - * to check the resulting value against some limits. - * This may result in integer wrap-around, which - * we try to avoid by checking it earlier here. - */ - if(lenplusepsilon < 0) { - /* Too large length value */ - return -1; - } - - *len_r = len; - return skipped; - } - - return 0; /* Want more */ - } - } -ssize_t -ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, - int _is_constructed, const void *ptr, size_t size) { - ber_tlv_len_t vlen; /* Length of V in TLV */ - ssize_t tl; /* Length of L in TLV */ - ssize_t ll; /* Length of L in TLV */ +ssize_t ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, int _is_constructed, + const void *ptr, size_t size) +{ + ber_tlv_len_t vlen; /* Length of V in TLV */ + ssize_t tl; /* Length of L in TLV */ + ssize_t ll; /* Length of L in TLV */ size_t skip; /* * Make sure we didn't exceed the maximum stack size. */ - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - return -1; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) return -1; /* * Determine the size of L in TLV. */ ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); - if(ll <= 0) return ll; + if (ll <= 0) return ll; /* * Definite length. */ - if(vlen >= 0) { - skip = ll + vlen; - if(skip > size) - return 0; /* Want more */ - return skip; - } + if (vlen >= 0) + { + skip = ll + vlen; + if (skip > size) return 0; /* Want more */ + return skip; + } /* * Indefinite length! */ ASN_DEBUG("Skipping indefinite length"); - for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { - ber_tlv_tag_t tag; + for (skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) + { + ber_tlv_tag_t tag; - /* Fetch the tag */ - tl = ber_fetch_tag(ptr, size, &tag); - if(tl <= 0) return tl; + /* Fetch the tag */ + tl = ber_fetch_tag(ptr, size, &tag); + if (tl <= 0) return tl; - ll = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - ((const char *)ptr) + tl, size - tl); - if(ll <= 0) return ll; + ll = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), + ((const char *)ptr) + tl, size - tl); + if (ll <= 0) return ll; - skip += tl + ll; + skip += tl + ll; - /* - * This may be the end of the indefinite length structure, - * two consecutive 0 octets. - * Check if it is true. - */ - if(((const uint8_t *)ptr)[0] == 0 - && ((const uint8_t *)ptr)[1] == 0) - return skip; + /* + * This may be the end of the indefinite length structure, + * two consecutive 0 octets. + * Check if it is true. + */ + if (((const uint8_t *)ptr)[0] == 0 && + ((const uint8_t *)ptr)[1] == 0) + return skip; - ptr = ((const char *)ptr) + tl + ll; - size -= tl + ll; - } + ptr = ((const char *)ptr) + tl + ll; + size -= tl + ll; + } /* UNREACHABLE */ } -size_t -der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { - size_t required_size; /* Size of len encoding */ +size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) +{ + size_t required_size; /* Size of len encoding */ uint8_t *buf = (uint8_t *)bufp; uint8_t *end; size_t i; - if(len <= 127) { - /* Encoded in 1 octet */ - if(size) *buf = (uint8_t)len; - return 1; - } + if (len <= 127) + { + /* Encoded in 1 octet */ + if (size) *buf = (uint8_t)len; + return 1; + } /* * Compute the size of the subsequent bytes. */ - for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { - if(len >> i) - required_size++; - else - break; - } + for (required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) + { + if (len >> i) + required_size++; + else + break; + } - if(size <= required_size) - return required_size + 1; + if (size <= required_size) return required_size + 1; - *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ + *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ /* * Produce the len encoding, space permitting. */ end = buf + required_size; - for(i -= 8; buf < end; i -= 8, buf++) - *buf = (uint8_t)(len >> i); + for (i -= 8; buf < end; i -= 8, buf++) *buf = (uint8_t)(len >> i); return required_size + 1; } diff --git a/src/core/libs/supl/asn-supl/ber_tlv_length.h b/src/core/libs/supl/asn-supl/ber_tlv_length.h index b681ff323..9daae27af 100644 --- a/src/core/libs/supl/asn-supl/ber_tlv_length.h +++ b/src/core/libs/supl/asn-supl/ber_tlv_length.h @@ -13,36 +13,37 @@ extern "C" typedef ssize_t ber_tlv_len_t; /* - * This function tries to fetch the length of the BER TLV value and place it - * in *len_r. - * RETURN VALUES: - * 0: More data expected than bufptr contains. - * -1: Fatal error deciphering length. - * >0: Number of bytes used from bufptr. - * On return with >0, len_r is constrained as -1..MAX, where -1 mean - * that the value is of indefinite length. - */ - ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, - ber_tlv_len_t *len_r); + * This function tries to fetch the length of the BER TLV value and place it + * in *len_r. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering length. + * >0: Number of bytes used from bufptr. + * On return with >0, len_r is constrained as -1..MAX, where -1 mean + * that the value is of indefinite length. + */ + ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, + size_t size, ber_tlv_len_t *len_r); /* - * This function expects bufptr to be positioned over L in TLV. - * It returns number of bytes occupied by L and V together, suitable - * for skipping. The function properly handles indefinite length. - * RETURN VALUES: - * Standard {-1,0,>0} convention. - */ + * This function expects bufptr to be positioned over L in TLV. + * It returns number of bytes occupied by L and V together, suitable + * for skipping. The function properly handles indefinite length. + * RETURN VALUES: + * Standard {-1,0,>0} convention. + */ ssize_t ber_skip_length( struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ int _is_constructed, const void *bufptr, size_t size); /* - * This function serializes the length (L from TLV) in DER format. - * It always returns number of bytes necessary to represent the length, - * it is a caller's responsibility to check the return value - * against the supplied buffer's size. - */ - size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); + * This function serializes the length (L from TLV) in DER format. + * It always returns number of bytes necessary to represent the length, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ + size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, + size_t size); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/ber_tlv_tag.c b/src/core/libs/supl/asn-supl/ber_tlv_tag.c index 9c587df34..2de303992 100644 --- a/src/core/libs/supl/asn-supl/ber_tlv_tag.c +++ b/src/core/libs/supl/asn-supl/ber_tlv_tag.c @@ -6,92 +6,105 @@ #include #include -ssize_t -ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { +ssize_t ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) +{ ber_tlv_tag_t val; ber_tlv_tag_t tclass; size_t skipped; - if(size == 0) - return 0; + if (size == 0) return 0; val = *(const uint8_t *)ptr; tclass = (val >> 6); - if((val &= 0x1F) != 0x1F) { - /* - * Simple form: everything encoded in a single octet. - * Tag Class is encoded using two least significant bits. - */ - *tag_r = (val << 2) | tclass; - return 1; - } + if ((val &= 0x1F) != 0x1F) + { + /* + * Simple form: everything encoded in a single octet. + * Tag Class is encoded using two least significant bits. + */ + *tag_r = (val << 2) | tclass; + return 1; + } /* * Each octet contains 7 bits of useful information. * The MSB is 0 if it is the last octet of the tag. */ - for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; - skipped <= size; - ptr = ((const char *)ptr) + 1, skipped++) { - unsigned int oct = *(const uint8_t *)ptr; - if(oct & 0x80) { - val = (val << 7) | (oct & 0x7F); - /* - * Make sure there are at least 9 bits spare - * at the MS side of a value. - */ - if(val >> ((8 * sizeof(val)) - 9)) { - /* - * We would not be able to accommodate - * any more tag bits. - */ - return -1; - } - } else { - val = (val << 7) | oct; - *tag_r = (val << 2) | tclass; - return skipped; + for (val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; skipped <= size; + ptr = ((const char *)ptr) + 1, skipped++) + { + unsigned int oct = *(const uint8_t *)ptr; + if (oct & 0x80) + { + val = (val << 7) | (oct & 0x7F); + /* + * Make sure there are at least 9 bits spare + * at the MS side of a value. + */ + if (val >> ((8 * sizeof(val)) - 9)) + { + /* + * We would not be able to accommodate + * any more tag bits. + */ + return -1; + } + } + else + { + val = (val << 7) | oct; + *tag_r = (val << 2) | tclass; + return skipped; + } } - } - return 0; /* Want more */ + return 0; /* Want more */ } - -ssize_t -ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { +ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) +{ char buf[sizeof("[APPLICATION ]") + 32]; ssize_t ret; ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); - if(ret >= (ssize_t)sizeof(buf) || ret < 2) { - errno = EPERM; - return -1; - } + if (ret >= (ssize_t)sizeof(buf) || ret < 2) + { + errno = EPERM; + return -1; + } return fwrite(buf, 1, ret, f); } -ssize_t -ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { +ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) +{ char *type = 0; int ret; - switch(tag & 0x3) { - case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; - case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; - case ASN_TAG_CLASS_CONTEXT: type = ""; break; - case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; - } + switch (tag & 0x3) + { + case ASN_TAG_CLASS_UNIVERSAL: + type = "UNIVERSAL "; + break; + case ASN_TAG_CLASS_APPLICATION: + type = "APPLICATION "; + break; + case ASN_TAG_CLASS_CONTEXT: + type = ""; + break; + case ASN_TAG_CLASS_PRIVATE: + type = "PRIVATE "; + break; + } ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); - if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ + if (ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ return ret; } -char * -ber_tlv_tag_string(ber_tlv_tag_t tag) { +char *ber_tlv_tag_string(ber_tlv_tag_t tag) +{ static char buf[sizeof("[APPLICATION ]") + 32]; (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); @@ -99,9 +112,8 @@ ber_tlv_tag_string(ber_tlv_tag_t tag) { return buf; } - -size_t -ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { +size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) +{ int tclass = BER_TAG_CLASS(tag); ber_tlv_tag_t tval = BER_TAG_VALUE(tag); uint8_t *buf = (uint8_t *)bufp; @@ -109,35 +121,37 @@ ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { size_t required_size; size_t i; - if(tval <= 30) { - /* Encoded in 1 octet */ - if(size) buf[0] = (tclass << 6) | tval; - return 1; - } else if(size) { - *buf++ = (tclass << 6) | 0x1F; - size--; - } + if (tval <= 30) + { + /* Encoded in 1 octet */ + if (size) buf[0] = (tclass << 6) | tval; + return 1; + } + else if (size) + { + *buf++ = (tclass << 6) | 0x1F; + size--; + } /* * Compute the size of the subsequent bytes. */ - for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { - if(tval >> i) - required_size++; - else - break; - } + for (required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) + { + if (tval >> i) + required_size++; + else + break; + } - if(size < required_size) - return required_size + 1; + if (size < required_size) return required_size + 1; /* * Fill in the buffer, space permitting. */ end = buf + required_size - 1; - for(i -= 7; buf < end; i -= 7, buf++) - *buf = 0x80 | ((tval >> i) & 0x7F); - *buf = (tval & 0x7F); /* Last octet without high bit */ + for (i -= 7; buf < end; i -= 7, buf++) *buf = 0x80 | ((tval >> i) & 0x7F); + *buf = (tval & 0x7F); /* Last octet without high bit */ return required_size + 1; } diff --git a/src/core/libs/supl/asn-supl/ber_tlv_tag.h b/src/core/libs/supl/asn-supl/ber_tlv_tag.h index 141815834..68e03689b 100644 --- a/src/core/libs/supl/asn-supl/ber_tlv_tag.h +++ b/src/core/libs/supl/asn-supl/ber_tlv_tag.h @@ -24,35 +24,36 @@ extern "C" */ #define BER_TAG_CLASS(tag) ((tag)&0x3) #define BER_TAG_VALUE(tag) ((tag) >> 2) -#define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr) & 0x20) ? 1 : 0) +#define BER_TLV_CONSTRUCTED(tagptr) \ + (((*(const uint8_t *)tagptr) & 0x20) ? 1 : 0) #define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) /* - * Several functions for printing the TAG in the canonical form - * (i.e. "[PRIVATE 0]"). - * Return values correspond to their libc counterparts (if any). - */ + * Several functions for printing the TAG in the canonical form + * (i.e. "[PRIVATE 0]"). + * Return values correspond to their libc counterparts (if any). + */ ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size); ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE * /*f*/); char *ber_tlv_tag_string(ber_tlv_tag_t tag); + /* + * This function tries to fetch the tag from the input stream. + * RETURN VALUES: + * 0: More data expected than bufptr contains. + * -1: Fatal error deciphering tag. + * >0: Number of bytes used from bufptr. tag_r will contain the tag. + */ + ssize_t ber_fetch_tag(const void *bufptr, size_t size, + ber_tlv_tag_t *tag_r); /* - * This function tries to fetch the tag from the input stream. - * RETURN VALUES: - * 0: More data expected than bufptr contains. - * -1: Fatal error deciphering tag. - * >0: Number of bytes used from bufptr. tag_r will contain the tag. - */ - ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); - - /* - * This function serializes the tag (T from TLV) in BER format. - * It always returns number of bytes necessary to represent the tag, - * it is a caller's responsibility to check the return value - * against the supplied buffer's size. - */ + * This function serializes the tag (T from TLV) in BER format. + * It always returns number of bytes necessary to represent the tag, + * it is a caller's responsibility to check the return value + * against the supplied buffer's size. + */ size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.c b/src/core/libs/supl/asn-supl/constr_CHOICE.c index 82d4db700..62682ab72 100644 --- a/src/core/libs/supl/asn-supl/constr_CHOICE.c +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,81 +25,96 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) +#undef NEXT_PHASE +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * See the definitions. */ -static int _fetch_present_idx(const void *struct_ptr, int pres_offset, int size); +static int _fetch_present_idx(const void *struct_ptr, int pres_offset, + int size); static void _set_present_idx(void *struct_ptr, int offset, int size, int pres); /* * Tags are canonically sorted in the tag to member table. */ -static int -_search4tag(const void *ap, const void *bp) { +static int _search4tag(const void *ap, const void *bp) +{ const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); - if(a_class == b_class) { - ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); - ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + if (a_class == b_class) + { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); - if(a_value == b_value) - return 0; - else if(a_value < b_value) + if (a_value == b_value) + return 0; + else if (a_value < b_value) + return -1; + else + return 1; + } + else if (a_class < b_class) + { return -1; - else + } + else + { return 1; - } else if(a_class < b_class) { - return -1; - } else { - return 1; - } + } } /* * The decoder of the CHOICE type. */ -asn_dec_rval_t -CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ @@ -109,26 +124,28 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - ssize_t tag_len; /* Length of TLV's T */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + ssize_t tag_len; /* Length of TLV's T */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as CHOICE", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -138,415 +155,487 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - if(tag_mode || td->tags_count) { - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, -1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) { - /* ?Subtracted below! */ - ctx->left += rval.consumed; - } - ADVANCE(rval.consumed); - } else { - ctx->left = -1; - } - - NEXT_PHASE(ctx); - - ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", - (long)ctx->left, (long)size); - - /* Fall through */ - case 1: - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - do { - asn_TYPE_tag2member_t *t2m; - asn_TYPE_tag2member_t key; - - key.el_tag = tlv_tag; - t2m = (asn_TYPE_tag2member_t *)bsearch(&key, - specs->tag2el, specs->tag2el_count, - sizeof(specs->tag2el[0]), _search4tag); - if(t2m) { + switch (ctx->phase) + { + case 0: /* - * Found the element corresponding to the tag. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ + + if (tag_mode || td->tags_count) + { + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, -1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", + td->name, rval.code); + return rval; + } + + if (ctx->left >= 0) + { + /* ?Subtracted below! */ + ctx->left += rval.consumed; + } + ADVANCE(rval.consumed); + } + else + { + ctx->left = -1; + } + NEXT_PHASE(ctx); - ctx->step = t2m->el_no; - break; - } else if(specs->ext_start == -1) { - ASN_DEBUG("Unexpected tag %s " - "in non-extensible CHOICE %s", - ber_tlv_tag_string(tlv_tag), td->name); - RETURN(RC_FAIL); - } else { - /* Skip this tag */ - ssize_t skip; - ASN_DEBUG("Skipping unknown tag %s", - ber_tlv_tag_string(tlv_tag)); + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); - skip = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tag_len, - LEFT - tag_len); - - switch(skip) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - ADVANCE(skip + tag_len); - RETURN(RC_OK); - } - } while(0); - - case 2: - /* - * PHASE 2. - * Read in the element. - */ - do { - asn_TYPE_member_t *elm;/* CHOICE's element */ - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - - elm = &elements[ctx->step]; - - /* - * Compute the position of the member inside a structure, - * and also a type of containment (it may be contained - * as pointer or using inline inclusion). - */ - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - /* - * A pointer to a pointer - * holding the start of the structure - */ - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - /* Set presence to be able to free it properly at any time */ - _set_present_idx(st, specs->pres_offset, - specs->pres_size, ctx->step + 1); - /* - * Invoke the member fetch routine according to member's type - */ - rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, - memb_ptr2, ptr, LEFT, elm->tag_mode); - switch(rval.code) { - case RC_OK: - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { - ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - RETURN(RC_FAIL); - case RC_FAIL: /* Fatal error */ - RETURN(rval.code); - } /* switch(rval) */ - - ADVANCE(rval.consumed); - } while(0); - - NEXT_PHASE(ctx); - - /* Fall through */ - case 3: - ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", - td->name, (long)ctx->left, (long)size, - tag_mode, td->tags_count); - - if(ctx->left > 0) { - /* - * The type must be fully decoded - * by the CHOICE member-specific decoder. - */ - RETURN(RC_FAIL); - } - - if(ctx->left == -1 - && !(tag_mode || td->tags_count)) { - /* - * This is an untagged CHOICE. - * It doesn't contain nothing - * except for the member itself, including all its tags. - * The decoding is completed. - */ - NEXT_PHASE(ctx); - break; - } - - /* - * Read in the "end of data chunks"'s. - */ - while(ctx->left < 0) { - ssize_t tl; - - tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tl) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ - case -1: RETURN(RC_FAIL); - } + case 1: + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } - /* - * Expected <0><0>... - */ - if(((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) + do + { + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + + key.el_tag = tlv_tag; + t2m = (asn_TYPE_tag2member_t *)bsearch( + &key, specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _search4tag); + if (t2m) + { + /* + * Found the element corresponding to the tag. + */ + NEXT_PHASE(ctx); + ctx->step = t2m->el_no; + break; + } + else if (specs->ext_start == -1) + { + ASN_DEBUG( + "Unexpected tag %s " + "in non-extensible CHOICE %s", + ber_tlv_tag_string(tlv_tag), td->name); + RETURN(RC_FAIL); + } + else + { + /* Skip this tag */ + ssize_t skip; + + ASN_DEBUG("Skipping unknown tag %s", + ber_tlv_tag_string(tlv_tag)); + + skip = ber_skip_length( + opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + + switch (skip) + { + case 0: + if (!SIZE_VIOLATION) + RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + RETURN(RC_OK); + } + } + while (0); + + case 2: + /* + * PHASE 2. + * Read in the element. + */ + do + { + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + elm = &elements[ctx->step]; + + /* + * Compute the position of the member inside a + * structure, and also a type of containment (it may be + * contained as pointer or using inline inclusion). + */ + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + /* Set presence to be able to free it properly at any + * time */ + _set_present_idx(st, specs->pres_offset, + specs->pres_size, ctx->step + 1); + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + memb_ptr2, ptr, LEFT, + elm->tag_mode); + switch (rval.code) + { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + RETURN(RC_FAIL); + case RC_FAIL: /* Fatal error */ + RETURN(rval.code); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } + while (0); + + NEXT_PHASE(ctx); + + /* Fall through */ + case 3: + ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", + td->name, (long)ctx->left, (long)size, tag_mode, + td->tags_count); + + if (ctx->left > 0) + { + /* + * The type must be fully decoded + * by the CHOICE member-specific decoder. + */ RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - /* - * Correctly finished with <0><0>. - */ - ADVANCE(2); - ctx->left++; - continue; - } - } else { - ASN_DEBUG("Unexpected continuation in %s", - td->name); - RETURN(RC_FAIL); - } + } - /* UNREACHABLE */ + if (ctx->left == -1 && !(tag_mode || td->tags_count)) + { + /* + * This is an untagged CHOICE. + * It doesn't contain nothing + * except for the member itself, including all its tags. + * The decoding is completed. + */ + NEXT_PHASE(ctx); + break; + } + + /* + * Read in the "end of data chunks"'s. + */ + while (ctx->left < 0) + { + ssize_t tl; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tl) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + /* + * Expected <0><0>... + */ + if (((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + continue; + } + } + else + { + ASN_DEBUG("Unexpected continuation in %s", + td->name); + RETURN(RC_FAIL); + } + + /* UNREACHABLE */ + } + + NEXT_PHASE(ctx); + case 4: + /* No meaningful work here */ + break; } - NEXT_PHASE(ctx); - case 4: - /* No meaningful work here */ - break; - } - RETURN(RC_OK); } -asn_enc_rval_t -CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; - asn_TYPE_member_t *elm; /* CHOICE element */ + asn_TYPE_member_t *elm; /* CHOICE element */ asn_enc_rval_t erval; void *memb_ptr; size_t computed_size = 0; int present; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; - ASN_DEBUG("%s %s as CHOICE", - cb?"Encoding":"Estimating", td->name); + ASN_DEBUG("%s %s as CHOICE", cb ? "Encoding" : "Estimating", td->name); - present = _fetch_present_idx(sptr, - specs->pres_offset, specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized, it cannot be encoded: * can't deduce what to encode in the choice type. */ - if(present <= 0 || present > td->elements_count) { - if(present == 0 && td->elements_count == 0) { - /* The CHOICE is empty?! */ - erval.encoded = 0; - _ASN_ENCODED_OK(erval); + if (present <= 0 || present > td->elements_count) + { + if (present == 0 && td->elements_count == 0) + { + /* The CHOICE is empty?! */ + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + _ASN_ENCODE_FAILED; } - _ASN_ENCODE_FAILED; - } /* * Seek over the present member of the structure. */ - elm = &td->elements[present-1]; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(memb_ptr == 0) { - if(elm->optional) { - erval.encoded = 0; - _ASN_ENCODED_OK(erval); - } - /* Mandatory element absent */ - _ASN_ENCODE_FAILED; + elm = &td->elements[present - 1]; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (memb_ptr == 0) + { + if (elm->optional) + { + erval.encoded = 0; + _ASN_ENCODED_OK(erval); + } + /* Mandatory element absent */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - } /* * If the CHOICE itself is tagged EXPLICIT: * T ::= [2] EXPLICIT CHOICE { ... } * Then emit the appropriate tags. */ - if(tag_mode == 1 || td->tags_count) { - /* - * For this, we need to pre-compute the member. - */ - ssize_t ret; + if (tag_mode == 1 || td->tags_count) + { + /* + * For this, we need to pre-compute the member. + */ + ssize_t ret; - /* Encode member with its tag */ - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, 0, 0); - if(erval.encoded == -1) - return erval; + /* Encode member with its tag */ + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, + elm->tag, 0, 0); + if (erval.encoded == -1) return erval; - /* Encode CHOICE with parent or my own tag */ - ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, - cb, app_key); - if(ret == -1) - _ASN_ENCODE_FAILED; - computed_size += ret; - } + /* Encode CHOICE with parent or my own tag */ + ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, cb, + app_key); + if (ret == -1) _ASN_ENCODE_FAILED; + computed_size += ret; + } /* * Encode the single underlying member. */ - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, cb, app_key); - if(erval.encoded == -1) - return erval; + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, + cb, app_key); + if (erval.encoded == -1) return erval; - ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", - (long)erval.encoded, (long)computed_size); + ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", (long)erval.encoded, + (long)computed_size); erval.encoded += computed_size; return erval; } -ber_tlv_tag_t -CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { +ber_tlv_tag_t CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, + int tag_mode, ber_tlv_tag_t tag) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - assert(tag_mode == 0); (void)tag_mode; - assert(tag == 0); (void)tag; + assert(tag_mode == 0); + (void)tag_mode; + assert(tag == 0); + (void)tag; /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); - if(present > 0 || present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + if (present > 0 || present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *) - ((const char *)ptr + elm->memb_offset); - } else { - memb_ptr = (const void *) - ((const char *)ptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)ptr + + elm->memb_offset); + } + else + { + memb_ptr = + (const void *)((const char *)ptr + elm->memb_offset); + } + + return asn_TYPE_outmost_tag(elm->type, memb_ptr, elm->tag_mode, + elm->tag); + } + else + { + return (ber_tlv_tag_t)-1; } - - return asn_TYPE_outmost_tag(elm->type, memb_ptr, - elm->tag_mode, elm->tag); - } else { - return (ber_tlv_tag_t)-1; - } } -int -CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - return 0; - _ASN_CTFAIL(app_key, td, sptr, - "%s: mandatory CHOICE element %s absent (%s:%d)", - td->name, elm->name, __FILE__, __LINE__); - return -1; - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); - } + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) return 0; + _ASN_CTFAIL(app_key, td, sptr, + "%s: mandatory CHOICE element %s " + "absent (%s:%d)", + td->name, elm->name, __FILE__, + __LINE__); + return -1; + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } - if(elm->memb_constraints) { - return elm->memb_constraints(elm->type, memb_ptr, - ctfailcb, app_key); - } else { - int ret = elm->type->check_constraints(elm->type, - memb_ptr, ctfailcb, app_key); - /* - * Cannot inherit it eralier: - * need to make sure we get the updated version. - */ - elm->memb_constraints = elm->type->check_constraints; - return ret; + if (elm->memb_constraints) + { + return elm->memb_constraints(elm->type, memb_ptr, ctfailcb, + app_key); + } + else + { + int ret = elm->type->check_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + /* + * Cannot inherit it eralier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + return ret; + } + } + else + { + _ASN_CTFAIL(app_key, td, sptr, + "%s: no CHOICE element given (%s:%d)", td->name, + __FILE__, __LINE__); + return -1; } - } else { - _ASN_CTFAIL(app_key, td, sptr, - "%s: no CHOICE element given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } } -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ @@ -556,27 +645,28 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value of a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* Element index */ + asn_dec_rval_t rval; /* Return value of a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - if(ctx->phase == 0 && !*xml_tag) - ctx->phase = 1; /* Skip the outer tag checking phase */ + if (ctx->phase == 0 && !*xml_tag) + ctx->phase = 1; /* Skip the outer tag checking phase */ /* * Phases of XER/XML processing: @@ -587,453 +677,502 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 4: Skipping unknown extensions. * Phase 5: PHASED OUT */ - for(edx = ctx->step; ctx->phase <= 4;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ - asn_TYPE_member_t *elm; - - /* - * Go inside the member. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - - elm = &td->elements[edx]; - - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - - /* Start/Continue decoding the inner member */ - tmprval = elm->type->xer_decoder(opt_codec_ctx, - elm->type, memb_ptr2, elm->name, - buf_ptr, size); - XER_ADVANCE(tmprval.consumed); - ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", - elm->type->name, tmprval.code); - if(tmprval.code != RC_OK) - RETURN(tmprval.code); - assert(_fetch_present_idx(st, - specs->pres_offset, specs->pres_size) == 0); - /* Record what we've got */ - _set_present_idx(st, - specs->pres_offset, specs->pres_size, edx + 1); - ctx->phase = 3; - /* Fall through */ - } - - /* No need to wait for closing tag; special mode. */ - if(ctx->phase == 3 && !*xml_tag) { - ctx->phase = 5; /* Phase out */ - RETURN(RC_OK); - } - - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", - ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', - ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', - ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', - ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', - xml_tag, tcv); - - /* Skip the extensions section */ - if(ctx->phase == 4) { - ASN_DEBUG("skip_unknown(%d, %ld)", - tcv, (long)ctx->left); - switch(xer_skip_unknown(tcv, &ctx->left)) { - case -1: - ctx->phase = 5; - RETURN(RC_FAIL); - continue; - case 1: - ctx->phase = 3; - /* Fall through */ - case 0: - XER_ADVANCE(ch_size); - continue; - case 2: - ctx->phase = 3; - break; - } - } - - switch(tcv) { - case XCT_BOTH: - break; /* No CHOICE? */ - case XCT_CLOSING: - if(ctx->phase != 3) - break; - XER_ADVANCE(ch_size); - ctx->phase = 5; /* Phase out */ - RETURN(RC_OK); - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - - if(ctx->phase != 1) - break; /* Really unexpected */ + for (edx = ctx->step; ctx->phase <= 4;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; /* - * Search which inner member corresponds to this tag. + * Go inside the member. */ - for(edx = 0; edx < td->elements_count; edx++) { - elm = &td->elements[edx]; - tcv = xer_check_tag(buf_ptr,ch_size,elm->name); - switch(tcv) { - case XCT_BOTH: - case XCT_OPENING: - /* - * Process this member. - */ - ctx->step = edx; - ctx->phase = 2; - break; - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - continue; - default: - edx = td->elements_count; - break; /* Phase out */ - } - break; - } - if(edx != td->elements_count) - continue; + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - /* It is expected extension */ - if(specs->ext_start != -1) { - ASN_DEBUG("Got anticipated extension"); - /* - * Check for (XCT_BOTH or XCT_UNKNOWN_BO) - * By using a mask. Only record a pure - * tags. - */ - if(tcv & XCT_CLOSING) { - /* Found without body */ - ctx->phase = 3; /* Terminating */ - } else { - ctx->left = 1; - ctx->phase = 4; /* Skip ...'s */ - } - XER_ADVANCE(ch_size); - continue; - } + elm = &td->elements[edx]; - /* Fall through */ - default: + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Start/Continue decoding the inner member */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, + memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", elm->type->name, + tmprval.code); + if (tmprval.code != RC_OK) RETURN(tmprval.code); + assert(_fetch_present_idx(st, specs->pres_offset, + specs->pres_size) == 0); + /* Record what we've got */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, + edx + 1); + ctx->phase = 3; + /* Fall through */ + } + + /* No need to wait for closing tag; special mode. */ + if (ctx->phase == 3 && !*xml_tag) + { + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + } + + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", + ch_size > 0 ? ((const uint8_t *)buf_ptr)[0] : '?', + ch_size > 1 ? ((const uint8_t *)buf_ptr)[1] : '?', + ch_size > 2 ? ((const uint8_t *)buf_ptr)[2] : '?', + ch_size > 3 ? ((const uint8_t *)buf_ptr)[3] : '?', + xml_tag, tcv); + + /* Skip the extensions section */ + if (ctx->phase == 4) + { + ASN_DEBUG("skip_unknown(%d, %ld)", tcv, (long)ctx->left); + switch (xer_skip_unknown(tcv, &ctx->left)) + { + case -1: + ctx->phase = 5; + RETURN(RC_FAIL); + continue; + case 1: + ctx->phase = 3; + /* Fall through */ + case 0: + XER_ADVANCE(ch_size); + continue; + case 2: + ctx->phase = 3; + break; + } + } + + switch (tcv) + { + case XCT_BOTH: + break; /* No CHOICE? */ + case XCT_CLOSING: + if (ctx->phase != 3) break; + XER_ADVANCE(ch_size); + ctx->phase = 5; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + + if (ctx->phase != 1) break; /* Really unexpected */ + + /* + * Search which inner member corresponds to this tag. + */ + for (edx = 0; edx < td->elements_count; edx++) + { + elm = &td->elements[edx]; + tcv = + xer_check_tag(buf_ptr, ch_size, elm->name); + switch (tcv) + { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + edx = td->elements_count; + break; /* Phase out */ + } + break; + } + if (edx != td->elements_count) continue; + + /* It is expected extension */ + if (specs->ext_start != -1) + { + ASN_DEBUG("Got anticipated extension"); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if (tcv & XCT_CLOSING) + { + /* Found without body */ + ctx->phase = 3; /* Terminating */ + } + else + { + ctx->left = 1; + ctx->phase = 4; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ + default: + break; + } + + ASN_DEBUG( + "Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" + " (ph=%d, tag=%s)", + ch_size > 0 ? ((const uint8_t *)buf_ptr)[0] : '?', + ch_size > 1 ? ((const uint8_t *)buf_ptr)[1] : '?', + ch_size > 2 ? ((const uint8_t *)buf_ptr)[2] : '?', + ch_size > 3 ? ((const uint8_t *)buf_ptr)[3] : '?', td->name, + ctx->phase, xml_tag); break; } - ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" - " (ph=%d, tag=%s)", - ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', - ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', - ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', - ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', - td->name, ctx->phase, xml_tag); - break; - } - - ctx->phase = 5; /* Phase out, just in case */ + ctx->phase = 5; /* Phase out, just in case */ RETURN(RC_FAIL); } - -asn_enc_rval_t -CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { - asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; +asn_enc_rval_t CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_enc_rval_t er; int present; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); - if(present <= 0 || present > td->elements_count) { - _ASN_ENCODE_FAILED; - } else { - asn_enc_rval_t tmper; - asn_TYPE_member_t *elm = &td->elements[present-1]; - void *memb_ptr; - const char *mname = elm->name; - unsigned int mlen = strlen(mname); + if (present <= 0 || present > td->elements_count) + { + _ASN_ENCODE_FAILED; + } + else + { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[present - 1]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) _ASN_ENCODE_FAILED; - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) _ASN_ENCODE_FAILED; + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + er.encoded = 0; + + if (!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + + er.encoded += 5 + (2 * mlen) + tmper.encoded; } - er.encoded = 0; - - if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - - _ASN_CALLBACK3("", 1); - - er.encoded += 5 + (2 * mlen) + tmper.encoded; - } - - if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -asn_dec_rval_t -CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_dec_rval_t rv; asn_per_constraint_t *ct; - asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_TYPE_member_t *elm; /* CHOICE's element */ void *memb_ptr; void **memb_ptr2; void *st = *sptr; int value; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; /* * Create the target structure if it is not present already. */ - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else ct = 0; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + ct = 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - value = per_get_few_bits(pd, 1); - if(value < 0) _ASN_DECODE_STARVED; - if(value) ct = 0; /* Not restricted */ - } + if (ct && ct->flags & APC_EXTENSIBLE) + { + value = per_get_few_bits(pd, 1); + if (value < 0) _ASN_DECODE_STARVED; + if (value) ct = 0; /* Not restricted */ + } - if(ct && ct->range_bits >= 0) { - value = per_get_few_bits(pd, ct->range_bits); - if(value < 0) _ASN_DECODE_STARVED; - ASN_DEBUG("CHOICE %s got index %d in range %d", - td->name, value, ct->range_bits); - if(value > ct->upper_bound) - _ASN_DECODE_FAILED; - } else { - if(specs->ext_start == -1) - _ASN_DECODE_FAILED; - value = uper_get_nsnnwn(pd); - if(value < 0) _ASN_DECODE_STARVED; - value += specs->ext_start; - if(value >= td->elements_count) - _ASN_DECODE_FAILED; - } + if (ct && ct->range_bits >= 0) + { + value = per_get_few_bits(pd, ct->range_bits); + if (value < 0) _ASN_DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", td->name, value, + ct->range_bits); + if (value > ct->upper_bound) _ASN_DECODE_FAILED; + } + else + { + if (specs->ext_start == -1) _ASN_DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if (value < 0) _ASN_DECODE_STARVED; + value += specs->ext_start; + if (value >= td->elements_count) _ASN_DECODE_FAILED; + } /* Adjust if canonical order is different from natural order */ - if(specs->canonical_order) - value = specs->canonical_order[value]; + if (specs->canonical_order) value = specs->canonical_order[value]; /* Set presence to be able to free it later */ _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); elm = &td->elements[value]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); - if(ct && ct->range_bits >= 0) { - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - } else { - rv = uper_open_type_get(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - } + if (ct && ct->range_bits >= 0) + { + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + else + { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } - if(rv.code != RC_OK) - ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", - elm->name, td->name, rv.code); + if (rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, + rv.code); return rv; } -asn_enc_rval_t -CHOICE_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; - asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_TYPE_member_t *elm; /* CHOICE's element */ asn_per_constraint_t *ct; void *memb_ptr; int present; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; ASN_DEBUG("Encoding %s as CHOICE", td->name); - if(constraints) ct = &constraints->value; - else if(td->per_constraints) ct = &td->per_constraints->value; - else ct = 0; + if (constraints) + ct = &constraints->value; + else if (td->per_constraints) + ct = &td->per_constraints->value; + else + ct = 0; - present = _fetch_present_idx(sptr, - specs->pres_offset, specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized properly, it cannot be encoded: * can't deduce what to encode in the choice type. */ - if(present <= 0 || present > td->elements_count) + if (present <= 0 || present > td->elements_count) _ASN_ENCODE_FAILED; else present--; /* Adjust if canonical order is different from natural order */ - if(specs->canonical_order) - present = specs->canonical_order[present]; + if (specs->canonical_order) present = specs->canonical_order[present]; ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); - if(ct && ct->range_bits >= 0) { - if(present < ct->lower_bound - || present > ct->upper_bound) { - if(ct->flags & APC_EXTENSIBLE) { - if(per_put_few_bits(po, 1, 1)) - _ASN_ENCODE_FAILED; - } else { - _ASN_ENCODE_FAILED; - } - ct = 0; + if (ct && ct->range_bits >= 0) + { + if (present < ct->lower_bound || present > ct->upper_bound) + { + if (ct->flags & APC_EXTENSIBLE) + { + if (per_put_few_bits(po, 1, 1)) _ASN_ENCODE_FAILED; + } + else + { + _ASN_ENCODE_FAILED; + } + ct = 0; + } } - } - if(ct && ct->flags & APC_EXTENSIBLE) - if(per_put_few_bits(po, 0, 1)) - _ASN_ENCODE_FAILED; + if (ct && ct->flags & APC_EXTENSIBLE) + if (per_put_few_bits(po, 0, 1)) _ASN_ENCODE_FAILED; elm = &td->elements[present]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) _ASN_ENCODE_FAILED; - } else { - memb_ptr = (char *)sptr + elm->memb_offset; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) _ASN_ENCODE_FAILED; + } + else + { + memb_ptr = (char *)sptr + elm->memb_offset; + } - if(ct && ct->range_bits >= 0) { - if(per_put_few_bits(po, present, ct->range_bits)) - _ASN_ENCODE_FAILED; + if (ct && ct->range_bits >= 0) + { + if (per_put_few_bits(po, present, ct->range_bits)) + _ASN_ENCODE_FAILED; - return elm->type->uper_encoder(elm->type, elm->per_constraints, - memb_ptr, po); - } else { - asn_enc_rval_t rval; - if(specs->ext_start == -1) - _ASN_ENCODE_FAILED; - if(uper_put_nsnnwn(po, present - specs->ext_start)) - _ASN_ENCODE_FAILED; - if(uper_open_type_put(elm->type, elm->per_constraints, - memb_ptr, po)) - _ASN_ENCODE_FAILED; - rval.encoded = 0; - _ASN_ENCODED_OK(rval); - } + return elm->type->uper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } + else + { + asn_enc_rval_t rval; + if (specs->ext_start == -1) _ASN_ENCODE_FAILED; + if (uper_put_nsnnwn(po, present - specs->ext_start)) + _ASN_ENCODE_FAILED; + if (uper_open_type_put(elm->type, elm->per_constraints, memb_ptr, + po)) + _ASN_ENCODE_FAILED; + rval.encoded = 0; + _ASN_ENCODED_OK(rval); + } } - -int -CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* * Figure out which CHOICE element is encoded. */ - present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); + present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * Print that element. */ - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - const void *memb_ptr; + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + return (cb("", 8, app_key) < 0) ? -1 : 0; + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Print member's name and stuff */ + if (0) + { + if (cb(elm->name, strlen(elm->name), app_key) < 0 || + cb(": ", 2, app_key) < 0) + return -1; + } + + return elm->type->print_struct(elm->type, memb_ptr, ilevel, cb, + app_key); } - - /* Print member's name and stuff */ - if(0) { - if(cb(elm->name, strlen(elm->name), app_key) < 0 - || cb(": ", 2, app_key) < 0) - return -1; + else + { + return (cb("", 8, app_key) < 0) ? -1 : 0; } - - return elm->type->print_struct(elm->type, memb_ptr, ilevel, - cb, app_key); - } else { - return (cb("", 8, app_key) < 0) ? -1 : 0; - } } -void -CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { +void CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; - if(!td || !ptr) - return; + if (!td || !ptr) return; ASN_DEBUG("Freeing %s as CHOICE", td->name); @@ -1045,26 +1184,29 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { /* * Free that element. */ - if(present > 0 && present <= td->elements_count) { - asn_TYPE_member_t *elm = &td->elements[present-1]; - void *memb_ptr; + if (present > 0 && present <= td->elements_count) + { + asn_TYPE_member_t *elm = &td->elements[present - 1]; + void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)ptr + elm->memb_offset); - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); - } else { - memb_ptr = (void *)((char *)ptr + elm->memb_offset); - ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)ptr + elm->memb_offset); + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + else + { + memb_ptr = (void *)((char *)ptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } } - } - if(!contents_only) { - FREEMEM(ptr); - } + if (!contents_only) + { + FREEMEM(ptr); + } } - /* * The following functions functions offer protection against -fshort-enums, * compatible with little- and big-endian machines. @@ -1074,37 +1216,53 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { * is guaranteed to be aligned properly. ASN.1 compiler itself does not * produce packed code. */ -static int -_fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { +static int _fetch_present_idx(const void *struct_ptr, int pres_offset, + int pres_size) +{ const void *present_ptr; int present; present_ptr = ((const char *)struct_ptr) + pres_offset; - switch(pres_size) { - case sizeof(int): present = *(const int *)present_ptr; break; - case sizeof(short): present = *(const short *)present_ptr; break; - case sizeof(char): present = *(const char *)present_ptr; break; - default: - /* ANSI C mandates enum to be equivalent to integer */ - assert(pres_size != sizeof(int)); - return 0; /* If not aborted, pass back safe value */ - } + switch (pres_size) + { + case sizeof(int): + present = *(const int *)present_ptr; + break; + case sizeof(short): + present = *(const short *)present_ptr; + break; + case sizeof(char): + present = *(const char *)present_ptr; + break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + return 0; /* If not aborted, pass back safe value */ + } return present; } -static void -_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { +static void _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, + int present) +{ void *present_ptr; present_ptr = ((char *)struct_ptr) + pres_offset; - switch(pres_size) { - case sizeof(int): *(int *)present_ptr = present; break; - case sizeof(short): *(short *)present_ptr = present; break; - case sizeof(char): *(char *)present_ptr = present; break; - default: - /* ANSI C mandates enum to be equivalent to integer */ - assert(pres_size != sizeof(int)); - } + switch (pres_size) + { + case sizeof(int): + *(int *)present_ptr = present; + break; + case sizeof(short): + *(short *)present_ptr = present; + break; + case sizeof(char): + *(char *)present_ptr = present; + break; + default: + /* ANSI C mandates enum to be equivalent to integer */ + assert(pres_size != sizeof(int)); + } } diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.h b/src/core/libs/supl/asn-supl/constr_CHOICE.h index 90694fdb8..847df624c 100644 --- a/src/core/libs/supl/asn-supl/constr_CHOICE.h +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.h @@ -16,16 +16,16 @@ extern "C" typedef struct asn_CHOICE_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_codec_ctx_t member */ int pres_offset; /* Identifier of the present member */ int pres_size; /* Size of the identifier (enum) */ /* - * Tags to members mapping table. - */ + * Tags to members mapping table. + */ asn_TYPE_tag2member_t *tag2el; int tag2el_count; @@ -33,14 +33,14 @@ extern "C" int *canonical_order; /* - * Extensions-related stuff. - */ + * Extensions-related stuff. + */ int ext_start; /* First member of extensions, or -1 */ } asn_CHOICE_specifics_t; /* - * A set specialized functions dealing with the CHOICE type. - */ + * A set specialized functions dealing with the CHOICE type. + */ asn_struct_free_f CHOICE_free; asn_struct_print_f CHOICE_print; asn_constr_check_f CHOICE_constraint; diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c index 8cb9e106b..21b3c0a7c 100644 --- a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,92 +25,109 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#undef PHASE_OUT -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) -#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) +#define PHASE_OUT(ctx) \ + do \ + { \ + (ctx)->phase = 10; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * Check whether we are inside the extensions group. */ -#define IN_EXTENSION_GROUP(specs, memb_idx) \ - ( ((memb_idx) > (specs)->ext_after) \ - &&((memb_idx) < (specs)->ext_before)) - +#define IN_EXTENSION_GROUP(specs, memb_idx) \ + (((memb_idx) > (specs)->ext_after) && ((memb_idx) < (specs)->ext_before)) /* * Tags are canonically sorted in the tag2element map. */ -static int -_t2e_cmp(const void *ap, const void *bp) { +static int _t2e_cmp(const void *ap, const void *bp) +{ const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); - if(a_class == b_class) { - ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); - ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); + if (a_class == b_class) + { + ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); + ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); - if(a_value == b_value) { - if(a->el_no > b->el_no) + if (a_value == b_value) + { + if (a->el_no > b->el_no) return 1; + /* + * Important: we do not check + * for a->el_no <= b->el_no! + */ + return 0; + } + else if (a_value < b_value) + return -1; + else return 1; - /* - * Important: we do not check - * for a->el_no <= b->el_no! - */ - return 0; - } else if(a_value < b_value) + } + else if (a_class < b_class) + { return -1; - else + } + else + { return 1; - } else if(a_class < b_class) { - return -1; - } else { - return 1; - } + } } - /* * The decoder of the SEQUENCE type. */ -asn_dec_rval_t -SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ @@ -120,26 +137,28 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* SEQUENCE element's index */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* SEQUENCE element's index */ ASN_DEBUG("Decoding %s as SEQUENCE", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -149,442 +168,504 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, 1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Subtracted below! */ - ADVANCE(rval.consumed); - - NEXT_PHASE(ctx); - - ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", - (long)ctx->left, (long)size); - - /* Fall through */ - case 1: - /* - * PHASE 1. - * From the place where we've left it previously, - * try to decode the next member from the list of - * this structure's elements. - * (ctx->step) stores the member being processed - * between invocations and the microphase {0,1} of parsing - * that member: - * step = ( * 2 + ). - */ - for(edx = (ctx->step >> 1); edx < td->elements_count; - edx++, ctx->step = (ctx->step & ~1) + 2) { - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - ssize_t tag_len; /* Length of TLV's T */ - int opt_edx_end; /* Next non-optional element */ - int use_bsearch; - int n; - - if(ctx->step & 1) - goto microphase2; - - /* - * MICROPHASE 1: Synchronize decoding. - */ - ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" - " opt=%d ec=%d", - td->name, (int)ctx->left, edx, - elements[edx].flags, elements[edx].optional, - td->elements_count); - - if(ctx->left == 0 /* No more stuff is expected */ - && ( - /* Explicit OPTIONAL specification reaches the end */ - (edx + elements[edx].optional - == td->elements_count) - || - /* All extensions are optional */ - (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before > td->elements_count) - ) - ) { - ASN_DEBUG("End of SEQUENCE %s", td->name); - /* - * Found the legitimate end of the structure. - */ - PHASE_OUT(ctx); - RETURN(RC_OK); - } - - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - ASN_DEBUG("Current tag in %s SEQUENCE for element %d " - "(%s) is %s encoded in %d bytes, of frame %ld", - td->name, edx, elements[edx].name, - ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - ASN_DEBUG("edx = %d, opt = %d, ec=%d", - edx, elements[edx].optional, - td->elements_count); - if((edx + elements[edx].optional - == td->elements_count) - || (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before - > td->elements_count)) { - /* - * Yeah, baby! Found the terminator - * of the indefinite length structure. - */ - /* - * Proceed to the canonical - * finalization function. - * No advancing is necessary. - */ - goto phase3; - } - } - } - - /* - * Find the next available type with this tag. - */ - use_bsearch = 0; - opt_edx_end = edx + elements[edx].optional + 1; - if(opt_edx_end > td->elements_count) - opt_edx_end = td->elements_count; /* Cap */ - else if(opt_edx_end - edx > 8) { - /* Limit the scope of linear search... */ - opt_edx_end = edx + 8; - use_bsearch = 1; - /* ... and resort to bsearch() */ - } - for(n = edx; n < opt_edx_end; n++) { - if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { + switch (ctx->phase) + { + case 0: /* - * Found element corresponding to the tag - * being looked at. - * Reposition over the right element. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ - edx = n; - ctx->step = 1 + 2 * edx; /* Remember! */ - goto microphase2; - } else if(elements[n].flags & ATF_OPEN_TYPE) { - /* - * This is the ANY type, which may bear - * any flag whatsoever. - */ - edx = n; - ctx->step = 1 + 2 * edx; /* Remember! */ - goto microphase2; - } else if(elements[n].tag == (ber_tlv_tag_t)-1) { - use_bsearch = 1; - break; - } - } - if(use_bsearch) { - /* - * Resort to a binary search over - * sorted array of tags. - */ - asn_TYPE_tag2member_t *t2m; - asn_TYPE_tag2member_t key; - key.el_tag = tlv_tag; - key.el_no = edx; - t2m = (asn_TYPE_tag2member_t *)bsearch(&key, - specs->tag2el, specs->tag2el_count, - sizeof(specs->tag2el[0]), _t2e_cmp); - if(t2m) { - asn_TYPE_tag2member_t *best = 0; - asn_TYPE_tag2member_t *t2m_f; - asn_TYPE_tag2member_t *t2m_l; - int edx_max = edx + elements[edx].optional; - /* - * Rewind to the first element with that tag, - * `cause bsearch() does not guarantee order. - */ - t2m_f = t2m + t2m->toff_first; - t2m_l = t2m + t2m->toff_last; - for(t2m = t2m_f; t2m <= t2m_l; t2m++) { - if(t2m->el_no > edx_max) break; - if(t2m->el_no < edx) continue; - best = t2m; - } - if(best) { - edx = best->el_no; - ctx->step = 1 + 2 * edx; - goto microphase2; - } - } - n = opt_edx_end; - } - if(n == opt_edx_end) { - /* - * If tag is unknown, it may be either - * an unknown (thus, incorrect) tag, - * or an extension (...), - * or an end of the indefinite-length structure. - */ - if(!IN_EXTENSION_GROUP(specs, - edx + elements[edx].optional)) { - ASN_DEBUG("Unexpected tag %s (at %d)", - ber_tlv_tag_string(tlv_tag), edx); - ASN_DEBUG("Expected tag %s (%s)%s", - ber_tlv_tag_string(elements[edx].tag), - elements[edx].name, - elements[edx].optional - ?" or alternatives":""); - RETURN(RC_FAIL); - } else { - /* Skip this tag */ - ssize_t skip; - edx += elements[edx].optional; - ASN_DEBUG("Skipping unexpected %s (at %d)", - ber_tlv_tag_string(tlv_tag), edx); - skip = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tag_len, - LEFT - tag_len); - ASN_DEBUG("Skip length %d in %s", - (int)skip, td->name); - switch(skip) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", td->name, + rval.code); + return rval; + } - ADVANCE(skip + tag_len); - ctx->step -= 2; - edx--; - continue; /* Try again with the next tag */ - } - } - - /* - * MICROPHASE 2: Invoke the member-specific decoder. - */ - ctx->step |= 1; /* Confirm entering next microphase */ - microphase2: - ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); - - /* - * Compute the position of the member inside a structure, - * and also a type of containment (it may be contained - * as pointer or using inline inclusion). - */ - if(elements[edx].flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); - } else { - /* - * A pointer to a pointer - * holding the start of the structure - */ - memb_ptr = (char *)st + elements[edx].memb_offset; - memb_ptr2 = &memb_ptr; - } - /* - * Invoke the member fetch routine according to member's type - */ - rval = elements[edx].type->ber_decoder(opt_codec_ctx, - elements[edx].type, - memb_ptr2, ptr, LEFT, - elements[edx].tag_mode); - ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " - "in %d bytes rval.code %d, size=%d", - td->name, edx, elements[edx].type->name, - (int)LEFT, (int)rval.consumed, rval.code, (int)size); - switch(rval.code) { - case RC_OK: - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { + if (ctx->left >= 0) + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", - (long)ctx->left, (long)size); - /* Fall through */ - case RC_FAIL: /* Fatal error */ - RETURN(RC_FAIL); - } /* switch(rval) */ - ADVANCE(rval.consumed); - } /* for(all structure members) */ + NEXT_PHASE(ctx); - phase3: - ctx->phase = 3; - case 3: /* 00 and other tags expected */ - case 4: /* only 00's expected */ + ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", + (long)ctx->left, (long)size); - ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", - td->name, (long)ctx->left, (long)size); - - /* - * Skip everything until the end of the SEQUENCE. - */ - while(ctx->left) { - ssize_t tl; - ssize_t ll; - - tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tl) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ - case -1: RETURN(RC_FAIL); - } + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next member from the list of + * this structure's elements. + * (ctx->step) stores the member being processed + * between invocations and the microphase {0,1} of parsing + * that member: + * step = ( * 2 + ). + */ + for (edx = (ctx->step >> 1); edx < td->elements_count; + edx++, ctx->step = (ctx->step & ~1) + 2) + { + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + ssize_t tag_len; /* Length of TLV's T */ + int opt_edx_end; /* Next non-optional element */ + int use_bsearch; + int n; - /* - * If expected <0><0>... - */ - if(ctx->left < 0 - && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { - /* - * Correctly finished with <0><0>. - */ - ADVANCE(2); - ctx->left++; - ctx->phase = 4; - continue; - } - } + if (ctx->step & 1) goto microphase2; - if(!IN_EXTENSION_GROUP(specs, td->elements_count) - || ctx->phase == 4) { - ASN_DEBUG("Unexpected continuation " - "of a non-extensible type " - "%s (SEQUENCE): %s", - td->name, - ber_tlv_tag_string(tlv_tag)); - RETURN(RC_FAIL); - } + /* + * MICROPHASE 1: Synchronize decoding. + */ + ASN_DEBUG( + "In %s SEQUENCE left %d, edx=%d flags=%d" + " opt=%d ec=%d", + td->name, (int)ctx->left, edx, elements[edx].flags, + elements[edx].optional, td->elements_count); - ll = ber_skip_length(opt_codec_ctx, - BER_TLV_CONSTRUCTED(ptr), - (const char *)ptr + tl, LEFT - tl); - switch(ll) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } + if (ctx->left == 0 /* No more stuff is expected */ + && ( + /* Explicit OPTIONAL specification reaches + the end */ + (edx + elements[edx].optional == + td->elements_count) || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > td->elements_count))) + { + ASN_DEBUG("End of SEQUENCE %s", td->name); + /* + * Found the legitimate end of the structure. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } - ADVANCE(tl + ll); + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + ASN_DEBUG( + "Current tag in %s SEQUENCE for element %d " + "(%s) is %s encoded in %d bytes, of frame %ld", + td->name, edx, elements[edx].name, + ber_tlv_tag_string(tlv_tag), (int)tag_len, + (long)LEFT); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + ASN_DEBUG("edx = %d, opt = %d, ec=%d", + edx, elements[edx].optional, + td->elements_count); + if ((edx + elements[edx].optional == + td->elements_count) || + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > + td->elements_count)) + { + /* + * Yeah, baby! Found the + * terminator of the indefinite + * length structure. + */ + /* + * Proceed to the canonical + * finalization function. + * No advancing is necessary. + */ + goto phase3; + } + } + } + + /* + * Find the next available type with this tag. + */ + use_bsearch = 0; + opt_edx_end = edx + elements[edx].optional + 1; + if (opt_edx_end > td->elements_count) + opt_edx_end = td->elements_count; /* Cap */ + else if (opt_edx_end - edx > 8) + { + /* Limit the scope of linear search... */ + opt_edx_end = edx + 8; + use_bsearch = 1; + /* ... and resort to bsearch() */ + } + for (n = edx; n < opt_edx_end; n++) + { + if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) + { + /* + * Found element corresponding to the + * tag being looked at. Reposition over + * the right element. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } + else if (elements[n].flags & ATF_OPEN_TYPE) + { + /* + * This is the ANY type, which may bear + * any flag whatsoever. + */ + edx = n; + ctx->step = 1 + 2 * edx; /* Remember! */ + goto microphase2; + } + else if (elements[n].tag == (ber_tlv_tag_t)-1) + { + use_bsearch = 1; + break; + } + } + if (use_bsearch) + { + /* + * Resort to a binary search over + * sorted array of tags. + */ + asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t key; + key.el_tag = tlv_tag; + key.el_no = edx; + t2m = (asn_TYPE_tag2member_t *)bsearch( + &key, specs->tag2el, specs->tag2el_count, + sizeof(specs->tag2el[0]), _t2e_cmp); + if (t2m) + { + asn_TYPE_tag2member_t *best = 0; + asn_TYPE_tag2member_t *t2m_f; + asn_TYPE_tag2member_t *t2m_l; + int edx_max = + edx + elements[edx].optional; + /* + * Rewind to the first element with that + * tag, `cause bsearch() does not + * guarantee order. + */ + t2m_f = t2m + t2m->toff_first; + t2m_l = t2m + t2m->toff_last; + for (t2m = t2m_f; t2m <= t2m_l; t2m++) + { + if (t2m->el_no > edx_max) break; + if (t2m->el_no < edx) continue; + best = t2m; + } + if (best) + { + edx = best->el_no; + ctx->step = 1 + 2 * edx; + goto microphase2; + } + } + n = opt_edx_end; + } + if (n == opt_edx_end) + { + /* + * If tag is unknown, it may be either + * an unknown (thus, incorrect) tag, + * or an extension (...), + * or an end of the indefinite-length structure. + */ + if (!IN_EXTENSION_GROUP( + specs, edx + elements[edx].optional)) + { + ASN_DEBUG("Unexpected tag %s (at %d)", + ber_tlv_tag_string(tlv_tag), + edx); + ASN_DEBUG("Expected tag %s (%s)%s", + ber_tlv_tag_string( + elements[edx].tag), + elements[edx].name, + elements[edx].optional + ? " or alternatives" + : ""); + RETURN(RC_FAIL); + } + else + { + /* Skip this tag */ + ssize_t skip; + edx += elements[edx].optional; + + ASN_DEBUG( + "Skipping unexpected %s (at %d)", + ber_tlv_tag_string(tlv_tag), edx); + skip = ber_skip_length( + opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tag_len, + LEFT - tag_len); + ASN_DEBUG("Skip length %d in %s", + (int)skip, td->name); + switch (skip) + { + case 0: + if (!SIZE_VIOLATION) + RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(skip + tag_len); + ctx->step -= 2; + edx--; + continue; /* Try again with the next tag + */ + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); + + /* + * Compute the position of the member inside a + * structure, and also a type of containment (it may be + * contained as pointer or using inline inclusion). + */ + if (elements[edx].flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + + elements[edx].memb_offset); + } + else + { + /* + * A pointer to a pointer + * holding the start of the structure + */ + memb_ptr = + (char *)st + elements[edx].memb_offset; + memb_ptr2 = &memb_ptr; + } + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elements[edx].type->ber_decoder( + opt_codec_ctx, elements[edx].type, memb_ptr2, ptr, + LEFT, elements[edx].tag_mode); + ASN_DEBUG( + "In %s SEQUENCE decoded %d %s of %d " + "in %d bytes rval.code %d, size=%d", + td->name, edx, elements[edx].type->name, (int)LEFT, + (int)rval.consumed, rval.code, (int)size); + switch (rval.code) + { + case RC_OK: + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + ASN_DEBUG( + "Size violation (c->l=%ld <= s=%ld)", + (long)ctx->left, (long)size); + /* Fall through */ + case RC_FAIL: /* Fatal error */ + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all structure members) */ + + phase3: + ctx->phase = 3; + case 3: /* 00 and other tags expected */ + case 4: /* only 00's expected */ + + ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", td->name, + (long)ctx->left, (long)size); + + /* + * Skip everything until the end of the SEQUENCE. + */ + while (ctx->left) + { + ssize_t tl; + ssize_t ll; + + tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tl) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + /* + * If expected <0><0>... + */ + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Correctly finished with <0><0>. + */ + ADVANCE(2); + ctx->left++; + ctx->phase = 4; + continue; + } + } + + if (!IN_EXTENSION_GROUP(specs, td->elements_count) || + ctx->phase == 4) + { + ASN_DEBUG( + "Unexpected continuation " + "of a non-extensible type " + "%s (SEQUENCE): %s", + td->name, ber_tlv_tag_string(tlv_tag)); + RETURN(RC_FAIL); + } + + ll = ber_skip_length(opt_codec_ctx, + BER_TLV_CONSTRUCTED(ptr), + (const char *)ptr + tl, LEFT - tl); + switch (ll) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + ADVANCE(tl + ll); + } + + PHASE_OUT(ctx); } - PHASE_OUT(ctx); - } - RETURN(RC_OK); } - /* * The DER encoder of the SEQUENCE type. */ -asn_enc_rval_t -SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, - void *sptr, int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ size_t computed_size = 0; asn_enc_rval_t erval; ssize_t ret; int edx; - ASN_DEBUG("%s %s as SEQUENCE", - cb?"Encoding":"Estimating", td->name); + ASN_DEBUG("%s %s as SEQUENCE", cb ? "Encoding" : "Estimating", td->name); /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, + elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; + ASN_DEBUG("Member %d %s estimated %ld bytes", edx, elm->name, + (long)erval.encoded); } - erval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, - 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; - ASN_DEBUG("Member %d %s estimated %ld bytes", - edx, elm->name, (long)erval.encoded); - } /* * Encode the TLV for the sequence itself. */ ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); - if(ret == -1) - _ASN_ENCODE_FAILED; + if (ret == -1) _ASN_ENCODE_FAILED; erval.encoded = computed_size + ret; - if(!cb) _ASN_ENCODED_OK(erval); + if (!cb) _ASN_ENCODED_OK(erval); /* * Encode all members. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - asn_enc_rval_t tmperval; - void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmperval; + void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) continue; - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) continue; + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + tmperval = elm->type->der_encoder( + elm->type, memb_ptr, elm->tag_mode, elm->tag, cb, app_key); + if (tmperval.encoded == -1) return tmperval; + computed_size -= tmperval.encoded; + ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", edx, + elm->name, td->name, (long)tmperval.encoded); } - tmperval = elm->type->der_encoder(elm->type, memb_ptr, - elm->tag_mode, elm->tag, - cb, app_key); - if(tmperval.encoded == -1) - return tmperval; - computed_size -= tmperval.encoded; - ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", - edx, elm->name, td->name, (long)tmperval.encoded); - } - if(computed_size != 0) + if (computed_size != 0) /* * Encoded size is not equal to the computed size. */ @@ -593,55 +674,57 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(erval); } - -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * ... and parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value from a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ - int edx; /* Element index */ + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + int edx; /* Element index */ int edx_end; /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. @@ -650,486 +733,548 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 3: Skipping unknown extensions. * Phase 4: PHASED OUT */ - for(edx = ctx->step; ctx->phase <= 3;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ - asn_TYPE_member_t *elm; - int n; + for (edx = ctx->step; ctx->phase <= 3;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ + asn_TYPE_member_t *elm; + int n; - /* - * Go inside the inner member of a sequence. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + /* + * Go inside the inner member of a sequence. + */ + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - elm = &td->elements[edx]; + elm = &td->elements[edx]; - if(elm->flags & ATF_POINTER) { - /* Member is a pointer to another structure */ - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } + if (elm->flags & ATF_POINTER) + { + /* Member is a pointer to another structure */ + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } - /* Invoke the inner type decoder, m.b. multiple times */ - tmprval = elm->type->xer_decoder(opt_codec_ctx, - elm->type, memb_ptr2, elm->name, - buf_ptr, size); - XER_ADVANCE(tmprval.consumed); - if(tmprval.code != RC_OK) - RETURN(tmprval.code); - ctx->phase = 1; /* Back to body processing */ - ctx->step = ++edx; - ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", - ctx->phase, ctx->step); - /* Fall through */ - } - - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, - &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", - tcv, ctx->phase, xml_tag); - - /* Skip the extensions section */ - if(ctx->phase == 3) { - switch(xer_skip_unknown(tcv, &ctx->left)) { - case -1: - ctx->phase = 4; - RETURN(RC_FAIL); - case 0: - XER_ADVANCE(ch_size); - continue; - case 1: - XER_ADVANCE(ch_size); - ctx->phase = 1; - continue; - case 2: - ctx->phase = 1; - break; - } - } - - switch(tcv) { - case XCT_CLOSING: - if(ctx->phase == 0) break; - ctx->phase = 0; - /* Fall through */ - case XCT_BOTH: - if(ctx->phase == 0) { - if(edx >= td->elements_count - || - /* Explicit OPTIONAL specs reaches the end */ - (edx + elements[edx].optional - == td->elements_count) - || - /* All extensions are optional */ - (IN_EXTENSION_GROUP(specs, edx) - && specs->ext_before - > td->elements_count) - ) { - XER_ADVANCE(ch_size); - ctx->phase = 4; /* Phase out */ - RETURN(RC_OK); - } else { - ASN_DEBUG("Premature end of XER SEQUENCE"); - RETURN(RC_FAIL); + /* Invoke the inner type decoder, m.b. multiple times */ + tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, + memb_ptr2, elm->name, + buf_ptr, size); + XER_ADVANCE(tmprval.consumed); + if (tmprval.code != RC_OK) RETURN(tmprval.code); + ctx->phase = 1; /* Back to body processing */ + ctx->step = ++edx; + ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", + ctx->phase, ctx->step); + /* Fall through */ } - } - /* Fall through */ - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: - ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", - tcv, ctx->phase, edx); - if(ctx->phase != 1) { - break; /* Really unexpected */ - } + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } - if(edx < td->elements_count) { - /* - * Search which member corresponds to this tag. - */ - edx_end = edx + elements[edx].optional + 1; - if(edx_end > td->elements_count) - edx_end = td->elements_count; - for(n = edx; n < edx_end; n++) { - elm = &td->elements[n]; - tcv = xer_check_tag(buf_ptr, - ch_size, elm->name); - switch(tcv) { + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", tcv, ctx->phase, + xml_tag); + + /* Skip the extensions section */ + if (ctx->phase == 3) + { + switch (xer_skip_unknown(tcv, &ctx->left)) + { + case -1: + ctx->phase = 4; + RETURN(RC_FAIL); + case 0: + XER_ADVANCE(ch_size); + continue; + case 1: + XER_ADVANCE(ch_size); + ctx->phase = 1; + continue; + case 2: + ctx->phase = 1; + break; + } + } + + switch (tcv) + { + case XCT_CLOSING: + if (ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ case XCT_BOTH: + if (ctx->phase == 0) + { + if (edx >= td->elements_count || + /* Explicit OPTIONAL specs reaches the end + */ + (edx + elements[edx].optional == + td->elements_count) || + /* All extensions are optional */ + (IN_EXTENSION_GROUP(specs, edx) && + specs->ext_before > td->elements_count)) + { + XER_ADVANCE(ch_size); + ctx->phase = 4; /* Phase out */ + RETURN(RC_OK); + } + else + { + ASN_DEBUG( + "Premature end of XER SEQUENCE"); + RETURN(RC_FAIL); + } + } + /* Fall through */ case XCT_OPENING: - /* - * Process this member. - */ - ctx->step = edx = n; - ctx->phase = 2; - break; + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: - continue; + + ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", tcv, + ctx->phase, edx); + if (ctx->phase != 1) + { + break; /* Really unexpected */ + } + + if (edx < td->elements_count) + { + /* + * Search which member corresponds to this tag. + */ + edx_end = edx + elements[edx].optional + 1; + if (edx_end > td->elements_count) + edx_end = td->elements_count; + for (n = edx; n < edx_end; n++) + { + elm = &td->elements[n]; + tcv = xer_check_tag(buf_ptr, ch_size, + elm->name); + switch (tcv) + { + case XCT_BOTH: + case XCT_OPENING: + /* + * Process this member. + */ + ctx->step = edx = n; + ctx->phase = 2; + break; + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: + continue; + default: + n = edx_end; + break; /* Phase out */ + } + break; + } + if (n != edx_end) continue; + } + else + { + ASN_DEBUG("Out of defined members: %d/%d", edx, + td->elements_count); + } + + /* It is expected extension */ + if (IN_EXTENSION_GROUP( + specs, edx + (edx < td->elements_count + ? elements[edx].optional + : 0))) + { + ASN_DEBUG("Got anticipated extension at %d", + edx); + /* + * Check for (XCT_BOTH or XCT_UNKNOWN_BO) + * By using a mask. Only record a pure + * tags. + */ + if (tcv & XCT_CLOSING) + { + /* Found without body */ + } + else + { + ctx->left = 1; + ctx->phase = 3; /* Skip ...'s */ + } + XER_ADVANCE(ch_size); + continue; + } + + /* Fall through */ default: - n = edx_end; - break; /* Phase out */ - } - break; + break; } - if(n != edx_end) - continue; - } else { - ASN_DEBUG("Out of defined members: %d/%d", - edx, td->elements_count); - } - /* It is expected extension */ - if(IN_EXTENSION_GROUP(specs, - edx + (edx < td->elements_count - ? elements[edx].optional : 0))) { - ASN_DEBUG("Got anticipated extension at %d", - edx); - /* - * Check for (XCT_BOTH or XCT_UNKNOWN_BO) - * By using a mask. Only record a pure - * tags. - */ - if(tcv & XCT_CLOSING) { - /* Found without body */ - } else { - ctx->left = 1; - ctx->phase = 3; /* Skip ...'s */ - } - XER_ADVANCE(ch_size); - continue; - } - - /* Fall through */ - default: + ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", + size > 0 ? ((const char *)buf_ptr)[0] : '.', + size > 1 ? ((const char *)buf_ptr)[1] : '.', + size > 2 ? ((const char *)buf_ptr)[2] : '.', + size > 3 ? ((const char *)buf_ptr)[3] : '.', + size > 4 ? ((const char *)buf_ptr)[4] : '.', + size > 5 ? ((const char *)buf_ptr)[5] : '.'); break; } - ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", - size>0?((const char *)buf_ptr)[0]:'.', - size>1?((const char *)buf_ptr)[1]:'.', - size>2?((const char *)buf_ptr)[2]:'.', - size>3?((const char *)buf_ptr)[3]:'.', - size>4?((const char *)buf_ptr)[4]:'.', - size>5?((const char *)buf_ptr)[5]:'.'); - break; - } - - ctx->phase = 4; /* "Phase out" on hard failure */ + ctx->phase = 4; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } -asn_enc_rval_t -SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; int xcan = (flags & XER_F_CANONICAL); int edx; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; - for(edx = 0; edx < td->elements_count; edx++) { - asn_enc_rval_t tmper; - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - const char *mname = elm->name; - unsigned int mlen = strlen(mname); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_enc_rval_t tmper; + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + const char *mname = elm->name; + unsigned int mlen = strlen(mname); - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + + /* Print the member itself */ + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + + _ASN_CALLBACK3("", 1); + er.encoded += 5 + (2 * mlen) + tmper.encoded; } - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - - /* Print the member itself */ - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - - _ASN_CALLBACK3("", 1); - er.encoded += 5 + (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -int -SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ int edx; int ret; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ - if(cb(td->name, strlen(td->name), app_key) < 0 - || cb(" ::= {", 6, app_key) < 0) + if (cb(td->name, strlen(td->name), app_key) < 0 || + cb(" ::= {", 6, app_key) < 0) return -1; - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - const void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) continue; - /* Print line */ - /* Fall through */ - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + /* Print line */ + /* Fall through */ + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } + + /* Indentation */ + _i_INDENT(1); + + /* Print the member's name and stuff */ + if (cb(elm->name, strlen(elm->name), app_key) < 0 || + cb(": ", 2, app_key) < 0) + return -1; + + /* Print the member itself */ + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, + app_key); + if (ret) return ret; } - /* Indentation */ - _i_INDENT(1); - - /* Print the member's name and stuff */ - if(cb(elm->name, strlen(elm->name), app_key) < 0 - || cb(": ", 2, app_key) < 0) - return -1; - - /* Print the member itself */ - ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, - cb, app_key); - if(ret) return ret; - } - ilevel--; _i_INDENT(1); return (cb("}", 1, app_key) < 0) ? -1 : 0; } -void -SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { +void SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) +{ int edx; - if(!td || !sptr) - return; + if (!td || !sptr) return; ASN_DEBUG("Freeing %s as SEQUENCE", td->name); - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); + } } - } - if(!contents_only) { - FREEMEM(sptr); - } + if (!contents_only) + { + FREEMEM(sptr); + } } -int -SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ int edx; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } /* * Iterate over structure members and check their validity. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - const void *memb_ptr; + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + const void *memb_ptr; - if(elm->flags & ATF_POINTER) { - memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) { - if(elm->optional) - continue; - _ASN_CTFAIL(app_key, td, sptr, - "%s: mandatory element %s absent (%s:%d)", - td->name, elm->name, __FILE__, __LINE__); - return -1; - } - } else { - memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); - } + if (elm->flags & ATF_POINTER) + { + memb_ptr = *(const void *const *)((const char *)sptr + + elm->memb_offset); + if (!memb_ptr) + { + if (elm->optional) continue; + _ASN_CTFAIL( + app_key, td, sptr, + "%s: mandatory element %s absent (%s:%d)", + td->name, elm->name, __FILE__, __LINE__); + return -1; + } + } + else + { + memb_ptr = + (const void *)((const char *)sptr + elm->memb_offset); + } - if(elm->memb_constraints) { - int ret = elm->memb_constraints(elm->type, memb_ptr, - ctfailcb, app_key); - if(ret) return ret; - } else { - int ret = elm->type->check_constraints(elm->type, - memb_ptr, ctfailcb, app_key); - if(ret) return ret; - /* - * Cannot inherit it earlier: - * need to make sure we get the updated version. - */ - elm->memb_constraints = elm->type->check_constraints; + if (elm->memb_constraints) + { + int ret = elm->memb_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if (ret) return ret; + } + else + { + int ret = elm->type->check_constraints(elm->type, memb_ptr, + ctfailcb, app_key); + if (ret) return ret; + /* + * Cannot inherit it earlier: + * need to make sure we get the updated version. + */ + elm->memb_constraints = elm->type->check_constraints; + } } - } return 0; } -asn_dec_rval_t -SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; - void *st = *sptr; /* Target structure. */ - int extpresent; /* Extension additions are present */ - uint8_t *opres; /* Presence of optional root members */ + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ asn_per_data_t opmd; asn_dec_rval_t rv; int edx; (void)constraints; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); /* Handle extensions */ - if(specs->ext_before >= 0) { - extpresent = per_get_few_bits(pd, 1); - if(extpresent < 0) _ASN_DECODE_STARVED; - } else { - extpresent = 0; - } + if (specs->ext_before >= 0) + { + extpresent = per_get_few_bits(pd, 1); + if (extpresent < 0) _ASN_DECODE_STARVED; + } + else + { + extpresent = 0; + } /* Prepare a place and read-in the presence bitmap */ memset(&opmd, 0, sizeof(opmd)); - if(specs->roms_count) { - opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); - if(!opres) _ASN_DECODE_FAILED; - /* Get the presence map */ - if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { - FREEMEM(opres); - _ASN_DECODE_STARVED; + if (specs->roms_count) + { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if (!opres) _ASN_DECODE_FAILED; + /* Get the presence map */ + if (per_get_many_bits(pd, opres, 0, specs->roms_count)) + { + FREEMEM(opres); + _ASN_DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } + else + { + opres = 0; } - opmd.buffer = opres; - opmd.nbits = specs->roms_count; - ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", - td->name, specs->roms_count, *opres); - } else { - opres = 0; - } /* * Get the sequence ROOT elements. */ - for(edx = 0; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + for (edx = 0; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - if(IN_EXTENSION_GROUP(specs, edx)) - continue; + if (IN_EXTENSION_GROUP(specs, edx)) continue; - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (char *)st + elm->memb_offset; - memb_ptr2 = &memb_ptr; - } - - /* Deal with optionality */ - if(elm->optional) { - int present = per_get_few_bits(&opmd, 1); - ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", - td->name, elm->name, present, - (int)opmd.nboff, (int)opmd.nbits); - if(present == 0) { - /* This element is not present */ - if(elm->default_value) { - /* Fill-in DEFAULT */ - if(elm->default_value(1, memb_ptr2)) { - FREEMEM(opres); - _ASN_DECODE_FAILED; - } - ASN_DEBUG("Filled-in default"); + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; } - /* The member is just not present */ - continue; - } - /* Fall through */ - } - /* Fetch the member from the stream */ - ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - if(rv.code != RC_OK) { - ASN_DEBUG("Failed decode %s in %s", - elm->name, td->name); - FREEMEM(opres); - return rv; + /* Deal with optionality */ + if (elm->optional) + { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, (int)opmd.nboff, + (int)opmd.nbits); + if (present == 0) + { + /* This element is not present */ + if (elm->default_value) + { + /* Fill-in DEFAULT */ + if (elm->default_value(1, memb_ptr2)) + { + FREEMEM(opres); + _ASN_DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if (rv.code != RC_OK) + { + ASN_DEBUG("Failed decode %s in %s", elm->name, td->name); + FREEMEM(opres); + return rv; + } } - } /* Optionality map is not needed anymore */ FREEMEM(opres); @@ -1137,169 +1282,193 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Deal with extensions. */ - if(extpresent) { - ssize_t bmlength; - uint8_t *epres; /* Presence of extension members */ - asn_per_data_t epmd; + if (extpresent) + { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; - bmlength = uper_get_nslength(pd); - if(bmlength < 0) _ASN_DECODE_STARVED; + bmlength = uper_get_nslength(pd); + if (bmlength < 0) _ASN_DECODE_STARVED; - ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); - epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); - if(!epres) _ASN_DECODE_STARVED; + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if (!epres) _ASN_DECODE_STARVED; - /* Get the extensions map */ - if(per_get_many_bits(pd, epres, 0, bmlength)) { - FREEMEM(epres); - _ASN_DECODE_STARVED; - } - memset(&epmd, 0, sizeof(epmd)); - epmd.buffer = epres; - epmd.nbits = bmlength; - ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", - td->name, bmlength, *epres); - - /* Go over extensions and read them in */ - for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; - - if(!IN_EXTENSION_GROUP(specs, edx)) { - ASN_DEBUG("%d is not extension", edx); - continue; - } - - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st + elm->memb_offset); - } else { - memb_ptr = (void *)((char *)st + elm->memb_offset); - memb_ptr2 = &memb_ptr; - } - - present = per_get_few_bits(&epmd, 1); - if(present <= 0) { - if(present < 0) break; /* No more extensions */ - continue; - } - - ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); - rv = uper_open_type_get(opt_codec_ctx, elm->type, - elm->per_constraints, memb_ptr2, pd); - if(rv.code != RC_OK) { - FREEMEM(epres); - return rv; - } - } - - /* Skip over overflow extensions which aren't present - * in this system's version of the protocol */ - for(;;) { - ASN_DEBUG("Getting overflow extensions"); - switch(per_get_few_bits(&epmd, 1)) { - case -1: break; - case 0: continue; - default: - if(uper_open_type_skip(opt_codec_ctx, pd)) { + /* Get the extensions map */ + if (per_get_many_bits(pd, epres, 0, bmlength)) + { FREEMEM(epres); _ASN_DECODE_STARVED; } - } - break; - } + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", + td->name, bmlength, *epres); - FREEMEM(epres); - } + /* Go over extensions and read them in */ + for (edx = specs->ext_after + 1; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if (!IN_EXTENSION_GROUP(specs, edx)) + { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = + (void **)((char *)st + elm->memb_offset); + } + else + { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if (present <= 0) + { + if (present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, + td->name, *memb_ptr2); + rv = + uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if (rv.code != RC_OK) + { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for (;;) + { + ASN_DEBUG("Getting overflow extensions"); + switch (per_get_few_bits(&epmd, 1)) + { + case -1: + break; + case 0: + continue; + default: + if (uper_open_type_skip(opt_codec_ctx, pd)) + { + FREEMEM(epres); + _ASN_DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } /* Fill DEFAULT members in extensions */ - for(edx = specs->roms_count; edx < specs->roms_count - + specs->aoms_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void **memb_ptr2; /* Pointer to member pointer */ + for (edx = specs->roms_count; edx < specs->roms_count + specs->aoms_count; + edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ - if(!elm->default_value) continue; + if (!elm->default_value) continue; - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)st - + elm->memb_offset); - if(*memb_ptr2) continue; - } else { - continue; /* Extensions are all optionals */ + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + if (*memb_ptr2) continue; + } + else + { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if (elm->default_value(1, memb_ptr2)) + { + _ASN_DECODE_FAILED; + } } - /* Set default value */ - if(elm->default_value(1, memb_ptr2)) { - _ASN_DECODE_FAILED; - } - } - rv.consumed = 0; rv.code = RC_OK; return rv; } -static int -SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, - asn_per_outp_t *po1, asn_per_outp_t *po2) { - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; +static int SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) +{ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; int exts_present = 0; int exts_count = 0; int edx; - if(specs->ext_before < 0) - return 0; + if (specs->ext_before < 0) return 0; /* Find out which extensions are present */ - for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; + for (edx = specs->ext_after + 1; edx < td->elements_count; edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; - if(!IN_EXTENSION_GROUP(specs, edx)) { - ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); - continue; + if (!IN_EXTENSION_GROUP(specs, edx)) + { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, + edx); + continue; + } + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", elm->type->name, edx, + present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if (po1 && per_put_few_bits(po1, present, 1)) return -1; + /* Encode as open type field */ + if (po2 && present && + uper_open_type_put(elm->type, elm->per_constraints, *memb_ptr2, + po2)) + return -1; } - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - present = (*memb_ptr2 != 0); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; - present = 1; - } - - ASN_DEBUG("checking %s (@%d) present => %d", - elm->type->name, edx, present); - exts_count++; - exts_present += present; - - /* Encode as presence marker */ - if(po1 && per_put_few_bits(po1, present, 1)) - return -1; - /* Encode as open type field */ - if(po2 && present && uper_open_type_put(elm->type, - elm->per_constraints, *memb_ptr2, po2)) - return -1; - - } - return exts_present ? exts_count : 0; } -asn_enc_rval_t -SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_SEQUENCE_specifics_t *specs - = (asn_SEQUENCE_specifics_t *)td->specifics; +asn_enc_rval_t SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_enc_rval_t er; int n_extensions; int edx; @@ -1307,118 +1476,124 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, (void)constraints; - if(!sptr) - _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); - /* * X.691#18.1 Whether structure is extensible * and whether to encode extensions */ - if(specs->ext_before >= 0) { - n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); - per_put_few_bits(po, n_extensions ? 1 : 0, 1); - } else { - n_extensions = 0; /* There are no extensions to encode */ - } - - /* Encode a presence bitmap */ - for(i = 0; i < specs->roms_count; i++) { - asn_TYPE_member_t *elm; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ - int present; - - edx = specs->oms[i]; - elm = &td->elements[edx]; - - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - present = (*memb_ptr2 != 0); - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; - present = 1; + if (specs->ext_before >= 0) + { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } + else + { + n_extensions = 0; /* There are no extensions to encode */ } - /* Eliminate default values */ - if(present && elm->default_value - && elm->default_value(0, memb_ptr2) == 1) - present = 0; + /* Encode a presence bitmap */ + for (i = 0; i < specs->roms_count; i++) + { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; - ASN_DEBUG("Element %s %s %s->%s is %s", - elm->flags & ATF_POINTER ? "ptr" : "inline", - elm->default_value ? "def" : "wtv", - td->name, elm->name, present ? "present" : "absent"); - if(per_put_few_bits(po, present, 1)) - _ASN_ENCODE_FAILED; - } + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if (present && elm->default_value && + elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", td->name, elm->name, + present ? "present" : "absent"); + if (per_put_few_bits(po, present, 1)) _ASN_ENCODE_FAILED; + } /* * Encode the sequence ROOT elements. */ - ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); - for(edx = 0; edx < ((specs->ext_after < 0) - ? td->elements_count : specs->ext_before - 1); edx++) { + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, + td->elements_count, specs->ext_before); + for (edx = 0; edx < ((specs->ext_after < 0) ? td->elements_count + : specs->ext_before - 1); + edx++) + { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ - asn_TYPE_member_t *elm = &td->elements[edx]; - void *memb_ptr; /* Pointer to the member */ - void **memb_ptr2; /* Pointer to that pointer */ + if (IN_EXTENSION_GROUP(specs, edx)) continue; - if(IN_EXTENSION_GROUP(specs, edx)) - continue; + ASN_DEBUG("About to encode %s", elm->type->name); - ASN_DEBUG("About to encode %s", elm->type->name); + /* Fetch the pointer to this member */ + if (elm->flags & ATF_POINTER) + { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if (!*memb_ptr2) + { + ASN_DEBUG("Element %s %d not present", elm->name, + edx); + if (elm->optional) continue; + /* Mandatory element is missing */ + _ASN_ENCODE_FAILED; + } + } + else + { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } - /* Fetch the pointer to this member */ - if(elm->flags & ATF_POINTER) { - memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); - if(!*memb_ptr2) { - ASN_DEBUG("Element %s %d not present", - elm->name, edx); - if(elm->optional) - continue; - /* Mandatory element is missing */ - _ASN_ENCODE_FAILED; - } - } else { - memb_ptr = (void *)((char *)sptr + elm->memb_offset); - memb_ptr2 = &memb_ptr; + /* Eliminate default values */ + if (elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->uper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if (er.encoded == -1) return er; } - /* Eliminate default values */ - if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) - continue; - - ASN_DEBUG("Encoding %s->%s", td->name, elm->name); - er = elm->type->uper_encoder(elm->type, elm->per_constraints, - *memb_ptr2, po); - if(er.encoded == -1) - return er; - } - /* No extensions to encode */ - if(!n_extensions) _ASN_ENCODED_OK(er); + if (!n_extensions) _ASN_ENCODED_OK(er); ASN_DEBUG("Length of %d bit-map", n_extensions); /* #18.8. Write down the presence bit-map length. */ - if(uper_put_nslength(po, n_extensions)) - _ASN_ENCODE_FAILED; + if (uper_put_nslength(po, n_extensions)) _ASN_ENCODE_FAILED; ASN_DEBUG("Bit-map of %d elements", n_extensions); /* #18.7. Encoding the extensions presence bit-map. */ /* TODO: act upon NOTE in #18.7 for canonical PER */ - if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + if (SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) _ASN_ENCODE_FAILED; ASN_DEBUG("Writing %d extensions", n_extensions); /* #18.9. Encode extensions as open type fields. */ - if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + if (SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) _ASN_ENCODE_FAILED; _ASN_ENCODED_OK(er); diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.h b/src/core/libs/supl/asn-supl/constr_SEQUENCE.h index dbb095ba3..c5b74090f 100644 --- a/src/core/libs/supl/asn-supl/constr_SEQUENCE.h +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.h @@ -15,36 +15,35 @@ extern "C" typedef struct asn_SEQUENCE_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ /* - * Tags to members mapping table (sorted). - */ + * Tags to members mapping table (sorted). + */ asn_TYPE_tag2member_t *tag2el; int tag2el_count; /* - * Optional members of the extensions root (roms) or additions (aoms). - * Meaningful for PER. - */ + * Optional members of the extensions root (roms) or additions (aoms). + * Meaningful for PER. + */ int *oms; /* Optional MemberS */ int roms_count; /* Root optional members count */ int aoms_count; /* Additions optional members count */ /* - * Description of an extensions group. - */ + * Description of an extensions group. + */ int ext_after; /* Extensions start after this member */ int ext_before; /* Extensions stop before this member */ } asn_SEQUENCE_specifics_t; - /* - * A set specialized functions dealing with the SEQUENCE type. - */ + * A set specialized functions dealing with the SEQUENCE type. + */ asn_struct_free_f SEQUENCE_free; asn_struct_print_f SEQUENCE_print; asn_constr_check_f SEQUENCE_constraint; diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c index 8ccff1147..00e6a2a4a 100644 --- a/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE_OF.c @@ -10,10 +10,11 @@ /* * The DER encoder of the SEQUENCE OF type. */ -asn_enc_rval_t -SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); size_t computed_size = 0; @@ -26,182 +27,203 @@ SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = elm->type->der_encoder(elm->type, memb_ptr, - 0, elm->tag, - 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; - } + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = + elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; + } /* * Encode the TLV for the sequence itself. */ - encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, - cb, app_key); - if(encoding_size == -1) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } + encoding_size = + der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + if (encoding_size == -1) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } computed_size += encoding_size; - if(!cb) { - erval.encoded = computed_size; - _ASN_ENCODED_OK(erval); - } + if (!cb) + { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); /* * Encode all members. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = elm->type->der_encoder(elm->type, memb_ptr, - 0, elm->tag, - cb, app_key); - if(erval.encoded == -1) - return erval; - encoding_size += erval.encoded; - } + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, cb, + app_key); + if (erval.encoded == -1) return erval; + encoding_size += erval.encoded; + } - if(computed_size != (size_t)encoding_size) { - /* - * Encoded size is not equal to the computed size. - */ - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - } else { - erval.encoded = computed_size; - erval.structure_ptr = 0; - erval.failed_type = 0; - } + if (computed_size != (size_t)encoding_size) + { + /* + * Encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } + else + { + erval.encoded = computed_size; + erval.structure_ptr = 0; + erval.failed_type = 0; + } return erval; } -asn_enc_rval_t -SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, + enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_enc_rval_t er; - asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList - ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + ? 0 + : ((*elm->name) ? elm->name : elm->type->xml_tag); unsigned int mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); int i; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; er.encoded = 0; - for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; - void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + for (i = 0; i < list->count; i++) + { + asn_enc_rval_t tmper; + void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - if(mname) { - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - } - - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + 1, flags, cb, app_key); - if(tmper.encoded == -1) return tmper; - if(tmper.encoded == 0 && specs->as_XMLValueList) { - const char *name = elm->type->xml_tag; - size_t len = strlen(name); - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); - _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + if (mname) + { + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); } - if(mname) { - _ASN_CALLBACK3("", 1); - er.encoded += 5; + tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, + flags, cb, app_key); + if (tmper.encoded == -1) return tmper; + if (tmper.encoded == 0 && specs->as_XMLValueList) + { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel + 1); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if (mname) + { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; } - er.encoded += (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); _ASN_ENCODED_OK(er); cb_failed: _ASN_ENCODE_FAILED; } -asn_enc_rval_t -SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { +asn_enc_rval_t SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) +{ asn_anonymous_sequence_ *list; asn_per_constraint_t *ct; asn_enc_rval_t er; asn_TYPE_member_t *elm = td->elements; int seq; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; list = _A_SEQUENCE_FROM_VOID(sptr); er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); - if(constraints) ct = &constraints->size; - else if(td->per_constraints) ct = &td->per_constraints->size; - else ct = 0; + if (constraints) + ct = &constraints->size; + else if (td->per_constraints) + ct = &td->per_constraints->size; + else + ct = 0; /* If extensible constraint, check if size is in root */ - if(ct) { - int not_in_root = (list->count < ct->lower_bound - || list->count > ct->upper_bound); - ASN_DEBUG("lb %ld ub %ld %s", - ct->lower_bound, ct->upper_bound, - ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); - if(ct->flags & APC_EXTENSIBLE) { - /* Declare whether size is in extension root */ - if(per_put_few_bits(po, not_in_root, 1)) - _ASN_ENCODE_FAILED; - if(not_in_root) ct = 0; - } else if(not_in_root && ct->effective_bits >= 0) - _ASN_ENCODE_FAILED; - } - - if(ct && ct->effective_bits >= 0) { - /* X.691, #19.5: No length determinant */ - if(per_put_few_bits(po, list->count - ct->lower_bound, - ct->effective_bits)) - _ASN_ENCODE_FAILED; - } - - for(seq = -1; seq < list->count;) { - ssize_t mayEncode; - if(seq < 0) seq = 0; - if(ct && ct->effective_bits >= 0) { - mayEncode = list->count; - } else { - mayEncode = uper_put_length(po, list->count - seq); - if(mayEncode < 0) _ASN_ENCODE_FAILED; - } - - while(mayEncode--) { - void *memb_ptr = list->array[seq++]; - if(!memb_ptr) _ASN_ENCODE_FAILED; - er = elm->type->uper_encoder(elm->type, - elm->per_constraints, memb_ptr, po); - if(er.encoded == -1) + if (ct) + { + int not_in_root = (list->count < ct->lower_bound || + list->count > ct->upper_bound); + ASN_DEBUG("lb %ld ub %ld %s", ct->lower_bound, ct->upper_bound, + ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); + if (ct->flags & APC_EXTENSIBLE) + { + /* Declare whether size is in extension root */ + if (per_put_few_bits(po, not_in_root, 1)) + _ASN_ENCODE_FAILED; + if (not_in_root) ct = 0; + } + else if (not_in_root && ct->effective_bits >= 0) _ASN_ENCODE_FAILED; } - } + + if (ct && ct->effective_bits >= 0) + { + /* X.691, #19.5: No length determinant */ + if (per_put_few_bits(po, list->count - ct->lower_bound, + ct->effective_bits)) + _ASN_ENCODE_FAILED; + } + + for (seq = -1; seq < list->count;) + { + ssize_t mayEncode; + if (seq < 0) seq = 0; + if (ct && ct->effective_bits >= 0) + { + mayEncode = list->count; + } + else + { + mayEncode = uper_put_length(po, list->count - seq); + if (mayEncode < 0) _ASN_ENCODE_FAILED; + } + + while (mayEncode--) + { + void *memb_ptr = list->array[seq++]; + if (!memb_ptr) _ASN_ENCODE_FAILED; + er = elm->type->uper_encoder( + elm->type, elm->per_constraints, memb_ptr, po); + if (er.encoded == -1) _ASN_ENCODE_FAILED; + } + } _ASN_ENCODED_OK(er); } diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.c b/src/core/libs/supl/asn-supl/constr_SET_OF.c index b7c5a1342..d662e4ac8 100644 --- a/src/core/libs/supl/asn-supl/constr_SET_OF.c +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.c @@ -12,7 +12,7 @@ * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ -#define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) +#define LEFT ((size < (size_t)ctx->left) ? size : (size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants @@ -25,77 +25,93 @@ * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ -#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) +#define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - ptr = ((const char *)ptr) + num;\ - size -= num; \ - if(ctx->left >= 0) \ - ctx->left -= num; \ - consumed_myself += num; \ - } while(0) +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + ptr = ((const char *)ptr) + num; \ + size -= num; \ + if (ctx->left >= 0) ctx->left -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Switch to the next phase of parsing. */ -#undef NEXT_PHASE -#undef PHASE_OUT -#define NEXT_PHASE(ctx) do { \ - (ctx)->phase++; \ - (ctx)->step = 0; \ - } while(0) -#define PHASE_OUT(ctx) do { (ctx)->phase = 10; } while(0) +#undef NEXT_PHASE +#undef PHASE_OUT +#define NEXT_PHASE(ctx) \ + do \ + { \ + (ctx)->phase++; \ + (ctx)->step = 0; \ + } \ + while (0) +#define PHASE_OUT(ctx) \ + do \ + { \ + (ctx)->phase = 10; \ + } \ + while (0) /* * Return a standardized complex structure. */ -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself;\ - return rval; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + return rval; \ + } \ + while (0) /* * The decoder of the SET OF type. */ -asn_dec_rval_t -SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *ptr, size_t size, int tag_mode) { +asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *ptr, size_t size, int tag_mode) +{ /* * Bring closer parts of structure description. */ asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; - asn_TYPE_member_t *elm = td->elements; /* Single one */ + asn_TYPE_member_t *elm = td->elements; /* Single one */ /* * Parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - ber_tlv_tag_t tlv_tag; /* T from TLV */ - asn_dec_rval_t rval; /* Return code from subparsers */ + ber_tlv_tag_t tlv_tag; /* T from TLV */ + asn_dec_rval_t rval; /* Return code from subparsers */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as SET OF", td->name); /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) { - RETURN(RC_FAIL); + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) + { + RETURN(RC_FAIL); + } } - } /* * Restore parsing context. @@ -105,203 +121,239 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * Start to parse where left previously */ - switch(ctx->phase) { - case 0: - /* - * PHASE 0. - * Check that the set of tags associated with given structure - * perfectly fits our expectations. - */ - - rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, - tag_mode, 1, &ctx->left, 0); - if(rval.code != RC_OK) { - ASN_DEBUG("%s tagging check failed: %d", - td->name, rval.code); - return rval; - } - - if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Subtracted below! */ - ADVANCE(rval.consumed); - - ASN_DEBUG("Structure consumes %ld bytes, " - "buffer %ld", (long)ctx->left, (long)size); - - NEXT_PHASE(ctx); - /* Fall through */ - case 1: - /* - * PHASE 1. - * From the place where we've left it previously, - * try to decode the next item. - */ - for(;; ctx->step = 0) { - ssize_t tag_len; /* Length of TLV's T */ - - if(ctx->step & 1) - goto microphase2; - - /* - * MICROPHASE 1: Synchronize decoding. - */ - - if(ctx->left == 0) { - ASN_DEBUG("End of SET OF %s", td->name); - /* - * No more things to decode. - * Exit out of here. - */ - PHASE_OUT(ctx); - RETURN(RC_OK); - } - - /* - * Fetch the T from TLV. - */ - tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); - switch(tag_len) { - case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); - /* Fall through */ - case -1: RETURN(RC_FAIL); - } - - if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { - if(LEFT < 2) { - if(SIZE_VIOLATION) - RETURN(RC_FAIL); - else - RETURN(RC_WMORE); - } else if(((const uint8_t *)ptr)[1] == 0) { + switch (ctx->phase) + { + case 0: /* - * Found the terminator of the - * indefinite length structure. + * PHASE 0. + * Check that the set of tags associated with given structure + * perfectly fits our expectations. */ - break; - } - } - /* Outmost tag may be unknown and cannot be fetched/compared */ - if(elm->tag != (ber_tlv_tag_t)-1) { - if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { - /* - * The new list member of expected type has arrived. - */ - } else { - ASN_DEBUG("Unexpected tag %s fixed SET OF %s", - ber_tlv_tag_string(tlv_tag), td->name); - ASN_DEBUG("%s SET OF has tag %s", - td->name, ber_tlv_tag_string(elm->tag)); - RETURN(RC_FAIL); - } - } + rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, + tag_mode, 1, &ctx->left, 0); + if (rval.code != RC_OK) + { + ASN_DEBUG("%s tagging check failed: %d", td->name, + rval.code); + return rval; + } - /* - * MICROPHASE 2: Invoke the member-specific decoder. - */ - ctx->step |= 1; /* Confirm entering next microphase */ - microphase2: - - /* - * Invoke the member fetch routine according to member's type - */ - rval = elm->type->ber_decoder(opt_codec_ctx, - elm->type, &ctx->ptr, ptr, LEFT, 0); - ASN_DEBUG("In %s SET OF %s code %d consumed %d", - td->name, elm->type->name, - rval.code, (int)rval.consumed); - switch(rval.code) { - case RC_OK: - { - asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); - if(ASN_SET_ADD(list, ctx->ptr) != 0) - RETURN(RC_FAIL); - else - ctx->ptr = 0; - } - break; - case RC_WMORE: /* More data expected */ - if(!SIZE_VIOLATION) { + if (ctx->left >= 0) + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); - RETURN(RC_WMORE); - } - /* Fall through */ - case RC_FAIL: /* Fatal error */ - ASN_STRUCT_FREE(*elm->type, ctx->ptr); - ctx->ptr = 0; - RETURN(RC_FAIL); - } /* switch(rval) */ - ADVANCE(rval.consumed); - } /* for(all list members) */ + ASN_DEBUG( + "Structure consumes %ld bytes, " + "buffer %ld", + (long)ctx->left, (long)size); - NEXT_PHASE(ctx); - case 2: - /* - * Read in all "end of content" TLVs. - */ - while(ctx->left < 0) { - if(LEFT < 2) { - if(LEFT > 0 && ((const char *)ptr)[0] != 0) { - /* Unexpected tag */ - RETURN(RC_FAIL); - } else { - RETURN(RC_WMORE); - } - } - if(((const char *)ptr)[0] == 0 - && ((const char *)ptr)[1] == 0) { - ADVANCE(2); - ctx->left++; - } else { - RETURN(RC_FAIL); - } + NEXT_PHASE(ctx); + /* Fall through */ + case 1: + /* + * PHASE 1. + * From the place where we've left it previously, + * try to decode the next item. + */ + for (;; ctx->step = 0) + { + ssize_t tag_len; /* Length of TLV's T */ + + if (ctx->step & 1) goto microphase2; + + /* + * MICROPHASE 1: Synchronize decoding. + */ + + if (ctx->left == 0) + { + ASN_DEBUG("End of SET OF %s", td->name); + /* + * No more things to decode. + * Exit out of here. + */ + PHASE_OUT(ctx); + RETURN(RC_OK); + } + + /* + * Fetch the T from TLV. + */ + tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); + switch (tag_len) + { + case 0: + if (!SIZE_VIOLATION) RETURN(RC_WMORE); + /* Fall through */ + case -1: + RETURN(RC_FAIL); + } + + if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) + { + if (LEFT < 2) + { + if (SIZE_VIOLATION) + RETURN(RC_FAIL); + else + RETURN(RC_WMORE); + } + else if (((const uint8_t *)ptr)[1] == 0) + { + /* + * Found the terminator of the + * indefinite length structure. + */ + break; + } + } + + /* Outmost tag may be unknown and cannot be + * fetched/compared */ + if (elm->tag != (ber_tlv_tag_t)-1) + { + if (BER_TAGS_EQUAL(tlv_tag, elm->tag)) + { + /* + * The new list member of expected type + * has arrived. + */ + } + else + { + ASN_DEBUG( + "Unexpected tag %s fixed SET OF %s", + ber_tlv_tag_string(tlv_tag), + td->name); + ASN_DEBUG("%s SET OF has tag %s", + td->name, + ber_tlv_tag_string(elm->tag)); + RETURN(RC_FAIL); + } + } + + /* + * MICROPHASE 2: Invoke the member-specific decoder. + */ + ctx->step |= 1; /* Confirm entering next microphase */ + microphase2: + + /* + * Invoke the member fetch routine according to member's + * type + */ + rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, + &ctx->ptr, ptr, LEFT, 0); + ASN_DEBUG("In %s SET OF %s code %d consumed %d", + td->name, elm->type->name, rval.code, + (int)rval.consumed); + switch (rval.code) + { + case RC_OK: + { + asn_anonymous_set_ *list = + _A_SET_FROM_VOID(st); + if (ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + else + ctx->ptr = 0; + } + break; + case RC_WMORE: /* More data expected */ + if (!SIZE_VIOLATION) + { + ADVANCE(rval.consumed); + RETURN(RC_WMORE); + } + /* Fall through */ + case RC_FAIL: /* Fatal error */ + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + RETURN(RC_FAIL); + } /* switch(rval) */ + + ADVANCE(rval.consumed); + } /* for(all list members) */ + + NEXT_PHASE(ctx); + case 2: + /* + * Read in all "end of content" TLVs. + */ + while (ctx->left < 0) + { + if (LEFT < 2) + { + if (LEFT > 0 && ((const char *)ptr)[0] != 0) + { + /* Unexpected tag */ + RETURN(RC_FAIL); + } + else + { + RETURN(RC_WMORE); + } + } + if (((const char *)ptr)[0] == 0 && + ((const char *)ptr)[1] == 0) + { + ADVANCE(2); + ctx->left++; + } + else + { + RETURN(RC_FAIL); + } + } + + PHASE_OUT(ctx); } - PHASE_OUT(ctx); - } - RETURN(RC_OK); } /* * Internally visible buffer holding a single encoded element. */ -struct _el_buffer { +struct _el_buffer +{ uint8_t *buf; size_t length; size_t size; }; /* Append bytes to the above structure */ -static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { +static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) +{ struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; - if(el_buf->length + size > el_buf->size) - return -1; + if (el_buf->length + size > el_buf->size) return -1; memcpy(el_buf->buf + el_buf->length, buffer, size); el_buf->length += size; return 0; } -static int _el_buf_cmp(const void *ap, const void *bp) { +static int _el_buf_cmp(const void *ap, const void *bp) +{ const struct _el_buffer *a = (const struct _el_buffer *)ap; const struct _el_buffer *b = (const struct _el_buffer *)bp; int ret; size_t common_len; - if(a->length < b->length) + if (a->length < b->length) common_len = a->length; else common_len = b->length; ret = memcmp(a->buf, b->buf, common_len); - if(ret == 0) { - if(a->length < b->length) - ret = -1; - else if(a->length > b->length) - ret = 1; - } + if (ret == 0) + { + if (a->length < b->length) + ret = -1; + else if (a->length > b->length) + ret = 1; + } return ret; } @@ -309,10 +361,10 @@ static int _el_buf_cmp(const void *ap, const void *bp) { /* * The DER encoder of the SET OF type. */ -asn_enc_rval_t -SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, - int tag_mode, ber_tlv_tag_t tag, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, + int tag_mode, ber_tlv_tag_t tag, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_TYPE_descriptor_t *elm_type = elm->type; der_type_encoder_f *der_encoder = elm_type->der_encoder; @@ -331,93 +383,99 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, /* * Gather the length of the underlying members sequence. */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - if(!memb_ptr) continue; - erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); - if(erval.encoded == -1) - return erval; - computed_size += erval.encoded; + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + if (!memb_ptr) continue; + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); + if (erval.encoded == -1) return erval; + computed_size += erval.encoded; - /* Compute maximum encoding's size */ - if(max_encoded_len < (size_t)erval.encoded) - max_encoded_len = erval.encoded; - } + /* Compute maximum encoding's size */ + if (max_encoded_len < (size_t)erval.encoded) + max_encoded_len = erval.encoded; + } /* * Encode the TLV for the sequence itself. */ - encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, - cb, app_key); - if(encoding_size == -1) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } + encoding_size = + der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); + if (encoding_size == -1) + { + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } computed_size += encoding_size; - if(!cb || list->count == 0) { - erval.encoded = computed_size; - _ASN_ENCODED_OK(erval); - } + if (!cb || list->count == 0) + { + erval.encoded = computed_size; + _ASN_ENCODED_OK(erval); + } /* * DER mandates dynamic sorting of the SET OF elements * according to their encodings. Build an array of the * encoded elements. */ - encoded_els = (struct _el_buffer *)MALLOC( - list->count * sizeof(encoded_els[0])); - if(encoded_els == NULL) { - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - return erval; - } - - ASN_DEBUG("Encoding members of %s SET OF", td->name); - - /* - * Encode all members. - */ - for(edx = 0; edx < list->count; edx++) { - void *memb_ptr = list->array[edx]; - struct _el_buffer *encoded_el = &encoded_els[eels_count]; - - if(!memb_ptr) continue; - - /* - * Prepare space for encoding. - */ - encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); - if(encoded_el->buf) { - encoded_el->length = 0; - encoded_el->size = max_encoded_len; - } else { - for(edx--; edx >= 0; edx--) - FREEMEM(encoded_els[edx].buf); - FREEMEM(encoded_els); + encoded_els = + (struct _el_buffer *)MALLOC(list->count * sizeof(encoded_els[0])); + if (encoded_els == NULL) + { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } - /* - * Encode the member into the prepared space. - */ - erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, - _el_addbytes, encoded_el); - if(erval.encoded == -1) { - for(; edx >= 0; edx--) - FREEMEM(encoded_els[edx].buf); - FREEMEM(encoded_els); - return erval; + ASN_DEBUG("Encoding members of %s SET OF", td->name); + + /* + * Encode all members. + */ + for (edx = 0; edx < list->count; edx++) + { + void *memb_ptr = list->array[edx]; + struct _el_buffer *encoded_el = &encoded_els[eels_count]; + + if (!memb_ptr) continue; + + /* + * Prepare space for encoding. + */ + encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); + if (encoded_el->buf) + { + encoded_el->length = 0; + encoded_el->size = max_encoded_len; + } + else + { + for (edx--; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + return erval; + } + + /* + * Encode the member into the prepared space. + */ + erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, _el_addbytes, + encoded_el); + if (erval.encoded == -1) + { + for (; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); + FREEMEM(encoded_els); + return erval; + } + encoding_size += erval.encoded; + eels_count++; } - encoding_size += erval.encoded; - eels_count++; - } /* * Sort the encoded elements according to their encoding. @@ -429,46 +487,54 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, * Dispose of temporary sorted members table. */ ret = 0; - for(edx = 0; edx < eels_count; edx++) { - struct _el_buffer *encoded_el = &encoded_els[edx]; - /* Report encoded chunks to the application */ - if(ret == 0 - && cb(encoded_el->buf, encoded_el->length, app_key) < 0) - ret = -1; - FREEMEM(encoded_el->buf); - } + for (edx = 0; edx < eels_count; edx++) + { + struct _el_buffer *encoded_el = &encoded_els[edx]; + /* Report encoded chunks to the application */ + if (ret == 0 && + cb(encoded_el->buf, encoded_el->length, app_key) < 0) + ret = -1; + FREEMEM(encoded_el->buf); + } FREEMEM(encoded_els); - if(ret || computed_size != (size_t)encoding_size) { - /* - * Standard callback failed, or - * encoded size is not equal to the computed size. - */ - erval.encoded = -1; - erval.failed_type = td; - erval.structure_ptr = ptr; - } else { - erval.encoded = computed_size; - } + if (ret || computed_size != (size_t)encoding_size) + { + /* + * Standard callback failed, or + * encoded size is not equal to the computed size. + */ + erval.encoded = -1; + erval.failed_type = td; + erval.structure_ptr = ptr; + } + else + { + erval.encoded = computed_size; + } _ASN_ENCODED_OK(erval); } -#undef XER_ADVANCE -#define XER_ADVANCE(num_bytes) do { \ - size_t num = num_bytes; \ - buf_ptr = ((const char *)buf_ptr) + num;\ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef XER_ADVANCE +#define XER_ADVANCE(num_bytes) \ + do \ + { \ + size_t num = num_bytes; \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) /* * Decode the XER (XML) data. */ -asn_dec_rval_t -SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const char *opt_mname, - const void *buf_ptr, size_t size) { +asn_dec_rval_t SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const char *opt_mname, const void *buf_ptr, + size_t size) +{ /* * Bring closer parts of structure description. */ @@ -480,27 +546,30 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * ... and parts of the structure being constructed. */ - void *st = *struct_ptr; /* Target structure. */ - asn_struct_ctx_t *ctx; /* Decoder context */ + void *st = *struct_ptr; /* Target structure. */ + asn_struct_ctx_t *ctx; /* Decoder context */ - asn_dec_rval_t rval; /* Return value from a decoder */ - ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ + asn_dec_rval_t rval; /* Return value from a decoder */ + ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ /* * Create the target structure if it is not present already. */ - if(st == 0) { - st = *struct_ptr = CALLOC(1, specs->struct_size); - if(st == 0) RETURN(RC_FAIL); - } + if (st == 0) + { + st = *struct_ptr = CALLOC(1, specs->struct_size); + if (st == 0) RETURN(RC_FAIL); + } /* Which tag is expected for the downstream */ - if(specs->as_XMLValueList) { - elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; - } else { - elm_tag = (*element->name) - ? element->name : element->type->xml_tag; - } + if (specs->as_XMLValueList) + { + elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; + } + else + { + elm_tag = (*element->name) ? element->name : element->type->xml_tag; + } /* * Restore parsing context. @@ -513,152 +582,163 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. */ - for(; ctx->phase <= 2;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ + for (; ctx->phase <= 2;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ - /* - * Go inside the inner member of a set. - */ - if(ctx->phase == 2) { - asn_dec_rval_t tmprval; + /* + * Go inside the inner member of a set. + */ + if (ctx->phase == 2) + { + asn_dec_rval_t tmprval; - /* Invoke the inner type decoder, m.b. multiple times */ - ASN_DEBUG("XER/SET OF element [%s]", elm_tag); - tmprval = element->type->xer_decoder(opt_codec_ctx, - element->type, &ctx->ptr, elm_tag, - buf_ptr, size); - if(tmprval.code == RC_OK) { - asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); - if(ASN_SET_ADD(list, ctx->ptr) != 0) - RETURN(RC_FAIL); - ctx->ptr = 0; - XER_ADVANCE(tmprval.consumed); - } else { - XER_ADVANCE(tmprval.consumed); - RETURN(tmprval.code); - } - ctx->phase = 1; /* Back to body processing */ - ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); - /* Fall through */ - } + /* Invoke the inner type decoder, m.b. multiple times */ + ASN_DEBUG("XER/SET OF element [%s]", elm_tag); + tmprval = element->type->xer_decoder( + opt_codec_ctx, element->type, &ctx->ptr, elm_tag, + buf_ptr, size); + if (tmprval.code == RC_OK) + { + asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); + if (ASN_SET_ADD(list, ctx->ptr) != 0) + RETURN(RC_FAIL); + ctx->ptr = 0; + XER_ADVANCE(tmprval.consumed); + } + else + { + XER_ADVANCE(tmprval.consumed); + RETURN(tmprval.code); + } + ctx->phase = 1; /* Back to body processing */ + ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); + /* Fall through */ + } - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, - buf_ptr, size, &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - case PXER_TEXT: /* Ignore free-standing text */ - XER_ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } + /* + * Get the next part of the XML stream. + */ + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + case PXER_TEXT: /* Ignore free-standing text */ + XER_ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } + } - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", - tcv, ctx->phase, xml_tag); - switch(tcv) { - case XCT_CLOSING: - if(ctx->phase == 0) break; - ctx->phase = 0; - /* Fall through */ - case XCT_BOTH: - if(ctx->phase == 0) { - /* No more things to decode */ - XER_ADVANCE(ch_size); - ctx->phase = 3; /* Phase out */ - RETURN(RC_OK); - } - /* Fall through */ - case XCT_OPENING: - if(ctx->phase == 0) { - XER_ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - } - /* Fall through */ - case XCT_UNKNOWN_OP: - case XCT_UNKNOWN_BO: + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", tcv, ctx->phase, + xml_tag); + switch (tcv) + { + case XCT_CLOSING: + if (ctx->phase == 0) break; + ctx->phase = 0; + /* Fall through */ + case XCT_BOTH: + if (ctx->phase == 0) + { + /* No more things to decode */ + XER_ADVANCE(ch_size); + ctx->phase = 3; /* Phase out */ + RETURN(RC_OK); + } + /* Fall through */ + case XCT_OPENING: + if (ctx->phase == 0) + { + XER_ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + } + /* Fall through */ + case XCT_UNKNOWN_OP: + case XCT_UNKNOWN_BO: - ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); - if(ctx->phase == 1) { - /* - * Process a single possible member. - */ - ctx->phase = 2; - continue; - } - /* Fall through */ - default: + ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); + if (ctx->phase == 1) + { + /* + * Process a single possible member. + */ + ctx->phase = 2; + continue; + } + /* Fall through */ + default: + break; + } + + ASN_DEBUG("Unexpected XML tag in SET OF"); break; } - ASN_DEBUG("Unexpected XML tag in SET OF"); - break; - } - - ctx->phase = 3; /* "Phase out" on hard failure */ + ctx->phase = 3; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } - - -typedef struct xer_tmp_enc_s { +typedef struct xer_tmp_enc_s +{ void *buffer; size_t offset; size_t size; } xer_tmp_enc_t; -static int -SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { +static int SET_OF_encode_xer_callback(const void *buffer, size_t size, + void *key) +{ xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; - if(t->offset + size >= t->size) { - size_t newsize = (t->size << 2) + size; - void *p = REALLOC(t->buffer, newsize); - if(!p) return -1; - t->buffer = p; - t->size = newsize; - } + if (t->offset + size >= t->size) + { + size_t newsize = (t->size << 2) + size; + void *p = REALLOC(t->buffer, newsize); + if (!p) return -1; + t->buffer = p; + t->size = newsize; + } memcpy((char *)t->buffer + t->offset, buffer, size); t->offset += size; return 0; } -static int -SET_OF_xer_order(const void *aptr, const void *bptr) { +static int SET_OF_xer_order(const void *aptr, const void *bptr) +{ const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; size_t minlen = a->offset; int ret; - if(b->offset < minlen) minlen = b->offset; + if (b->offset < minlen) minlen = b->offset; /* Well-formed UTF-8 has this nice lexicographical property... */ ret = memcmp(a->buffer, b->buffer, minlen); - if(ret != 0) return ret; - if(a->offset == b->offset) - return 0; - if(a->offset == minlen) - return -1; + if (ret != 0) return ret; + if (a->offset == b->offset) return 0; + if (a->offset == minlen) return -1; return 1; } - -asn_enc_rval_t -SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, - int ilevel, enum xer_encoder_flags_e flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, + int ilevel, enum xer_encoder_flags_e flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList - ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); + ? 0 + : ((*elm->name) ? elm->name : elm->type->xml_tag); size_t mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); xer_tmp_enc_t *encs = 0; @@ -667,118 +747,130 @@ SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *original_cb = cb; int i; - if(!sptr) _ASN_ENCODE_FAILED; + if (!sptr) _ASN_ENCODE_FAILED; - if(xcan) { - encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); - if(!encs) _ASN_ENCODE_FAILED; - cb = SET_OF_encode_xer_callback; - } + if (xcan) + { + encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); + if (!encs) _ASN_ENCODE_FAILED; + cb = SET_OF_encode_xer_callback; + } er.encoded = 0; - for(i = 0; i < list->count; i++) { - asn_enc_rval_t tmper; + for (i = 0; i < list->count; i++) + { + asn_enc_rval_t tmper; - void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - if(encs) { - memset(&encs[encs_count], 0, sizeof(encs[0])); - app_key = &encs[encs_count]; - encs_count++; - } + if (encs) + { + memset(&encs[encs_count], 0, sizeof(encs[0])); + app_key = &encs[encs_count]; + encs_count++; + } - if(mname) { - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); - _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); - } + if (mname) + { + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel); + _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); + } - if(!xcan && specs->as_XMLValueList == 1) - _i_ASN_TEXT_INDENT(1, ilevel + 1); - tmper = elm->type->xer_encoder(elm->type, memb_ptr, - ilevel + (specs->as_XMLValueList != 2), + if (!xcan && specs->as_XMLValueList == 1) + _i_ASN_TEXT_INDENT(1, ilevel + 1); + tmper = elm->type->xer_encoder( + elm->type, memb_ptr, ilevel + (specs->as_XMLValueList != 2), flags, cb, app_key); - if(tmper.encoded == -1) { - td = tmper.failed_type; - sptr = tmper.structure_ptr; - goto cb_failed; - } - if(tmper.encoded == 0 && specs->as_XMLValueList) { - const char *name = elm->type->xml_tag; - size_t len = strlen(name); - _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + if (tmper.encoded == -1) + { + td = tmper.failed_type; + sptr = tmper.structure_ptr; + goto cb_failed; + } + if (tmper.encoded == 0 && specs->as_XMLValueList) + { + const char *name = elm->type->xml_tag; + size_t len = strlen(name); + _ASN_CALLBACK3("<", 1, name, len, "/>", 2); + } + + if (mname) + { + _ASN_CALLBACK3("", 1); + er.encoded += 5; + } + + er.encoded += (2 * mlen) + tmper.encoded; } - if(mname) { - _ASN_CALLBACK3("", 1); - er.encoded += 5; + if (!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); + + if (encs) + { + xer_tmp_enc_t *enc = encs; + xer_tmp_enc_t *end = encs + encs_count; + ssize_t control_size = 0; + + cb = original_cb; + app_key = original_app_key; + qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); + + for (; enc < end; enc++) + { + _ASN_CALLBACK(enc->buffer, enc->offset); + FREEMEM(enc->buffer); + enc->buffer = 0; + control_size += enc->offset; + } + assert(control_size == er.encoded); } - er.encoded += (2 * mlen) + tmper.encoded; - } - - if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1); - - if(encs) { - xer_tmp_enc_t *enc = encs; - xer_tmp_enc_t *end = encs + encs_count; - ssize_t control_size = 0; - - cb = original_cb; - app_key = original_app_key; - qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); - - for(; enc < end; enc++) { - _ASN_CALLBACK(enc->buffer, enc->offset); - FREEMEM(enc->buffer); - enc->buffer = 0; - control_size += enc->offset; - } - assert(control_size == er.encoded); - } - goto cleanup; cb_failed: er.encoded = -1; er.failed_type = td; er.structure_ptr = sptr; cleanup: - if(encs) { - while(encs_count-- > 0) { - if(encs[encs_count].buffer) - FREEMEM(encs[encs_count].buffer); + if (encs) + { + while (encs_count-- > 0) + { + if (encs[encs_count].buffer) + FREEMEM(encs[encs_count].buffer); + } + FREEMEM(encs); } - FREEMEM(encs); - } _ASN_ENCODED_OK(er); } -int -SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, - asn_app_consume_bytes_f *cb, void *app_key) { +int SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int ret; int i; - if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; + if (!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ - if(cb(td->name, strlen(td->name), app_key) < 0 - || cb(" ::= {", 6, app_key) < 0) + if (cb(td->name, strlen(td->name), app_key) < 0 || + cb(" ::= {", 6, app_key) < 0) return -1; - for(i = 0; i < list->count; i++) { - const void *memb_ptr = list->array[i]; - if(!memb_ptr) continue; + for (i = 0; i < list->count; i++) + { + const void *memb_ptr = list->array[i]; + if (!memb_ptr) continue; - _i_INDENT(1); + _i_INDENT(1); - ret = elm->type->print_struct(elm->type, memb_ptr, - ilevel + 1, cb, app_key); - if(ret) return ret; - } + ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, + app_key); + if (ret) return ret; + } ilevel--; _i_INDENT(1); @@ -786,163 +878,183 @@ SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, return (cb("}", 1, app_key) < 0) ? -1 : 0; } -void -SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { - if(td && ptr) { - asn_SET_OF_specifics_t *specs; - asn_TYPE_member_t *elm = td->elements; - asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); - asn_struct_ctx_t *ctx; /* Decoder context */ - int i; +void SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) +{ + if (td && ptr) + { + asn_SET_OF_specifics_t *specs; + asn_TYPE_member_t *elm = td->elements; + asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); + asn_struct_ctx_t *ctx; /* Decoder context */ + int i; - /* - * Could not use set_of_empty() because of (*free) - * incompatibility. - */ - for(i = 0; i < list->count; i++) { - void *memb_ptr = list->array[i]; - if(memb_ptr) - ASN_STRUCT_FREE(*elm->type, memb_ptr); + /* + * Could not use set_of_empty() because of (*free) + * incompatibility. + */ + for (i = 0; i < list->count; i++) + { + void *memb_ptr = list->array[i]; + if (memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); + } + list->count = 0; /* No meaningful elements left */ + + asn_set_empty(list); /* Remove (list->array) */ + + specs = (asn_SET_OF_specifics_t *)td->specifics; + ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); + if (ctx->ptr) + { + ASN_STRUCT_FREE(*elm->type, ctx->ptr); + ctx->ptr = 0; + } + + if (!contents_only) + { + FREEMEM(ptr); + } } - list->count = 0; /* No meaningful elements left */ - - asn_set_empty(list); /* Remove (list->array) */ - - specs = (asn_SET_OF_specifics_t *)td->specifics; - ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); - if(ctx->ptr) { - ASN_STRUCT_FREE(*elm->type, ctx->ptr); - ctx->ptr = 0; - } - - if(!contents_only) { - FREEMEM(ptr); - } - } } -int -SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, - asn_app_constraint_failed_f *ctfailcb, void *app_key) { +int SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, + asn_app_constraint_failed_f *ctfailcb, void *app_key) +{ asn_TYPE_member_t *elm = td->elements; asn_constr_check_f *constr; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int i; - if(!sptr) { - _ASN_CTFAIL(app_key, td, sptr, - "%s: value not given (%s:%d)", - td->name, __FILE__, __LINE__); - return -1; - } + if (!sptr) + { + _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); + return -1; + } constr = elm->memb_constraints; - if(!constr) constr = elm->type->check_constraints; + if (!constr) constr = elm->type->check_constraints; /* * Iterate over the members of an array. * Validate each in turn, until one fails. */ - for(i = 0; i < list->count; i++) { - const void *memb_ptr = list->array[i]; - int ret; + for (i = 0; i < list->count; i++) + { + const void *memb_ptr = list->array[i]; + int ret; - if(!memb_ptr) continue; + if (!memb_ptr) continue; - ret = constr(elm->type, memb_ptr, ctfailcb, app_key); - if(ret) return ret; - } + ret = constr(elm->type, memb_ptr, ctfailcb, app_key); + if (ret) return ret; + } /* * Cannot inherit it eralier: * need to make sure we get the updated version. */ - if(!elm->memb_constraints) + if (!elm->memb_constraints) elm->memb_constraints = elm->type->check_constraints; return 0; } -asn_dec_rval_t -SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +asn_dec_rval_t SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) +{ asn_dec_rval_t rv; - asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; - asn_TYPE_member_t *elm = td->elements; /* Single one */ + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ void *st = *sptr; asn_anonymous_set_ *list; asn_per_constraint_t *ct; int repeat = 0; ssize_t nelems; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) - _ASN_DECODE_FAILED; + if (_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) _ASN_DECODE_FAILED; /* * Create the target structure if it is not present already. */ - if(!st) { - st = *sptr = CALLOC(1, specs->struct_size); - if(!st) _ASN_DECODE_FAILED; - } + if (!st) + { + st = *sptr = CALLOC(1, specs->struct_size); + if (!st) _ASN_DECODE_FAILED; + } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ - if(constraints) ct = &constraints->size; - else if(td->per_constraints) ct = &td->per_constraints->size; - else ct = 0; + if (constraints) + ct = &constraints->size; + else if (td->per_constraints) + ct = &td->per_constraints->size; + else + ct = 0; - if(ct && ct->flags & APC_EXTENSIBLE) { - int value = per_get_few_bits(pd, 1); - if(value < 0) _ASN_DECODE_STARVED; - if(value) ct = 0; /* Not restricted! */ - } - - if(ct && ct->effective_bits >= 0) { - /* X.691, #19.5: No length determinant */ - nelems = per_get_few_bits(pd, ct->effective_bits); - ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", - (long)nelems, ct->lower_bound, td->name); - if(nelems < 0) _ASN_DECODE_STARVED; - nelems += ct->lower_bound; - } else { - nelems = -1; - } - - do { - int i; - if(nelems < 0) { - nelems = uper_get_length(pd, - ct ? ct->effective_bits : -1, &repeat); - ASN_DEBUG("Got to decode %d elements (eff %d)", - (int)nelems, (long)ct ? ct->effective_bits : -1); - if(nelems < 0) _ASN_DECODE_STARVED; + if (ct && ct->flags & APC_EXTENSIBLE) + { + int value = per_get_few_bits(pd, 1); + if (value < 0) _ASN_DECODE_STARVED; + if (value) ct = 0; /* Not restricted! */ } - for(ssize_t k = 0; k < nelems; k++) { - void *ptr = 0; - ASN_DEBUG("SET OF %s decoding", elm->type->name); - rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, - elm->per_constraints, &ptr, pd); - ASN_DEBUG("%s SET OF %s decoded %d, %p", - td->name, elm->type->name, rv.code, ptr); - if(rv.code == RC_OK) { - if(ASN_SET_ADD(list, ptr) == 0) - continue; - ASN_DEBUG("Failed to add element into %s", - td->name); - /* Fall through */ - rv.code = RC_FAIL; - } else { - ASN_DEBUG("Failed decoding %s of %s (SET OF)", - elm->type->name, td->name); - } - if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); - return rv; + if (ct && ct->effective_bits >= 0) + { + /* X.691, #19.5: No length determinant */ + nelems = per_get_few_bits(pd, ct->effective_bits); + ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if (nelems < 0) _ASN_DECODE_STARVED; + nelems += ct->lower_bound; + } + else + { + nelems = -1; } - nelems = -1; /* Allow uper_get_length() */ - } while(repeat); + do + { + int i; + if (nelems < 0) + { + nelems = uper_get_length(pd, ct ? ct->effective_bits : -1, + &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", (int)nelems, + (long)ct ? ct->effective_bits : -1); + if (nelems < 0) _ASN_DECODE_STARVED; + } + + for (ssize_t k = 0; k < nelems; k++) + { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = + elm->type->uper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", td->name, + elm->type->name, rv.code, ptr); + if (rv.code == RC_OK) + { + if (ASN_SET_ADD(list, ptr) == 0) continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } + else + { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if (ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } + while (repeat); ASN_DEBUG("Decoded %s as SET OF", td->name); diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.h b/src/core/libs/supl/asn-supl/constr_SET_OF.h index 202afab57..2b9d3a020 100644 --- a/src/core/libs/supl/asn-supl/constr_SET_OF.h +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.h @@ -15,8 +15,8 @@ extern "C" typedef struct asn_SET_OF_specifics_s { /* - * Target structure description. - */ + * Target structure description. + */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ @@ -25,8 +25,8 @@ extern "C" } asn_SET_OF_specifics_t; /* - * A set specialized functions dealing with the SET OF type. - */ + * A set specialized functions dealing with the SET OF type. + */ asn_struct_free_f SET_OF_free; asn_struct_print_f SET_OF_print; asn_constr_check_f SET_OF_constraint; diff --git a/src/core/libs/supl/asn-supl/constr_TYPE.c b/src/core/libs/supl/asn-supl/constr_TYPE.c index 4102276b9..05c70989d 100644 --- a/src/core/libs/supl/asn-supl/constr_TYPE.c +++ b/src/core/libs/supl/asn-supl/constr_TYPE.c @@ -16,15 +16,13 @@ static asn_app_consume_bytes_f _print2fp; /* * Return the outmost tag of the type. */ -ber_tlv_tag_t -asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { +ber_tlv_tag_t asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, int tag_mode, + ber_tlv_tag_t tag) +{ + if (tag_mode) return tag; - if(tag_mode) - return tag; - - if(type_descriptor->tags_count) - return type_descriptor->tags[0]; + if (type_descriptor->tags_count) return type_descriptor->tags[0]; return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); } @@ -32,43 +30,41 @@ asn_TYPE_outmost_tag(asn_TYPE_descriptor_t *type_descriptor, /* * Print the target language's structure in human readable form. */ -int -asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) { - if(!stream) stream = stdout; - if(!td || !struct_ptr) { - errno = EINVAL; - return -1; - } +int asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) +{ + if (!stream) stream = stdout; + if (!td || !struct_ptr) + { + errno = EINVAL; + return -1; + } /* Invoke type-specific printer */ - if(td->print_struct(td, struct_ptr, 1, _print2fp, stream)) - return -1; + if (td->print_struct(td, struct_ptr, 1, _print2fp, stream)) return -1; /* Terminate the output */ - if(_print2fp("\n", 1, stream)) - return -1; + if (_print2fp("\n", 1, stream)) return -1; return fflush(stream); } /* Dump the data into the specified stdio stream */ -static int -_print2fp(const void *buffer, size_t size, void *app_key) { +static int _print2fp(const void *buffer, size_t size, void *app_key) +{ FILE *stream = (FILE *)app_key; - if(fwrite(buffer, 1, size, stream) != size) - return -1; + if (fwrite(buffer, 1, size, stream) != size) return -1; return 0; } - /* * Some compilers do not support variable args macros. * This function is a replacement of ASN_DEBUG() macro. */ void ASN_DEBUG_f(const char *fmt, ...); -void ASN_DEBUG_f(const char *fmt, ...) { +void ASN_DEBUG_f(const char *fmt, ...) +{ va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); diff --git a/src/core/libs/supl/asn-supl/constr_TYPE.h b/src/core/libs/supl/asn-supl/constr_TYPE.h index e920d3d6e..3af569530 100644 --- a/src/core/libs/supl/asn-supl/constr_TYPE.h +++ b/src/core/libs/supl/asn-supl/constr_TYPE.h @@ -24,10 +24,11 @@ extern "C" struct asn_TYPE_member_s; /* Forward declaration */ /* - * This type provides the context information for various ASN.1 routines, - * primarily ones doing decoding. A member _asn_ctx of this type must be - * included into certain target language's structures, such as compound types. - */ + * This type provides the context information for various ASN.1 routines, + * primarily ones doing decoding. A member _asn_ctx of this type must be + * included into certain target language's structures, such as compound + * types. + */ typedef struct asn_struct_ctx_s { short phase; /* Decoding phase */ @@ -46,53 +47,51 @@ extern "C" #include /* Subtype constraints support */ /* - * Free the structure according to its specification. - * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) - * will not be freed. (It may be useful in case the structure is allocated - * statically or arranged on the stack, yet its elements are allocated - * dynamically.) - */ + * Free the structure according to its specification. + * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) + * will not be freed. (It may be useful in case the structure is allocated + * statically or arranged on the stack, yet its elements are allocated + * dynamically.) + */ typedef void(asn_struct_free_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - void *struct_ptr, int free_contents_only); + struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, + int free_contents_only); #define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF), ptr, 0) #define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ (asn_DEF).free_struct(&(asn_DEF), ptr, 1) /* - * Print the structure according to its specification. - */ + * Print the structure according to its specification. + */ typedef int(asn_struct_print_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, /* Indentation level */ asn_app_consume_bytes_f *callback, void *app_key); /* - * Return the outmost tag of the type. - * If the type is untagged CHOICE, the dynamic operation is performed. - * NOTE: This function pointer type is only useful internally. - * Do not use it in your application. - */ + * Return the outmost tag of the type. + * If the type is untagged CHOICE, the dynamic operation is performed. + * NOTE: This function pointer type is only useful internally. + * Do not use it in your application. + */ typedef ber_tlv_tag_t(asn_outmost_tag_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, + int tag_mode, ber_tlv_tag_t tag); /* The instance of the above function type; used internally. */ asn_outmost_tag_f asn_TYPE_outmost_tag; - /* - * The definitive description of the destination language's structure. - */ + * The definitive description of the destination language's structure. + */ typedef struct asn_TYPE_descriptor_s { char *name; /* A name of the ASN.1 type. "" in some cases. */ char *xml_tag; /* Name used in XML tag */ /* - * Generalized functions for dealing with the specific type. - * May be directly invoked by applications. - */ + * Generalized functions for dealing with the specific type. + * May be directly invoked by applications. + */ asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_constr_check_f *check_constraints; /* Constraints validator */ @@ -104,37 +103,37 @@ extern "C" per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ /*********************************************************************** - * Internally useful members. Not to be used by applications directly. * - **********************************************************************/ + * Internally useful members. Not to be used by applications directly. * + **********************************************************************/ /* - * Tags that are expected to occur. - */ + * Tags that are expected to occur. + */ asn_outmost_tag_f *outmost_tag; /* */ - ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ - int tags_count; /* Number of tags which are expected */ - ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ - int all_tags_count; /* Number of tags */ + ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ + int tags_count; /* Number of tags which are expected */ + ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ + int all_tags_count; /* Number of tags */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ /* - * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). - */ + * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). + */ struct asn_TYPE_member_s *elements; int elements_count; /* - * Additional information describing the type, used by appropriate - * functions above. - */ + * Additional information describing the type, used by appropriate + * functions above. + */ void *specifics; } asn_TYPE_descriptor_t; /* - * This type describes an element of the constructed type, - * i.e. SEQUENCE, SET, CHOICE, etc. - */ + * This type describes an element of the constructed type, + * i.e. SEQUENCE, SET, CHOICE, etc. + */ enum asn_TYPE_flags_e { ATF_NOFLAGS, @@ -143,21 +142,21 @@ extern "C" }; typedef struct asn_TYPE_member_s { - enum asn_TYPE_flags_e flags; /* Element's presentation flags */ - int optional; /* Following optional members, including current */ - int memb_offset; /* Offset of the element */ - ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ - int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ - asn_TYPE_descriptor_t *type; /* Member type descriptor */ - asn_constr_check_f *memb_constraints; /* Constraints validator */ - asn_per_constraints_t *per_constraints; /* PER compiled constraints */ + enum asn_TYPE_flags_e flags; /* Element's presentation flags */ + int optional; /* Following optional members, including current */ + int memb_offset; /* Offset of the element */ + ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ + int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_constr_check_f *memb_constraints; /* Constraints validator */ + asn_per_constraints_t *per_constraints; /* PER compiled constraints */ int (*default_value)(int setval, void **sptr); /* DEFAULT */ - char *name; /* ASN.1 identifier of the element */ + char *name; /* ASN.1 identifier of the element */ } asn_TYPE_member_t; /* - * BER tag to element number mapping. - */ + * BER tag to element number mapping. + */ typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ @@ -167,17 +166,17 @@ extern "C" } asn_TYPE_tag2member_t; /* - * This function is a wrapper around (td)->print_struct, which prints out - * the contents of the target language's structure (struct_ptr) into the - * file pointer (stream) in human readable form. - * RETURN VALUES: - * 0: The structure is printed. - * -1: Problem dumping the structure. - * (See also xer_fprint() in xer_encoder.h) - */ - int asn_fprint(FILE *stream, /* Destination stream descriptor */ - asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ - const void *struct_ptr); /* Structure to be printed */ + * This function is a wrapper around (td)->print_struct, which prints out + * the contents of the target language's structure (struct_ptr) into the + * file pointer (stream) in human readable form. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem dumping the structure. + * (See also xer_fprint() in xer_encoder.h) + */ + int asn_fprint(FILE *stream, /* Destination stream descriptor */ + asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ + const void *struct_ptr); /* Structure to be printed */ #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/constraints.c b/src/core/libs/supl/asn-supl/constraints.c index 20dca37a7..ba03304f1 100644 --- a/src/core/libs/supl/asn-supl/constraints.c +++ b/src/core/libs/supl/asn-supl/constraints.c @@ -1,41 +1,43 @@ #include "asn_internal.h" #include "constraints.h" -int -asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { - - (void)type_descriptor; /* Unused argument */ - (void)struct_ptr; /* Unused argument */ - (void)cb; /* Unused argument */ - (void)key; /* Unused argument */ +int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *cb, void *key) +{ + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ /* Nothing to check */ return 0; } -int -asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { - - (void)type_descriptor; /* Unused argument */ - (void)struct_ptr; /* Unused argument */ - (void)cb; /* Unused argument */ - (void)key; /* Unused argument */ +int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, + asn_app_constraint_failed_f *cb, void *key) +{ + (void)type_descriptor; /* Unused argument */ + (void)struct_ptr; /* Unused argument */ + (void)cb; /* Unused argument */ + (void)key; /* Unused argument */ /* Unknown how to check */ return 0; } -struct errbufDesc { +struct errbufDesc +{ asn_TYPE_descriptor_t *failed_type; const void *failed_struct_ptr; char *errbuf; size_t errlen; }; -static void -_asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { +static void _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, + const void *sptr, const char *fmt, ...) +{ struct errbufDesc *arg = key; va_list ap; ssize_t vlen; @@ -45,34 +47,38 @@ _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const ch arg->failed_struct_ptr = sptr; maxlen = arg->errlen; - if(maxlen <= 0) - return; + if (maxlen <= 0) return; va_start(ap, fmt); vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); va_end(ap); - if(vlen >= maxlen) { - arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ - arg->errlen = maxlen - 1; /* Not counting termination */ - return; - } else if(vlen >= 0) { - arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ - arg->errlen = vlen; /* Not counting termination */ - } else { - /* - * The libc on this system is broken. - */ - vlen = sizeof("") - 1; - maxlen--; - arg->errlen = vlen < maxlen ? vlen : maxlen; - memcpy(arg->errbuf, "", arg->errlen); - arg->errbuf[arg->errlen] = 0; - } + if (vlen >= maxlen) + { + arg->errbuf[maxlen - 1] = '\0'; /* Ensuring libc correctness */ + arg->errlen = maxlen - 1; /* Not counting termination */ + return; + } + else if (vlen >= 0) + { + arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ + arg->errlen = vlen; /* Not counting termination */ + } + else + { + /* + * The libc on this system is broken. + */ + vlen = sizeof("") - 1; + maxlen--; + arg->errlen = vlen < maxlen ? vlen : maxlen; + memcpy(arg->errbuf, "", arg->errlen); + arg->errbuf[arg->errlen] = 0; + } } -int -asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, - const void *struct_ptr, char *errbuf, size_t *errlen) { +int asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, + const void *struct_ptr, char *errbuf, size_t *errlen) +{ struct errbufDesc arg; int ret; @@ -81,10 +87,9 @@ asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, arg.errbuf = errbuf; arg.errlen = errlen ? *errlen : 0; - ret = type_descriptor->check_constraints(type_descriptor, - struct_ptr, _asn_i_ctfailcb, &arg); - if(ret == -1 && errlen) - *errlen = arg.errlen; + ret = type_descriptor->check_constraints(type_descriptor, struct_ptr, + _asn_i_ctfailcb, &arg); + if (ret == -1 && errlen) *errlen = arg.errlen; return ret; } diff --git a/src/core/libs/supl/asn-supl/constraints.h b/src/core/libs/supl/asn-supl/constraints.h index bc4fdb938..5d339e2ff 100644 --- a/src/core/libs/supl/asn-supl/constraints.h +++ b/src/core/libs/supl/asn-supl/constraints.h @@ -15,40 +15,39 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Validate the structure according to the ASN.1 constraints. - * If errbuf and errlen are given, they shall be pointing to the appropriate - * buffer space and its length before calling this function. Alternatively, - * they could be passed as NULL's. If constraints validation fails, - * errlen will contain the actual number of bytes taken from the errbuf - * to encode an error message (properly 0-terminated). - * - * RETURN VALUES: - * This function returns 0 in case all ASN.1 constraints are met - * and -1 if one or more constraints were failed. - */ - int asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, + * Validate the structure according to the ASN.1 constraints. + * If errbuf and errlen are given, they shall be pointing to the appropriate + * buffer space and its length before calling this function. Alternatively, + * they could be passed as NULL's. If constraints validation fails, + * errlen will contain the actual number of bytes taken from the errbuf + * to encode an error message (properly 0-terminated). + * + * RETURN VALUES: + * This function returns 0 in case all ASN.1 constraints are met + * and -1 if one or more constraints were failed. + */ + int asn_check_constraints( + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, /* Target language's structure */ char *errbuf, /* Returned error description */ size_t *errlen /* Length of the error description */ ); - /* - * Generic type for constraint checking callback, - * associated with every type descriptor. - */ + * Generic type for constraint checking callback, + * associated with every type descriptor. + */ typedef int(asn_constr_check_f)( - struct asn_TYPE_descriptor_s *type_descriptor, - const void *struct_ptr, + struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *optional_callback, /* Log the error */ - void *optional_app_key /* Opaque key passed to a callback */ + void *optional_app_key /* Opaque key passed to a callback */ ); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ - asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ + asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ /* diff --git a/src/core/libs/supl/asn-supl/der_encoder.c b/src/core/libs/supl/asn-supl/der_encoder.c index 7187e2923..5c6aeab10 100644 --- a/src/core/libs/supl/asn-supl/der_encoder.c +++ b/src/core/libs/supl/asn-supl/der_encoder.c @@ -6,39 +6,40 @@ #include static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, - asn_app_consume_bytes_f *cb, void *app_key, int constructed); + asn_app_consume_bytes_f *cb, void *app_key, + int constructed); /* * The DER encoder of any type. */ -asn_enc_rval_t -der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, - asn_app_consume_bytes_f *consume_bytes, void *app_key) { - - ASN_DEBUG("DER encoder invoked for %s", - type_descriptor->name); +asn_enc_rval_t der_encode(asn_TYPE_descriptor_t *type_descriptor, + void *struct_ptr, + asn_app_consume_bytes_f *consume_bytes, void *app_key) +{ + ASN_DEBUG("DER encoder invoked for %s", type_descriptor->name); /* * Invoke type-specific encoder. */ - return type_descriptor->der_encoder(type_descriptor, - struct_ptr, /* Pointer to the destination structure */ - 0, 0, - consume_bytes, app_key); + return type_descriptor->der_encoder( + type_descriptor, struct_ptr, /* Pointer to the destination structure */ + 0, 0, consume_bytes, app_key); } /* * Argument type and callback necessary for der_encode_to_buffer(). */ -typedef struct enc_to_buf_arg { +typedef struct enc_to_buf_arg +{ void *buffer; size_t left; } enc_to_buf_arg; -static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) +{ enc_to_buf_arg *arg = (enc_to_buf_arg *)key; - if(arg->left < size) - return -1; /* Data exceeds the available buffer size */ + if (arg->left < size) + return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; @@ -50,150 +51,153 @@ static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { /* * A variant of the der_encode() which encodes the data into the provided buffer */ -asn_enc_rval_t -der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, - void *buffer, size_t buffer_size) { +asn_enc_rval_t der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, + void *struct_ptr, void *buffer, + size_t buffer_size) +{ enc_to_buf_arg arg; asn_enc_rval_t ec; arg.buffer = buffer; arg.left = buffer_size; - ec = type_descriptor->der_encoder(type_descriptor, - struct_ptr, /* Pointer to the destination structure */ + ec = type_descriptor->der_encoder( + type_descriptor, struct_ptr, /* Pointer to the destination structure */ 0, 0, encode_to_buffer_cb, &arg); - if(ec.encoded != -1) { - assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); - /* Return the encoded contents size */ - } + if (ec.encoded != -1) + { + assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); + /* Return the encoded contents size */ + } return ec; } - /* * Write out leading TL[v] sequence according to the type definition. */ -ssize_t -der_write_tags(asn_TYPE_descriptor_t *sd, - size_t struct_length, - int tag_mode, int last_tag_form, - ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ - asn_app_consume_bytes_f *cb, - void *app_key) { - ber_tlv_tag_t *tags; /* Copy of tags stream */ - int tags_count; /* Number of tags */ +ssize_t der_write_tags(asn_TYPE_descriptor_t *sd, size_t struct_length, + int tag_mode, int last_tag_form, + ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ + asn_app_consume_bytes_f *cb, void *app_key) +{ + ber_tlv_tag_t *tags; /* Copy of tags stream */ + int tags_count; /* Number of tags */ size_t overall_length; ssize_t *lens; int i; - ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", - sd->name, tag_mode, sd->tags_count, - ber_tlv_tag_string(tag), - tag_mode - ?(sd->tags_count+1 - -((tag_mode == -1) && sd->tags_count)) - :sd->tags_count - ); + ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", sd->name, + tag_mode, sd->tags_count, ber_tlv_tag_string(tag), + tag_mode + ? (sd->tags_count + 1 - ((tag_mode == -1) && sd->tags_count)) + : sd->tags_count); - if(tag_mode) { - /* - * Instead of doing shaman dance like we do in ber_check_tags(), - * allocate a small array on the stack - * and initialize it appropriately. - */ - int stag_offset; - tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); - if(!tags) { /* Can fail on !x86 */ + if (tag_mode) + { + /* + * Instead of doing shaman dance like we do in ber_check_tags(), + * allocate a small array on the stack + * and initialize it appropriately. + */ + int stag_offset; + tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * + sizeof(ber_tlv_tag_t)); + if (!tags) + { /* Can fail on !x86 */ + errno = ENOMEM; + return -1; + } + tags_count = sd->tags_count + + 1 /* EXPLICIT or IMPLICIT tag is given */ + - ((tag_mode == -1) && sd->tags_count); + /* Copy tags over */ + tags[0] = tag; + stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); + for (i = 1; i < tags_count; i++) + tags[i] = sd->tags[i + stag_offset]; + } + else + { + tags = sd->tags; + tags_count = sd->tags_count; + } + + /* No tags to write */ + if (tags_count == 0) return 0; + + lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); + if (!lens) + { errno = ENOMEM; return -1; } - tags_count = sd->tags_count - + 1 /* EXPLICIT or IMPLICIT tag is given */ - - ((tag_mode == -1) && sd->tags_count); - /* Copy tags over */ - tags[0] = tag; - stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); - for(i = 1; i < tags_count; i++) - tags[i] = sd->tags[i + stag_offset]; - } else { - tags = sd->tags; - tags_count = sd->tags_count; - } - - /* No tags to write */ - if(tags_count == 0) - return 0; - - lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); - if(!lens) { - errno = ENOMEM; - return -1; - } /* * Array of tags is initialized. * Now, compute the size of the TLV pairs, from right to left. */ overall_length = struct_length; - for(i = tags_count - 1; i >= 0; --i) { - lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); - if(lens[i] == -1) return -1; - overall_length += lens[i]; - lens[i] = overall_length - lens[i]; - } + for (i = tags_count - 1; i >= 0; --i) + { + lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); + if (lens[i] == -1) return -1; + overall_length += lens[i]; + lens[i] = overall_length - lens[i]; + } - if(!cb) return overall_length - struct_length; + if (!cb) return overall_length - struct_length; - ASN_DEBUG("%s %s TL sequence (%d elements)", - cb?"Encoding":"Estimating", sd->name, tags_count); + ASN_DEBUG("%s %s TL sequence (%d elements)", cb ? "Encoding" : "Estimating", + sd->name, tags_count); /* * Encode the TL sequence for real. */ - for(i = 0; i < tags_count; i++) { - ssize_t len; - int _constr; + for (i = 0; i < tags_count; i++) + { + ssize_t len; + int _constr; - /* Check if this tag happens to be constructed */ - _constr = (last_tag_form || i < (tags_count - 1)); + /* Check if this tag happens to be constructed */ + _constr = (last_tag_form || i < (tags_count - 1)); - len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); - if(len == -1) return -1; - } + len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); + if (len == -1) return -1; + } return overall_length - struct_length; } -static ssize_t -der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, - asn_app_consume_bytes_f *cb, void *app_key, - int constructed) { +static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, + asn_app_consume_bytes_f *cb, void *app_key, + int constructed) +{ uint8_t buf[32]; size_t size = 0; - int buf_size = cb?sizeof(buf):0; + int buf_size = cb ? sizeof(buf) : 0; ssize_t tmp; /* Serialize tag (T from TLV) into possibly zero-length buffer */ tmp = ber_tlv_tag_serialize(tag, buf, buf_size); - if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; + if (tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; size += tmp; /* Serialize length (L from TLV) into possibly zero-length buffer */ - tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); - if(tmp == -1) return -1; + tmp = der_tlv_length_serialize(len, buf + size, + buf_size ? buf_size - size : 0); + if (tmp == -1) return -1; size += tmp; - if(size > sizeof(buf)) - return -1; + if (size > sizeof(buf)) return -1; /* * If callback is specified, invoke it, and check its return value. */ - if(cb) { - if(constructed) *buf |= 0x20; - if(cb(buf, size, app_key) < 0) - return -1; - } + if (cb) + { + if (constructed) *buf |= 0x20; + if (cb(buf, size, app_key) < 0) return -1; + } return size; } diff --git a/src/core/libs/supl/asn-supl/der_encoder.h b/src/core/libs/supl/asn-supl/der_encoder.h index 059e83f70..ce08a6ce4 100644 --- a/src/core/libs/supl/asn-supl/der_encoder.h +++ b/src/core/libs/supl/asn-supl/der_encoder.h @@ -15,16 +15,17 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * The DER encoder of any type. May be invoked by the application. - * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). - */ + * The DER encoder of any type. May be invoked by the application. + * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). + */ asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, - void *struct_ptr, /* Structure to be encoded */ - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key /* Arbitrary callback argument */ + void *struct_ptr, /* Structure to be encoded */ + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ ); - /* A variant of der_encode() which encodes data into the pre-allocated buffer */ + /* A variant of der_encode() which encodes data into the pre-allocated + * buffer */ asn_enc_rval_t der_encode_to_buffer( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ @@ -33,33 +34,31 @@ extern "C" ); /* - * Type of the generic DER encoder. - */ + * Type of the generic DER encoder. + */ typedef asn_enc_rval_t(der_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); - /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Write out leading TL[v] sequence according to the type definition. - */ - ssize_t der_write_tags( - struct asn_TYPE_descriptor_s *sd, - size_t struct_length, - int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ - int last_tag_form, /* {0,!0}: prim, constructed */ - ber_tlv_tag_t tag, - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key); + * Write out leading TL[v] sequence according to the type definition. + */ + ssize_t der_write_tags(struct asn_TYPE_descriptor_s *sd, + size_t struct_length, + int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ + int last_tag_form, /* {0,!0}: prim, constructed */ + ber_tlv_tag_t tag, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/per_decoder.c b/src/core/libs/supl/asn-supl/per_decoder.c index 813d23ea6..b5dd27229 100644 --- a/src/core/libs/supl/asn-supl/per_decoder.c +++ b/src/core/libs/supl/asn-supl/per_decoder.c @@ -7,87 +7,104 @@ * The complete encoding contains at least one byte, and is an integral * multiple of 8 bytes. */ -asn_dec_rval_t -uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { +asn_dec_rval_t uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buffer, size_t size) +{ asn_dec_rval_t rval; rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); - if(rval.consumed) { - /* - * We've always given 8-aligned data, - * so convert bits to integral bytes. - */ - rval.consumed += 7; - rval.consumed >>= 3; - } else if(rval.code == RC_OK) { - if(size) { - if(((uint8_t *)buffer)[0] == 0) { - rval.consumed = 1; /* 1 byte */ - } else { - ASN_DEBUG("Expecting single zeroed byte"); - rval.code = RC_FAIL; - } - } else { - /* Must contain at least 8 bits. */ - rval.code = RC_WMORE; + if (rval.consumed) + { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } + else if (rval.code == RC_OK) + { + if (size) + { + if (((uint8_t *)buffer)[0] == 0) + { + rval.consumed = 1; /* 1 byte */ + } + else + { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } + else + { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } } - } return rval; } -asn_dec_rval_t -uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { +asn_dec_rval_t uper_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **sptr, + const void *buffer, size_t size, int skip_bits, + int unused_bits) +{ asn_codec_ctx_t s_codec_ctx; asn_dec_rval_t rval; asn_per_data_t pd; - if(skip_bits < 0 || skip_bits > 7 - || unused_bits < 0 || unused_bits > 7 - || (unused_bits > 0 && !size)) + if (skip_bits < 0 || skip_bits > 7 || unused_bits < 0 || unused_bits > 7 || + (unused_bits > 0 && !size)) _ASN_DECODE_FAILED; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* Fill in the position indicator */ memset(&pd, 0, sizeof(pd)); pd.buffer = (const uint8_t *)buffer; pd.nboff = skip_bits; pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ - if(pd.nboff > pd.nbits) - _ASN_DECODE_FAILED; + if (pd.nboff > pd.nbits) _ASN_DECODE_FAILED; /* * Invoke type-specific decoder. */ - if(!td->uper_decoder) - _ASN_DECODE_FAILED; /* PER is not compiled in */ + if (!td->uper_decoder) _ASN_DECODE_FAILED; /* PER is not compiled in */ rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); - if(rval.code == RC_OK) { - /* Return the number of consumed bits */ - rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) - + pd.nboff - skip_bits; - ASN_DEBUG("PER decoding consumed %d, counted %d", - rval.consumed, pd.moved); - assert(rval.consumed == pd.moved); - } else { - /* PER codec is not a restartable */ - rval.consumed = 0; - } + if (rval.code == RC_OK) + { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %d, counted %d", rval.consumed, + pd.moved); + assert(rval.consumed == pd.moved); + } + else + { + /* PER codec is not a restartable */ + rval.consumed = 0; + } return rval; } - diff --git a/src/core/libs/supl/asn-supl/per_decoder.h b/src/core/libs/supl/asn-supl/per_decoder.h index 4e410c5b2..13f7acea1 100644 --- a/src/core/libs/supl/asn-supl/per_decoder.h +++ b/src/core/libs/supl/asn-supl/per_decoder.h @@ -16,37 +16,40 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. - * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. - */ - asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per + * X.691#10.1.3. + */ + asn_dec_rval_t uper_decode_complete( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *td, /* Type to decode */ - void **sptr, /* Pointer to a target structure's pointer */ - const void *buffer, /* Data to be decoded */ - size_t size /* Size of data buffer */ + void **sptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ ); /* - * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. - * WARNING: This call returns the number of BITS read from the stream. Beware. - */ - asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + * Unaligned PER decoder of any ASN.1 type. May be invoked by the + * application. WARNING: This call returns the number of BITS read from the + * stream. Beware. + */ + asn_dec_rval_t uper_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *td, /* Type to decode */ - void **sptr, /* Pointer to a target structure's pointer */ - const void *buffer, /* Data to be decoded */ - size_t size, /* Size of data buffer */ - int skip_bits, /* Number of unused leading bits, 0..7 */ - int unused_bits /* Number of unused tailing bits, 0..7 */ + void **sptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ ); - /* - * Type of the type-specific PER decoder function. - */ - typedef asn_dec_rval_t(per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, + * Type of the type-specific PER decoder function. + */ + typedef asn_dec_rval_t(per_type_decoder_f)( + asn_codec_ctx_t *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, - asn_per_constraints_t *constraints, - void **struct_ptr, + asn_per_constraints_t *constraints, void **struct_ptr, asn_per_data_t *per_data); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/per_encoder.c b/src/core/libs/supl/asn-supl/per_encoder.c index 831caeaf1..af7678a8b 100644 --- a/src/core/libs/supl/asn-supl/per_encoder.c +++ b/src/core/libs/supl/asn-supl/per_encoder.c @@ -2,25 +2,30 @@ #include #include -static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); +static asn_enc_rval_t uper_encode_internal( + asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, + void *sptr, asn_app_consume_bytes_f *cb, void *app_key); -asn_enc_rval_t -uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t uper_encode(asn_TYPE_descriptor_t *td, void *sptr, + asn_app_consume_bytes_f *cb, void *app_key) +{ return uper_encode_internal(td, 0, sptr, cb, app_key); } /* * Argument type and callback necessary for uper_encode_to_buffer(). */ -typedef struct enc_to_buf_arg { +typedef struct enc_to_buf_arg +{ void *buffer; size_t left; } enc_to_buf_arg; -static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { +static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) +{ enc_to_buf_arg *arg = (enc_to_buf_arg *)key; - if(arg->left < size) - return -1; /* Data exceeds the available buffer size */ + if (arg->left < size) + return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; @@ -29,68 +34,78 @@ static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { return 0; } -asn_enc_rval_t -uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { +asn_enc_rval_t uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, + void *buffer, size_t buffer_size) +{ enc_to_buf_arg key; key.buffer = buffer; key.left = buffer_size; - if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); + if (td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); } -typedef struct enc_dyn_arg { +typedef struct enc_dyn_arg +{ void *buffer; size_t length; size_t allocated; } enc_dyn_arg; -static int -encode_dyn_cb(const void *buffer, size_t size, void *key) { +static int encode_dyn_cb(const void *buffer, size_t size, void *key) +{ enc_dyn_arg *arg = key; - if(arg->length + size >= arg->allocated) { - void *p; - arg->allocated = arg->allocated ? (arg->allocated << 2) : size; - p = REALLOC(arg->buffer, arg->allocated); - if(!p) { - FREEMEM(arg->buffer); - memset(arg, 0, sizeof(*arg)); - return -1; + if (arg->length + size >= arg->allocated) + { + void *p; + arg->allocated = arg->allocated ? (arg->allocated << 2) : size; + p = REALLOC(arg->buffer, arg->allocated); + if (!p) + { + FREEMEM(arg->buffer); + memset(arg, 0, sizeof(*arg)); + return -1; + } + arg->buffer = p; } - arg->buffer = p; - } memcpy(((char *)arg->buffer) + arg->length, buffer, size); arg->length += size; return 0; } -ssize_t -uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { +ssize_t uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, void **buffer_r) +{ asn_enc_rval_t er; enc_dyn_arg key; memset(&key, 0, sizeof(key)); er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); - switch(er.encoded) { - case -1: - FREEMEM(key.buffer); - return -1; - case 0: - FREEMEM(key.buffer); - key.buffer = MALLOC(1); - if(key.buffer) { - *(char *)key.buffer = '\0'; - *buffer_r = key.buffer; - return 1; - } else { - return -1; + switch (er.encoded) + { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if (key.buffer) + { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } + else + { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %d bits", er.encoded); + return ((er.encoded + 7) >> 3); } - default: - *buffer_r = key.buffer; - ASN_DEBUG("Complete encoded in %d bits", er.encoded); - return ((er.encoded + 7) >> 3); - } } /* @@ -98,33 +113,37 @@ uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons */ /* Flush partially filled buffer */ -static int -_uper_encode_flush_outp(asn_per_outp_t *po) { +static int _uper_encode_flush_outp(asn_per_outp_t *po) +{ uint8_t *buf; - if(po->nboff == 0 && po->buffer == po->tmpspace) - return 0; + if (po->nboff == 0 && po->buffer == po->tmpspace) return 0; buf = po->buffer + (po->nboff >> 3); /* Make sure we account for the last, partially filled */ - if(po->nboff & 0x07) { - buf[0] &= 0xff << (8 - (po->nboff & 0x07)); - buf++; - } + if (po->nboff & 0x07) + { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); } -static asn_enc_rval_t -uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { +static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, + asn_app_consume_bytes_f *cb, + void *app_key) +{ asn_per_outp_t po; asn_enc_rval_t er; /* * Invoke type-specific encoder. */ - if(!td || !td->uper_encoder) - _ASN_ENCODE_FAILED; /* PER is not compiled in */ + if (!td || !td->uper_encoder) + _ASN_ENCODE_FAILED; /* PER is not compiled in */ po.buffer = po.tmpspace; po.nboff = 0; @@ -134,18 +153,17 @@ uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constrain po.flushed_bytes = 0; er = td->uper_encoder(td, constraints, sptr, &po); - if(er.encoded != -1) { - size_t bits_to_flush; + if (er.encoded != -1) + { + size_t bits_to_flush; - bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; - /* Set number of bits encoded to a firm value */ - er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; - if(_uper_encode_flush_outp(&po)) - _ASN_ENCODE_FAILED; - } + if (_uper_encode_flush_outp(&po)) _ASN_ENCODE_FAILED; + } return er; } - diff --git a/src/core/libs/supl/asn-supl/per_encoder.h b/src/core/libs/supl/asn-supl/per_encoder.h index 3c6cead57..e7fe7072a 100644 --- a/src/core/libs/supl/asn-supl/per_encoder.h +++ b/src/core/libs/supl/asn-supl/per_encoder.h @@ -16,50 +16,49 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. - * WARNING: This function returns the number of encoded bits in the .encoded - * field of the return value. Use the following formula to convert to bytes: - * bytes = ((.encoded + 7) / 8) - */ - asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *td, - void *sptr, /* Structure to be encoded */ + * Unaligned PER encoder of any ASN.1 type. May be invoked by the + * application. WARNING: This function returns the number of encoded bits in + * the .encoded field of the return value. Use the following formula to + * convert to bytes: bytes = ((.encoded + 7) / 8) + */ + asn_enc_rval_t uper_encode( + struct asn_TYPE_descriptor_s *td, + void *sptr, /* Structure to be encoded */ asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); /* - * A variant of uper_encode() which encodes data into the existing buffer - * WARNING: This function returns the number of encoded bits in the .encoded - * field of the return value. - */ + * A variant of uper_encode() which encodes data into the existing buffer + * WARNING: This function returns the number of encoded bits in the .encoded + * field of the return value. + */ asn_enc_rval_t uper_encode_to_buffer( struct asn_TYPE_descriptor_s *td, - void *sptr, /* Structure to be encoded */ + void *sptr, /* Structure to be encoded */ void *buffer, /* Pre-allocated buffer */ size_t buffer_size /* Initial buffer size (max) */ ); /* - * A variant of uper_encode_to_buffer() which allocates buffer itself. - * Returns the number of bytes in the buffer or -1 in case of failure. - * WARNING: This function produces a "Production of the complete encoding", - * with length of at least one octet. Contrast this to precise bit-packing - * encoding of uper_encode() and uper_encode_to_buffer(). - */ + * A variant of uper_encode_to_buffer() which allocates buffer itself. + * Returns the number of bytes in the buffer or -1 in case of failure. + * WARNING: This function produces a "Production of the complete encoding", + * with length of at least one octet. Contrast this to precise bit-packing + * encoding of uper_encode() and uper_encode_to_buffer(). + */ ssize_t uper_encode_to_new_buffer( - struct asn_TYPE_descriptor_s *td, - asn_per_constraints_t *constraints, - void *sptr, /* Structure to be encoded */ - void **buffer_r /* Buffer allocated and returned */ + struct asn_TYPE_descriptor_s *td, asn_per_constraints_t *constraints, + void *sptr, /* Structure to be encoded */ + void **buffer_r /* Buffer allocated and returned */ ); /* - * Type of the generic PER encoder function. - */ + * Type of the generic PER encoder function. + */ typedef asn_enc_rval_t(per_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, - asn_per_constraints_t *constraints, - void *struct_ptr, + asn_per_constraints_t *constraints, void *struct_ptr, asn_per_outp_t *per_output); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/per_opentype.c b/src/core/libs/supl/asn-supl/per_opentype.c index 580bacefb..5a2921406 100644 --- a/src/core/libs/supl/asn-supl/per_opentype.c +++ b/src/core/libs/supl/asn-supl/per_opentype.c @@ -17,7 +17,10 @@ typedef struct uper_ugot_key static int uper_ugot_refill(asn_per_data_t *pd); static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); -static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd); int asn_debug_indent; @@ -25,7 +28,9 @@ int asn_debug_indent; * Encode an "open type field". * #10.1, #10.2 */ -int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) +int uper_open_type_put(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, + asn_per_outp_t *po) { void *buf; void *bptr; @@ -49,14 +54,14 @@ int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constra FREEMEM(buf); if (toGo) return -1; - ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", - td->name, size); + ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", td->name, + size); return 0; } -static asn_dec_rval_t -uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, +static asn_dec_rval_t uper_open_type_get_simple( + asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; @@ -101,8 +106,7 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, } while (repeat); - ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, - bufLen); + ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, bufLen); memset(&spd, 0, sizeof(spd)); spd.buffer = buf; @@ -144,8 +148,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } -static asn_dec_rval_t GCC_NOTUSED -uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, +static asn_dec_rval_t GCC_NOTUSED uper_open_type_get_complex( + asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { uper_ugot_key arg; @@ -154,8 +158,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, _ASN_STACK_OVERFLOW_CHECK(ctx); - ASN_DEBUG("Getting open type %s from %s", td->name, - per_data_string(pd)); + ASN_DEBUG("Getting open type %s from %s", td->name, per_data_string(pd)); arg.oldpd = *pd; arg.unclaimed = 0; arg.ot_moved = 0; @@ -187,9 +190,8 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, } ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name, - per_data_string(pd), - per_data_string(&arg.oldpd), - arg.unclaimed, arg.repeat); + per_data_string(pd), per_data_string(&arg.oldpd), arg.unclaimed, + arg.repeat); padding = pd->moved % 8; if (padding) @@ -197,8 +199,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, int32_t pvalue; if (padding > 7) { - ASN_DEBUG("Too large padding %d in open type", - padding); + ASN_DEBUG("Too large padding %d in open type", padding); rv.code = RC_FAIL; UPDRESTOREPD; return rv; @@ -208,23 +209,23 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, pvalue = per_get_few_bits(pd, padding); switch (pvalue) { - case -1: - ASN_DEBUG("Padding skip failed"); - UPDRESTOREPD; - _ASN_DECODE_STARVED; - case 0: - break; - default: - ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", - padding, (int)pvalue); - UPDRESTOREPD; - _ASN_DECODE_FAILED; + case -1: + ASN_DEBUG("Padding skip failed"); + UPDRESTOREPD; + _ASN_DECODE_STARVED; + case 0: + break; + default: + ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", padding, + (int)pvalue); + UPDRESTOREPD; + _ASN_DECODE_FAILED; } } if (pd->nboff != pd->nbits) { ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, - per_data_string(pd), per_data_string(&arg.oldpd)); + per_data_string(pd), per_data_string(&arg.oldpd)); if (1) { UPDRESTOREPD; @@ -245,16 +246,16 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, { switch (per_skip_bits(pd, arg.unclaimed)) { - case -1: - ASN_DEBUG("Claim of %d failed", arg.unclaimed); - _ASN_DECODE_STARVED; - case 0: - ASN_DEBUG("Got claim of %d", arg.unclaimed); - break; - default: - /* Padding must be blank */ - ASN_DEBUG("Non-blank unconsumed padding"); - _ASN_DECODE_FAILED; + case -1: + ASN_DEBUG("Claim of %d failed", arg.unclaimed); + _ASN_DECODE_STARVED; + case 0: + ASN_DEBUG("Got claim of %d", arg.unclaimed); + break; + default: + /* Padding must be blank */ + ASN_DEBUG("Non-blank unconsumed padding"); + _ASN_DECODE_FAILED; } arg.unclaimed = 0; } @@ -269,13 +270,12 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } - -asn_dec_rval_t -uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) +asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { - return uper_open_type_get_simple(ctx, td, constraints, - sptr, pd); + return uper_open_type_get_simple(ctx, td, constraints, sptr, pd); } int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) @@ -297,9 +297,10 @@ int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) * Internal functions. */ -static asn_dec_rval_t -uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) +static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; @@ -317,8 +318,7 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, return rv; } -static int -uper_ugot_refill(asn_per_data_t *pd) +static int uper_ugot_refill(asn_per_data_t *pd) { uper_ugot_key *arg = pd->refill_key; ssize_t next_chunk_bytes; @@ -327,8 +327,8 @@ uper_ugot_refill(asn_per_data_t *pd) asn_per_data_t *oldpd = &arg->oldpd; - ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", - pd->moved, oldpd->moved); + ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", pd->moved, + oldpd->moved); /* Advance our position to where pd is */ oldpd->buffer = pd->buffer; @@ -340,8 +340,7 @@ uper_ugot_refill(asn_per_data_t *pd) if (arg->unclaimed) { /* Refill the container */ - if (per_get_few_bits(oldpd, 1)) - return -1; + if (per_get_few_bits(oldpd, 1)) return -1; if (oldpd->nboff == 0) { assert(0); @@ -362,7 +361,7 @@ uper_ugot_refill(asn_per_data_t *pd) next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", - next_chunk_bytes, oldpd->moved, arg->repeat); + next_chunk_bytes, oldpd->moved, arg->repeat); if (next_chunk_bytes < 0) return -1; if (next_chunk_bytes == 0) { @@ -376,25 +375,24 @@ uper_ugot_refill(asn_per_data_t *pd) pd->nbits = oldpd->nboff + next_chunk_bits; arg->unclaimed = 0; ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", - next_chunk_bits, oldpd->moved, - oldpd->nboff, oldpd->nbits, - oldpd->nbits - oldpd->nboff); + next_chunk_bits, oldpd->moved, oldpd->nboff, oldpd->nbits, + oldpd->nbits - oldpd->nboff); } else { pd->nbits = oldpd->nbits; arg->unclaimed = next_chunk_bits - avail; - ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); + ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, + next_chunk_bits, arg->unclaimed); } pd->buffer = oldpd->buffer; pd->nboff = oldpd->nboff; - ASN_DEBUG("Refilled pd%s old%s", - per_data_string(pd), per_data_string(oldpd)); + ASN_DEBUG("Refilled pd%s old%s", per_data_string(pd), + per_data_string(oldpd)); return 0; } -static int -per_skip_bits(asn_per_data_t *pd, int skip_nbits) +static int per_skip_bits(asn_per_data_t *pd, int skip_nbits) { int hasNonZeroBits = 0; while (skip_nbits > 0) @@ -408,13 +406,13 @@ per_skip_bits(asn_per_data_t *pd, int skip_nbits) switch (per_get_few_bits(pd, skip)) { - case -1: - return -1; /* Starving */ - case 0: - continue; /* Skipped empty space */ - default: - hasNonZeroBits = 1; - continue; + case -1: + return -1; /* Starving */ + case 0: + continue; /* Skipped empty space */ + default: + hasNonZeroBits = 1; + continue; } } return hasNonZeroBits; diff --git a/src/core/libs/supl/asn-supl/per_opentype.h b/src/core/libs/supl/asn-supl/per_opentype.h index 2110a794a..1d1a7befa 100644 --- a/src/core/libs/supl/asn-supl/per_opentype.h +++ b/src/core/libs/supl/asn-supl/per_opentype.h @@ -10,11 +10,16 @@ extern "C" { #endif - asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); + asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd); int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); - int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + int uper_open_type_put(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, + asn_per_outp_t *po); #ifdef __cplusplus } diff --git a/src/core/libs/supl/asn-supl/per_support.c b/src/core/libs/supl/asn-supl/per_support.c index 73a12185c..936ac77cd 100644 --- a/src/core/libs/supl/asn-supl/per_support.c +++ b/src/core/libs/supl/asn-supl/per_support.c @@ -7,190 +7,200 @@ #include #include -char * -per_data_string(asn_per_data_t *pd) { - static char buf[2][32]; - static int n; - n = (n+1) % 2; - snprintf(buf[n], sizeof(buf[n]), - "{m=%ld span %+ld[%d..%d] (%d)}", - (long)pd->moved, - (((long)pd->buffer) & 0xf), - (int)pd->nboff, (int)pd->nbits, - (int)(pd->nbits - pd->nboff)); - return buf[n]; +char *per_data_string(asn_per_data_t *pd) +{ + static char buf[2][32]; + static int n; + n = (n + 1) % 2; + snprintf(buf[n], sizeof(buf[n]), "{m=%ld span %+ld[%d..%d] (%d)}", + (long)pd->moved, (((long)pd->buffer) & 0xf), (int)pd->nboff, + (int)pd->nbits, (int)(pd->nbits - pd->nboff)); + return buf[n]; } -void -per_get_undo(asn_per_data_t *pd, int nbits) { - if((ssize_t)pd->nboff < nbits) { - assert((ssize_t)pd->nboff < nbits); - } else { - pd->nboff -= nbits; - pd->moved -= nbits; +void per_get_undo(asn_per_data_t *pd, int nbits) +{ + if ((ssize_t)pd->nboff < nbits) + { + assert((ssize_t)pd->nboff < nbits); + } + else + { + pd->nboff -= nbits; + pd->moved -= nbits; } } /* * Extract a small number of bits (<= 31) from the specified PER data pointer. */ -int32_t -per_get_few_bits(asn_per_data_t *pd, int nbits) { - size_t off; /* Next after last bit offset */ - ssize_t nleft; /* Number of bits left in this stream */ - uint32_t accum; - const uint8_t *buf; +int32_t per_get_few_bits(asn_per_data_t *pd, int nbits) +{ + size_t off; /* Next after last bit offset */ + ssize_t nleft; /* Number of bits left in this stream */ + uint32_t accum; + const uint8_t *buf; - if(nbits < 0) - return -1; + if (nbits < 0) return -1; - nleft = pd->nbits - pd->nboff; - if(nbits > nleft) { - int32_t tailv; - int32_t vhead; - if(!pd->refill || nbits > 31) return -1; - /* Accumulate unused bytes before refill */ - ASN_DEBUG("Obtain the rest %d bits (want %d)", - (int)nleft, nbits); - tailv = per_get_few_bits(pd, nleft); - if(tailv < 0) return -1; - /* Refill (replace pd contents with new data) */ - if(pd->refill(pd)) - return -1; - nbits -= nleft; - vhead = per_get_few_bits(pd, nbits); - /* Combine the rest of previous pd with the head of new one */ - tailv = (tailv << nbits) | vhead; /* Could == -1 */ - return tailv; + nleft = pd->nbits - pd->nboff; + if (nbits > nleft) + { + int32_t tailv; + int32_t vhead; + if (!pd->refill || nbits > 31) return -1; + /* Accumulate unused bytes before refill */ + ASN_DEBUG("Obtain the rest %d bits (want %d)", (int)nleft, nbits); + tailv = per_get_few_bits(pd, nleft); + if (tailv < 0) return -1; + /* Refill (replace pd contents with new data) */ + if (pd->refill(pd)) return -1; + nbits -= nleft; + vhead = per_get_few_bits(pd, nbits); + /* Combine the rest of previous pd with the head of new one */ + tailv = (tailv << nbits) | vhead; /* Could == -1 */ + return tailv; } - /* - * Normalize position indicator. - */ - if(pd->nboff >= 8) { - pd->buffer += (pd->nboff >> 3); - pd->nbits -= (pd->nboff & ~0x07); - pd->nboff &= 0x07; + /* + * Normalize position indicator. + */ + if (pd->nboff >= 8) + { + pd->buffer += (pd->nboff >> 3); + pd->nbits -= (pd->nboff & ~0x07); + pd->nboff &= 0x07; } - pd->moved += nbits; - pd->nboff += nbits; - off = pd->nboff; - buf = pd->buffer; + pd->moved += nbits; + pd->nboff += nbits; + off = pd->nboff; + buf = pd->buffer; - /* - * Extract specified number of bits. - */ - if(off <= 8) - accum = nbits ? (buf[0]) >> (8 - off) : 0; - else if(off <= 16) - accum = ((buf[0] << 8) + buf[1]) >> (16 - off); - else if(off <= 24) - accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); - else if(off <= 31) - accum = ((buf[0] << 24) + (buf[1] << 16) - + (buf[2] << 8) + (buf[3])) >> (32 - off); - else if(nbits <= 31) { - asn_per_data_t tpd = *pd; - /* Here are we with our 31-bits limit plus 1..7 bits offset. */ - per_get_undo(&tpd, nbits); - /* The number of available bits in the stream allow - * for the following operations to take place without - * invoking the ->refill() function */ - uint32_t two_twentyfour = 16777216; - accum = per_get_few_bits(&tpd, nbits - 24) * two_twentyfour; - accum |= per_get_few_bits(&tpd, 24); - } else { - per_get_undo(pd, nbits); - return -1; + /* + * Extract specified number of bits. + */ + if (off <= 8) + accum = nbits ? (buf[0]) >> (8 - off) : 0; + else if (off <= 16) + accum = ((buf[0] << 8) + buf[1]) >> (16 - off); + else if (off <= 24) + accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); + else if (off <= 31) + accum = ((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3])) >> + (32 - off); + else if (nbits <= 31) + { + asn_per_data_t tpd = *pd; + /* Here are we with our 31-bits limit plus 1..7 bits offset. */ + per_get_undo(&tpd, nbits); + /* The number of available bits in the stream allow + * for the following operations to take place without + * invoking the ->refill() function */ + uint32_t two_twentyfour = 16777216; + accum = per_get_few_bits(&tpd, nbits - 24) * two_twentyfour; + accum |= per_get_few_bits(&tpd, 24); + } + else + { + per_get_undo(pd, nbits); + return -1; } - accum &= (((uint32_t)1 << nbits) - 1); + accum &= (((uint32_t)1 << nbits) - 1); - ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", - nbits, (int)nleft, - (int)pd->moved, - (((long)pd->buffer) & 0xf), - (int)pd->nboff, (int)pd->nbits, - ((pd->buffer != NULL)?pd->buffer[0]:0), - (int)(pd->nbits - pd->nboff), - (int)accum); + ASN_DEBUG( + " [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", + nbits, (int)nleft, (int)pd->moved, (((long)pd->buffer) & 0xf), + (int)pd->nboff, (int)pd->nbits, + ((pd->buffer != NULL) ? pd->buffer[0] : 0), + (int)(pd->nbits - pd->nboff), (int)accum); - return accum; + return accum; } /* * Extract a large number of bits from the specified PER data pointer. */ -int -per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { - int32_t value; +int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) +{ + int32_t value; - if(alright && (nbits & 7)) { - /* Perform right alignment of a first few bits */ - value = per_get_few_bits(pd, nbits & 0x07); - if(value < 0) return -1; - *dst++ = value; /* value is already right-aligned */ - nbits &= ~7; + if (alright && (nbits & 7)) + { + /* Perform right alignment of a first few bits */ + value = per_get_few_bits(pd, nbits & 0x07); + if (value < 0) return -1; + *dst++ = value; /* value is already right-aligned */ + nbits &= ~7; } - while(nbits) { - if(nbits >= 24) { - value = per_get_few_bits(pd, 24); - if(value < 0) return -1; - *(dst++) = value >> 16; - *(dst++) = value >> 8; - *(dst++) = value; - nbits -= 24; - } else { - value = per_get_few_bits(pd, nbits); - if(value < 0) return -1; - if(nbits & 7) { /* implies left alignment */ - value <<= 8 - (nbits & 7), - nbits += 8 - (nbits & 7); - if(nbits > 24) - *dst++ = value >> 24; + while (nbits) + { + if (nbits >= 24) + { + value = per_get_few_bits(pd, 24); + if (value < 0) return -1; + *(dst++) = value >> 16; + *(dst++) = value >> 8; + *(dst++) = value; + nbits -= 24; + } + else + { + value = per_get_few_bits(pd, nbits); + if (value < 0) return -1; + if (nbits & 7) + { /* implies left alignment */ + value <<= 8 - (nbits & 7), nbits += 8 - (nbits & 7); + if (nbits > 24) *dst++ = value >> 24; } - if(nbits > 16) - *dst++ = value >> 16; - if(nbits > 8) - *dst++ = value >> 8; - *dst++ = value; - break; + if (nbits > 16) *dst++ = value >> 16; + if (nbits > 8) *dst++ = value >> 8; + *dst++ = value; + break; } } - return 0; + return 0; } /* * X.691-201508 #10.9 General rules for encoding a length determinant. * Get the optionally constrained length "n" from the stream. */ -ssize_t -uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { +ssize_t uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) +{ ssize_t value; *repeat = 0; /* #11.9.4.1 Encoding if constrained (according to effective bits) */ - if(ebits >= 0 && ebits <= 16) { - return per_get_few_bits(pd, ebits); - } + if (ebits >= 0 && ebits <= 16) + { + return per_get_few_bits(pd, ebits); + } - value = per_get_few_bits(pd, 8); - if((value & 0x80) == 0) { /* #11.9.3.6 */ - return (value & 0x7F); - } else if((value & 0x40) == 0) { /* #11.9.3.7 */ - /* bit 8 ... set to 1 and bit 7 ... set to zero */ - value = ((value & 0x3f) << 8) | per_get_few_bits(pd, 8); - return value; /* potential -1 from per_get_few_bits passes through. */ - } else if(value < 0) { - return -1; - } + value = per_get_few_bits(pd, 8); + if ((value & 0x80) == 0) + { /* #11.9.3.6 */ + return (value & 0x7F); + } + else if ((value & 0x40) == 0) + { /* #11.9.3.7 */ + /* bit 8 ... set to 1 and bit 7 ... set to zero */ + value = ((value & 0x3f) << 8) | per_get_few_bits(pd, 8); + return value; /* potential -1 from per_get_few_bits passes through. + */ + } + else if (value < 0) + { + return -1; + } value &= 0x3f; /* this is "m" from X.691, #11.9.3.8 */ - if(value < 1 || value > 4) { - return -1; /* Prohibited by #11.9.3.8 */ - } + if (value < 1 || value > 4) + { + return -1; /* Prohibited by #11.9.3.8 */ + } *repeat = 1; return (16384 * value); } @@ -200,22 +210,25 @@ uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { * This procedure used to decode length of extensions bit-maps * for SET and SEQUENCE types. */ -ssize_t -uper_get_nslength(asn_per_data_t *pd) { - ssize_t length; +ssize_t uper_get_nslength(asn_per_data_t *pd) +{ + ssize_t length; - ASN_DEBUG("Getting normally small length"); + ASN_DEBUG("Getting normally small length"); - if(per_get_few_bits(pd, 1) == 0) { - length = per_get_few_bits(pd, 6) + 1; - if(length <= 0) return -1; - ASN_DEBUG("l=%d", (int)length); - return length; - } else { - int repeat; - length = uper_get_length(pd, -1, &repeat); - if(length >= 0 && !repeat) return length; - return -1; /* Error, or do not support >16K extensions */ + if (per_get_few_bits(pd, 1) == 0) + { + length = per_get_few_bits(pd, 6) + 1; + if (length <= 0) return -1; + ASN_DEBUG("l=%d", (int)length); + return length; + } + else + { + int repeat; + length = uper_get_length(pd, -1, &repeat); + if (length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ } } @@ -223,294 +236,289 @@ uper_get_nslength(asn_per_data_t *pd) { * Get the normally small non-negative whole number. * X.691, #10.6 */ -ssize_t -uper_get_nsnnwn(asn_per_data_t *pd) { - ssize_t value; +ssize_t uper_get_nsnnwn(asn_per_data_t *pd) +{ + ssize_t value; - value = per_get_few_bits(pd, 7); - if(value & 64) { /* implicit (value < 0) */ - value &= 63; - value <<= 2; - value |= per_get_few_bits(pd, 2); - if(value & 128) /* implicit (value < 0) */ - return -1; - if(value == 0) - return 0; - if(value >= 3) - return -1; - value = per_get_few_bits(pd, 8 * value); - return value; + value = per_get_few_bits(pd, 7); + if (value & 64) + { /* implicit (value < 0) */ + value &= 63; + value <<= 2; + value |= per_get_few_bits(pd, 2); + if (value & 128) /* implicit (value < 0) */ + return -1; + if (value == 0) return 0; + if (value >= 3) return -1; + value = per_get_few_bits(pd, 8 * value); + return value; } - return value; + return value; } /* * X.691-11/2008, #11.6 * Encoding of a normally small non-negative whole number */ -int -uper_put_nsnnwn(asn_per_outp_t *po, int n) { - int bytes; +int uper_put_nsnnwn(asn_per_outp_t *po, int n) +{ + int bytes; - if(n <= 63) { - if(n < 0) return -1; - return per_put_few_bits(po, n, 7); + if (n <= 63) + { + if (n < 0) return -1; + return per_put_few_bits(po, n, 7); } - if(n < 256) - bytes = 1; - else if(n < 65536) - bytes = 2; - else if(n < 256 * 65536) - bytes = 3; - else - return -1; /* This is not a "normally small" value */ - if(per_put_few_bits(po, bytes, 8)) - return -1; + if (n < 256) + bytes = 1; + else if (n < 65536) + bytes = 2; + else if (n < 256 * 65536) + bytes = 3; + else + return -1; /* This is not a "normally small" value */ + if (per_put_few_bits(po, bytes, 8)) return -1; - return per_put_few_bits(po, n, 8 * bytes); + return per_put_few_bits(po, n, 8 * bytes); } - /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { - unsigned long lhalf; /* Lower half of the number*/ - long half; +int uper_get_constrained_whole_number(asn_per_data_t *pd, + unsigned long *out_value, int nbits) +{ + unsigned long lhalf; /* Lower half of the number*/ + long half; - if(nbits <= 31) { - half = per_get_few_bits(pd, nbits); - if(half < 0) return -1; - *out_value = half; - return 0; + if (nbits <= 31) + { + half = per_get_few_bits(pd, nbits); + if (half < 0) return -1; + *out_value = half; + return 0; } - if((size_t)nbits > 8 * sizeof(*out_value)) - return -1; /* RANGE */ + if ((size_t)nbits > 8 * sizeof(*out_value)) return -1; /* RANGE */ - half = per_get_few_bits(pd, 31); - if(half < 0) return -1; + half = per_get_few_bits(pd, 31); + if (half < 0) return -1; - if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) - return -1; + if (uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) return -1; - *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; - return 0; + *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; + return 0; } - /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { - /* - * Assume signed number can be safely coerced into - * unsigned of the same range. - * The following testing code will likely be optimized out - * by compiler if it is true. - */ - unsigned long uvalue1 = ULONG_MAX; - long svalue = uvalue1; - unsigned long uvalue2 = svalue; - assert(uvalue1 == uvalue2); - return uper_put_constrained_whole_number_u(po, v, nbits); +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) +{ + /* + * Assume signed number can be safely coerced into + * unsigned of the same range. + * The following testing code will likely be optimized out + * by compiler if it is true. + */ + unsigned long uvalue1 = ULONG_MAX; + long svalue = uvalue1; + unsigned long uvalue2 = svalue; + assert(uvalue1 == uvalue2); + return uper_put_constrained_whole_number_u(po, v, nbits); } -int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { - if(nbits <= 31) { - return per_put_few_bits(po, v, nbits); - } else { - /* Put higher portion first, followed by lower 31-bit */ - if(uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) - return -1; - return per_put_few_bits(po, v, 31); +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, + int nbits) +{ + if (nbits <= 31) + { + return per_put_few_bits(po, v, nbits); + } + else + { + /* Put higher portion first, followed by lower 31-bit */ + if (uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) + return -1; + return per_put_few_bits(po, v, 31); } } -int -per_put_aligned_flush(asn_per_outp_t *po) { +int per_put_aligned_flush(asn_per_outp_t *po) +{ uint32_t unused_bits = (0x7 & (8 - (po->nboff & 0x07))); size_t complete_bytes = (po->buffer ? po->buffer - po->tmpspace : 0) + ((po->nboff + 7) >> 3); - if(unused_bits) { - po->buffer[po->nboff >> 3] &= ~0 << unused_bits; - } + if (unused_bits) + { + po->buffer[po->nboff >> 3] &= ~0 << unused_bits; + } - if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) { - return -1; - } else { - po->buffer = po->tmpspace; - po->nboff = 0; - po->nbits = 8 * sizeof(po->tmpspace); - po->flushed_bytes += complete_bytes; - return 0; - } + if (po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + { + return -1; + } + else + { + po->buffer = po->tmpspace; + po->nboff = 0; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; + return 0; + } } /* * Put a small number of bits (<= 31). */ -int -per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { - size_t off; /* Next after last bit offset */ - size_t omsk; /* Existing last byte meaningful bits mask */ - uint8_t *buf; +int per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) +{ + size_t off; /* Next after last bit offset */ + size_t omsk; /* Existing last byte meaningful bits mask */ + uint8_t *buf; - if(obits <= 0 || obits >= 32) return obits ? -1 : 0; + if (obits <= 0 || obits >= 32) return obits ? -1 : 0; - ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", - obits, (int)bits, po->buffer, (int)po->nboff); + ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", obits, (int)bits, + po->buffer, (int)po->nboff); - /* - * Normalize position indicator. - */ - if(po->nboff >= 8) { - po->buffer += (po->nboff >> 3); - po->nbits -= (po->nboff & ~0x07); - po->nboff &= 0x07; + /* + * Normalize position indicator. + */ + if (po->nboff >= 8) + { + po->buffer += (po->nboff >> 3); + po->nbits -= (po->nboff & ~0x07); + po->nboff &= 0x07; } - /* - * Flush whole-bytes output, if necessary. - */ - if(po->nboff + obits > po->nbits) { - size_t complete_bytes; - if(!po->buffer) po->buffer = po->tmpspace; - complete_bytes = (po->buffer - po->tmpspace); - ASN_DEBUG("[PER output %ld complete + %ld]", - (long)complete_bytes, (long)po->flushed_bytes); - if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) - return -1; - if(po->nboff) - po->tmpspace[0] = po->buffer[0]; - po->buffer = po->tmpspace; - po->nbits = 8 * sizeof(po->tmpspace); - po->flushed_bytes += complete_bytes; + /* + * Flush whole-bytes output, if necessary. + */ + if (po->nboff + obits > po->nbits) + { + size_t complete_bytes; + if (!po->buffer) po->buffer = po->tmpspace; + complete_bytes = (po->buffer - po->tmpspace); + ASN_DEBUG("[PER output %ld complete + %ld]", (long)complete_bytes, + (long)po->flushed_bytes); + if (po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) + return -1; + if (po->nboff) po->tmpspace[0] = po->buffer[0]; + po->buffer = po->tmpspace; + po->nbits = 8 * sizeof(po->tmpspace); + po->flushed_bytes += complete_bytes; } - /* - * Now, due to sizeof(tmpspace), we are guaranteed large enough space. - */ - buf = po->buffer; - omsk = ~((1 << (8 - po->nboff)) - 1); - off = (po->nboff + obits); + /* + * Now, due to sizeof(tmpspace), we are guaranteed large enough space. + */ + buf = po->buffer; + omsk = ~((1 << (8 - po->nboff)) - 1); + off = (po->nboff + obits); - /* Clear data of debris before meaningful bits */ - bits &= (((uint32_t)1 << obits) - 1); + /* Clear data of debris before meaningful bits */ + bits &= (((uint32_t)1 << obits) - 1); - ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, - (int)bits, (int)bits, - (int)po->nboff, (int)off, - buf[0], (int)(omsk&0xff), - (int)(buf[0] & omsk)); + ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, (int)bits, + (int)bits, (int)po->nboff, (int)off, buf[0], (int)(omsk & 0xff), + (int)(buf[0] & omsk)); - if(off <= 8) /* Completely within 1 byte */ - po->nboff = off, - bits <<= (8 - off), - buf[0] = (buf[0] & omsk) | bits; - else if(off <= 16) - po->nboff = off, - bits <<= (16 - off), - buf[0] = (buf[0] & omsk) | (bits >> 8), - buf[1] = bits; - else if(off <= 24) - po->nboff = off, - bits <<= (24 - off), - buf[0] = (buf[0] & omsk) | (bits >> 16), - buf[1] = bits >> 8, - buf[2] = bits; - else if(off <= 31) - po->nboff = off, - bits <<= (32 - off), - buf[0] = (buf[0] & omsk) | (bits >> 24), - buf[1] = bits >> 16, - buf[2] = bits >> 8, - buf[3] = bits; - else { - if((obits - 24) > 0) + if (off <= 8) /* Completely within 1 byte */ + po->nboff = off, bits <<= (8 - off), buf[0] = (buf[0] & omsk) | bits; + else if (off <= 16) + po->nboff = off, bits <<= (16 - off), + buf[0] = (buf[0] & omsk) | (bits >> 8), buf[1] = bits; + else if (off <= 24) + po->nboff = off, bits <<= (24 - off), + buf[0] = (buf[0] & omsk) | (bits >> 16), buf[1] = bits >> 8, + buf[2] = bits; + else if (off <= 31) + po->nboff = off, bits <<= (32 - off), + buf[0] = (buf[0] & omsk) | (bits >> 24), buf[1] = bits >> 16, + buf[2] = bits >> 8, buf[3] = bits; + else + { + if ((obits - 24) > 0) { - if(per_put_few_bits(po, bits >> (obits - 24), 24)) return -1; + if (per_put_few_bits(po, bits >> (obits - 24), 24)) + return -1; } - if(per_put_few_bits(po, bits, obits - 24)) return -1; + if (per_put_few_bits(po, bits, obits - 24)) return -1; } - ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", - (int)bits, (int)bits, buf[0], - (po->buffer - po->tmpspace)); + ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", (int)bits, (int)bits, buf[0], + (po->buffer - po->tmpspace)); - return 0; + return 0; } - /* * Output a large number of bits. */ -int -per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { +int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) +{ + while (nbits) + { + uint32_t value; - while(nbits) { - uint32_t value; - - if(nbits >= 24) { - value = (src[0] << 16) | (src[1] << 8) | src[2]; - src += 3; - nbits -= 24; - if(per_put_few_bits(po, value, 24)) - return -1; - } else { - value = src[0]; - if(nbits > 8) - value = (value << 8) | src[1]; - if(nbits > 16) - value = (value << 8) | src[2]; - if(nbits & 0x07) - value >>= (8 - (nbits & 0x07)); - if(per_put_few_bits(po, value, nbits)) - return -1; - break; + if (nbits >= 24) + { + value = (src[0] << 16) | (src[1] << 8) | src[2]; + src += 3; + nbits -= 24; + if (per_put_few_bits(po, value, 24)) return -1; + } + else + { + value = src[0]; + if (nbits > 8) value = (value << 8) | src[1]; + if (nbits > 16) value = (value << 8) | src[2]; + if (nbits & 0x07) value >>= (8 - (nbits & 0x07)); + if (per_put_few_bits(po, value, nbits)) return -1; + break; } } - return 0; + return 0; } /* * Put the length "n" (or part of it) into the stream. */ -ssize_t -uper_put_length(asn_per_outp_t *po, size_t length) { +ssize_t uper_put_length(asn_per_outp_t *po, size_t length) +{ + if (length <= 127) /* #10.9.3.6 */ + return per_put_few_bits(po, length, 8) ? -1 : (ssize_t)length; + else if (length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length | 0x8000, 16) ? -1 : (ssize_t)length; - if(length <= 127) /* #10.9.3.6 */ - return per_put_few_bits(po, length, 8) - ? -1 : (ssize_t)length; - else if(length < 16384) /* #10.9.3.7 */ - return per_put_few_bits(po, length|0x8000, 16) - ? -1 : (ssize_t)length; + length >>= 14; + if (length > 4) length = 4; - length >>= 14; - if(length > 4) length = 4; - - return per_put_few_bits(po, 0xC0 | length, 8) - ? -1 : (ssize_t)(length << 14); + return per_put_few_bits(po, 0xC0 | length, 8) ? -1 + : (ssize_t)(length << 14); } - /* * Put the normally small length "n" into the stream. * This procedure used to encode length of extensions bit-maps * for SET and SEQUENCE types. */ -int -uper_put_nslength(asn_per_outp_t *po, size_t length) { - - if(length <= 64) { - /* #10.9.3.4 */ - if(length == 0) return -1; - return per_put_few_bits(po, length-1, 7) ? -1 : 0; - } else { - if(uper_put_length(po, length) != (ssize_t)length) { - /* This might happen in case of >16K extensions */ - return -1; +int uper_put_nslength(asn_per_outp_t *po, size_t length) +{ + if (length <= 64) + { + /* #10.9.3.4 */ + if (length == 0) return -1; + return per_put_few_bits(po, length - 1, 7) ? -1 : 0; + } + else + { + if (uper_put_length(po, length) != (ssize_t)length) + { + /* This might happen in case of >16K extensions */ + return -1; } } - return 0; + return 0; } diff --git a/src/core/libs/supl/asn-supl/per_support.h b/src/core/libs/supl/asn-supl/per_support.h index 77ffe1335..764a7cc15 100644 --- a/src/core/libs/supl/asn-supl/per_support.h +++ b/src/core/libs/supl/asn-supl/per_support.h @@ -14,8 +14,8 @@ extern "C" #endif /* - * Pre-computed PER constraints. - */ + * Pre-computed PER constraints. + */ typedef const struct asn_per_constraint_s { enum asn_per_constraint_flags @@ -39,62 +39,61 @@ extern "C" } asn_per_constraints_t; /* - * This structure describes a position inside an incoming PER bit stream. - */ + * This structure describes a position inside an incoming PER bit stream. + */ typedef struct asn_per_data_s { const uint8_t *buffer; /* Pointer to the octet stream */ size_t nboff; /* Bit offset to the meaningful bit */ size_t nbits; /* Number of bits in the stream */ - size_t moved; /* Number of bits moved through this bit stream */ + size_t moved; /* Number of bits moved through this bit stream */ int (*refill)(struct asn_per_data_s *); void *refill_key; } asn_per_data_t; /* - * Extract a small number of bits (<= 31) from the specified PER data pointer. - * This function returns -1 if the specified number of bits could not be - * extracted due to EOD or other conditions. - */ + * Extract a small number of bits (<= 31) from the specified PER data + * pointer. This function returns -1 if the specified number of bits could + * not be extracted due to EOD or other conditions. + */ int32_t per_get_few_bits(asn_per_data_t *pd, int get_nbits); /* Undo the immediately preceding "get_few_bits" operation */ void per_get_undo(asn_per_data_t *pd, int get_nbits); /* - * Extract a large number of bits from the specified PER data pointer. - * This function returns -1 if the specified number of bits could not be - * extracted due to EOD or other conditions. - */ + * Extract a large number of bits from the specified PER data pointer. + * This function returns -1 if the specified number of bits could not be + * extracted due to EOD or other conditions. + */ int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, - int get_nbits); + int get_nbits); /* - * Get the length "n" from the Unaligned PER stream. - */ - ssize_t uper_get_length(asn_per_data_t *pd, - int ebits, - int *repeat); + * Get the length "n" from the Unaligned PER stream. + */ + ssize_t uper_get_length(asn_per_data_t *pd, int ebits, int *repeat); /* - * Get the normally small length "n". - */ + * Get the normally small length "n". + */ ssize_t uper_get_nslength(asn_per_data_t *pd); /* - * Get the normally small non-negative whole number. - */ + * Get the normally small non-negative whole number. + */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); /* X.691-2008/11, #11.5.6 */ - int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits); + int uper_get_constrained_whole_number(asn_per_data_t *pd, + unsigned long *out_value, int nbits); /* Non-thread-safe debugging function, don't use it */ char *per_data_string(asn_per_data_t *pd); /* - * This structure supports forming PER output. - */ + * This structure supports forming PER output. + */ typedef struct asn_per_outp_s { uint8_t *buffer; /* Pointer into the (tmpspace) */ @@ -110,35 +109,38 @@ extern "C" int per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits); /* Output a large number of bits */ - int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); + int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, + int put_nbits); /* - * Flush whole bytes (0 or more) through (outper) member. - * The least significant bits which are not used are guaranteed to be set to 0. - * Returns -1 if callback returns -1. Otherwise, 0. - */ + * Flush whole bytes (0 or more) through (outper) member. + * The least significant bits which are not used are guaranteed to be set to + * 0. Returns -1 if callback returns -1. Otherwise, 0. + */ int per_put_aligned_flush(asn_per_outp_t *po); /* X.691-2008/11, #11.5 */ - int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); - int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); + int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, + int nbits); + int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, + int nbits); /* - * Put the length "n" to the Unaligned PER stream. - * This function returns the number of units which may be flushed - * in the next units saving iteration. - */ + * Put the length "n" to the Unaligned PER stream. + * This function returns the number of units which may be flushed + * in the next units saving iteration. + */ ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); /* - * Put the normally small length "n" to the Unaligned PER stream. - * Returns 0 or -1. - */ + * Put the normally small length "n" to the Unaligned PER stream. + * Returns 0 or -1. + */ int uper_put_nslength(asn_per_outp_t *po, size_t length); /* - * Put the normally small non-negative whole number. - */ + * Put the normally small non-negative whole number. + */ int uper_put_nsnnwn(asn_per_outp_t *po, int n); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/xer_decoder.c b/src/core/libs/supl/asn-supl/xer_decoder.c index 10e5d70c7..c7bc688bc 100644 --- a/src/core/libs/supl/asn-supl/xer_decoder.c +++ b/src/core/libs/supl/asn-supl/xer_decoder.c @@ -4,32 +4,36 @@ */ #include #include -#include /* XER/XML parsing support */ - +#include /* XER/XML parsing support */ /* * Decode the XER encoding of a given type. */ -asn_dec_rval_t -xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, - void **struct_ptr, const void *buffer, size_t size) { +asn_dec_rval_t xer_decode(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, void **struct_ptr, + const void *buffer, size_t size) +{ asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ - if(opt_codec_ctx) { - if(opt_codec_ctx->max_stack_size) { - s_codec_ctx = *opt_codec_ctx; + if (opt_codec_ctx) + { + if (opt_codec_ctx->max_stack_size) + { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } + else + { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } - } else { - /* If context is not given, be security-conscious anyway */ - memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; - opt_codec_ctx = &s_codec_ctx; - } /* * Invoke type-specific decoder. @@ -37,179 +41,201 @@ xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); } - - -struct xer__cb_arg { - pxml_chunk_type_e chunk_type; - size_t chunk_size; - const void *chunk_buf; +struct xer__cb_arg +{ + pxml_chunk_type_e chunk_type; + size_t chunk_size; + const void *chunk_buf; int callback_not_invoked; }; -static int -xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { +static int xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, + size_t _chunk_size, void *key) +{ struct xer__cb_arg *arg = (struct xer__cb_arg *)key; arg->chunk_type = type; arg->chunk_size = _chunk_size; arg->chunk_buf = _chunk_data; arg->callback_not_invoked = 0; - return -1; /* Terminate the XML parsing */ + return -1; /* Terminate the XML parsing */ } /* * Fetch the next token from the XER/XML stream. */ -ssize_t -xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { +ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, + pxer_chunk_type_e *ch_type) +{ struct xer__cb_arg arg; int new_stateContext = *stateContext; ssize_t ret; arg.callback_not_invoked = 1; ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); - if(ret < 0) return -1; - if(arg.callback_not_invoked) { - assert(ret == 0); /* No data was consumed */ - return 0; /* Try again with more data */ - } else { - assert(arg.chunk_size); - assert(arg.chunk_buf == buffer); - } + if (ret < 0) return -1; + if (arg.callback_not_invoked) + { + assert(ret == 0); /* No data was consumed */ + return 0; /* Try again with more data */ + } + else + { + assert(arg.chunk_size); + assert(arg.chunk_buf == buffer); + } /* * Translate the XML chunk types into more convenient ones. */ - switch(arg.chunk_type) { - case PXML_TEXT: - *ch_type = PXER_TEXT; - break; - case PXML_TAG: return 0; /* Want more */ - case PXML_TAG_END: - *ch_type = PXER_TAG; - break; - case PXML_COMMENT: - case PXML_COMMENT_END: - *ch_type = PXER_COMMENT; - break; - } + switch (arg.chunk_type) + { + case PXML_TEXT: + *ch_type = PXER_TEXT; + break; + case PXML_TAG: + return 0; /* Want more */ + case PXML_TAG_END: + *ch_type = PXER_TAG; + break; + case PXML_COMMENT: + case PXML_COMMENT_END: + *ch_type = PXER_COMMENT; + break; + } *stateContext = new_stateContext; return arg.chunk_size; } -#define CSLASH 0x2f /* '/' */ -#define LANGLE 0x3c /* '<' */ -#define RANGLE 0x3e /* '>' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define RANGLE 0x3e /* '>' */ -xer_check_tag_e -xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { +xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, + const char *need_tag) +{ const char *buf = (const char *)buf_ptr; const char *end; xer_check_tag_e ct = XCT_OPENING; - if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { - if(size >= 2) - ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); - return XCT_BROKEN; - } + if (size < 2 || buf[0] != LANGLE || buf[size - 1] != RANGLE) + { + if (size >= 2) + ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); + return XCT_BROKEN; + } /* * Determine the tag class. */ - if(buf[1] == CSLASH) { - buf += 2; /* advance past "" */ - ct = XCT_CLOSING; - if(size > 0 && buf[size-1] == CSLASH) - return XCT_BROKEN; /* */ - } else { - buf++; /* advance past "<" */ - size -= 2; /* strip "<" and ">" */ - if(size > 0 && buf[size-1] == CSLASH) { - ct = XCT_BOTH; - size--; /* One more, for "/" */ + if (buf[1] == CSLASH) + { + buf += 2; /* advance past "" */ + ct = XCT_CLOSING; + if (size > 0 && buf[size - 1] == CSLASH) + return XCT_BROKEN; /* */ + } + else + { + buf++; /* advance past "<" */ + size -= 2; /* strip "<" and ">" */ + if (size > 0 && buf[size - 1] == CSLASH) + { + ct = XCT_BOTH; + size--; /* One more, for "/" */ + } } - } /* Sometimes we don't care about the tag */ - if(!need_tag || !*need_tag) - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (!need_tag || !*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); /* * Determine the tag name. */ - for(end = buf + size; buf < end; buf++, need_tag++) { - int b = *buf; - int n = *need_tag; - if(b != n) { - if(n == 0) { - switch(b) { - case 0x09: case 0x0a: case 0x0c: case 0x0d: - case 0x20: - /* "": whitespace is normal */ - return ct; + for (end = buf + size; buf < end; buf++, need_tag++) + { + int b = *buf; + int n = *need_tag; + if (b != n) + { + if (n == 0) + { + switch (b) + { + case 0x09: + case 0x0a: + case 0x0c: + case 0x0d: + case 0x20: + /* "": whitespace is normal */ + return ct; + } + } + return (xer_check_tag_e)(XCT__UNK__MASK | ct); } - } - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (b == 0) return XCT_BROKEN; /* Embedded 0 in buf?! */ } - if(b == 0) - return XCT_BROKEN; /* Embedded 0 in buf?! */ - } - if(*need_tag) - return (xer_check_tag_e)(XCT__UNK__MASK | ct); + if (*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); return ct; } +#undef ADVANCE +#define ADVANCE(num_bytes) \ + do \ + { \ + size_t num = (num_bytes); \ + buf_ptr = ((const char *)buf_ptr) + num; \ + size -= num; \ + consumed_myself += num; \ + } \ + while (0) -#undef ADVANCE -#define ADVANCE(num_bytes) do { \ - size_t num = (num_bytes); \ - buf_ptr = ((const char *)buf_ptr) + num; \ - size -= num; \ - consumed_myself += num; \ - } while(0) +#undef RETURN +#define RETURN(_code) \ + do \ + { \ + rval.code = _code; \ + rval.consumed = consumed_myself; \ + if (rval.code != RC_OK) ASN_DEBUG("Failed with %d", rval.code); \ + return rval; \ + } \ + while (0) -#undef RETURN -#define RETURN(_code) do { \ - rval.code = _code; \ - rval.consumed = consumed_myself; \ - if(rval.code != RC_OK) \ - ASN_DEBUG("Failed with %d", rval.code); \ - return rval; \ - } while(0) - -#define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ - ssize_t converted_size = body_receiver \ - (struct_key, chunk_buf, chunk_size, \ - (size_t)(chunk_size) < (size)); \ - if(converted_size == -1) RETURN(RC_FAIL); \ - if(converted_size == 0 \ - && (size) == (size_t)(chunk_size)) \ - RETURN(RC_WMORE); \ - (chunk_size) = converted_size; \ - } while(0) -#define XER_GOT_EMPTY() do { \ - if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ - RETURN(RC_FAIL); \ - } while(0) +#define XER_GOT_BODY(chunk_buf, chunk_size, size) \ + do \ + { \ + ssize_t converted_size = \ + body_receiver(struct_key, chunk_buf, chunk_size, \ + (size_t)(chunk_size) < (size)); \ + if (converted_size == -1) RETURN(RC_FAIL); \ + if (converted_size == 0 && (size) == (size_t)(chunk_size)) \ + RETURN(RC_WMORE); \ + (chunk_size) = converted_size; \ + } \ + while (0) +#define XER_GOT_EMPTY() \ + do \ + { \ + if (body_receiver(struct_key, 0, 0, size > 0) == -1) \ + RETURN(RC_FAIL); \ + } \ + while (0) /* * Generalized function for decoding the primitive values. */ -asn_dec_rval_t -xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, - asn_struct_ctx_t *ctx, /* Type decoder context */ - void *struct_key, - const char *xml_tag, /* Expected XML tag */ +asn_dec_rval_t xer_decode_general( + asn_codec_ctx_t *opt_codec_ctx, + asn_struct_ctx_t *ctx, /* Type decoder context */ + void *struct_key, const char *xml_tag, /* Expected XML tag */ const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder) - (void *struct_key, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver) - (void *struct_key, const void *chunk_buf, size_t chunk_size, - int have_more) - ) { - + int (*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, + size_t chunk_size, int have_more)) +{ asn_dec_rval_t rval; ssize_t consumed_myself = 0; @@ -220,145 +246,160 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. */ - if(ctx->phase > 1) RETURN(RC_FAIL); - for(;;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ - ssize_t ch_size; /* Chunk size */ - xer_check_tag_e tcv; /* Tag check value */ + if (ctx->phase > 1) RETURN(RC_FAIL); + for (;;) + { + pxer_chunk_type_e ch_type; /* XER chunk type */ + ssize_t ch_size; /* Chunk size */ + xer_check_tag_e tcv; /* Tag check value */ - /* - * Get the next part of the XML stream. - */ - ch_size = xer_next_token(&ctx->context, buf_ptr, size, - &ch_type); - switch(ch_size) { - case -1: RETURN(RC_FAIL); - case 0: - RETURN(RC_WMORE); - default: - switch(ch_type) { - case PXER_COMMENT: /* Got XML comment */ - ADVANCE(ch_size); /* Skip silently */ - continue; - case PXER_TEXT: - if(ctx->phase == 0) { - /* - * We have to ignore whitespace here, - * but in order to be forward compatible - * with EXTENDED-XER (EMBED-VALUES, #25) - * any text is just ignored here. - */ - } else { - XER_GOT_BODY(buf_ptr, ch_size, size); - } - ADVANCE(ch_size); - continue; - case PXER_TAG: - break; /* Check the rest down there */ - } - } - - assert(ch_type == PXER_TAG && size); - - tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); - /* - * Phase 0: - * Expecting the opening tag - * for the type being processed. - * Phase 1: - * Waiting for the closing XML tag. - */ - switch(tcv) { - case XCT_BOTH: - if(ctx->phase) break; - /* Finished decoding of an empty element */ - XER_GOT_EMPTY(); - ADVANCE(ch_size); - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); - case XCT_OPENING: - if(ctx->phase) break; - ADVANCE(ch_size); - ctx->phase = 1; /* Processing body phase */ - continue; - case XCT_CLOSING: - if(!ctx->phase) break; - ADVANCE(ch_size); - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); - case XCT_UNKNOWN_BO: /* - * Certain tags in the body may be expected. + * Get the next part of the XML stream. */ - if(opt_unexpected_tag_decoder - && opt_unexpected_tag_decoder(struct_key, - buf_ptr, ch_size) >= 0) { - /* Tag's processed fine */ - ADVANCE(ch_size); - if(!ctx->phase) { - /* We are not expecting - * the closing tag anymore. */ - ctx->phase = 2; /* Phase out */ - RETURN(RC_OK); + ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); + switch (ch_size) + { + case -1: + RETURN(RC_FAIL); + case 0: + RETURN(RC_WMORE); + default: + switch (ch_type) + { + case PXER_COMMENT: /* Got XML comment */ + ADVANCE(ch_size); /* Skip silently */ + continue; + case PXER_TEXT: + if (ctx->phase == 0) + { + /* + * We have to ignore whitespace + * here, but in order to be forward + * compatible with EXTENDED-XER + * (EMBED-VALUES, #25) any text is + * just ignored here. + */ + } + else + { + XER_GOT_BODY(buf_ptr, ch_size, + size); + } + ADVANCE(ch_size); + continue; + case PXER_TAG: + break; /* Check the rest down there */ + } } - continue; - } - /* Fall through */ - default: - break; /* Unexpected tag */ - } - ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); - break; /* Dark and mysterious things have just happened */ - } + assert(ch_type == PXER_TAG && size); + + tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); + /* + * Phase 0: + * Expecting the opening tag + * for the type being processed. + * Phase 1: + * Waiting for the closing XML tag. + */ + switch (tcv) + { + case XCT_BOTH: + if (ctx->phase) break; + /* Finished decoding of an empty element */ + XER_GOT_EMPTY(); + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_OPENING: + if (ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 1; /* Processing body phase */ + continue; + case XCT_CLOSING: + if (!ctx->phase) break; + ADVANCE(ch_size); + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + case XCT_UNKNOWN_BO: + /* + * Certain tags in the body may be expected. + */ + if (opt_unexpected_tag_decoder && + opt_unexpected_tag_decoder(struct_key, buf_ptr, + ch_size) >= 0) + { + /* Tag's processed fine */ + ADVANCE(ch_size); + if (!ctx->phase) + { + /* We are not expecting + * the closing tag anymore. */ + ctx->phase = 2; /* Phase out */ + RETURN(RC_OK); + } + continue; + } + /* Fall through */ + default: + break; /* Unexpected tag */ + } + + ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); + break; /* Dark and mysterious things have just happened */ + } RETURN(RC_FAIL); } - -int -xer_is_whitespace(const void *chunk_buf, size_t chunk_size) { +int xer_is_whitespace(const void *chunk_buf, size_t chunk_size) +{ const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; - for(; p < pend; p++) { - switch(*p) { - /* X.693, #8.1.4 - * HORISONTAL TAB (9) - * LINE FEED (10) - * CARRIAGE RETURN (13) - * SPACE (32) - */ - case 0x09: case 0x0a: case 0x0d: case 0x20: - break; - default: - return 0; + for (; p < pend; p++) + { + switch (*p) + { + /* X.693, #8.1.4 + * HORISONTAL TAB (9) + * LINE FEED (10) + * CARRIAGE RETURN (13) + * SPACE (32) + */ + case 0x09: + case 0x0a: + case 0x0d: + case 0x20: + break; + default: + return 0; + } } - } - return 1; /* All whitespace */ + return 1; /* All whitespace */ } /* * This is a vastly simplified, non-validating XML tree skipper. */ -int -xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { +int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) +{ assert(*depth > 0); - switch(tcv) { - case XCT_BOTH: - case XCT_UNKNOWN_BO: - /* These negate each other. */ - return 0; - case XCT_OPENING: - case XCT_UNKNOWN_OP: - ++(*depth); - return 0; - case XCT_CLOSING: - case XCT_UNKNOWN_CL: - if(--(*depth) == 0) - return (tcv == XCT_CLOSING) ? 2 : 1; - return 0; - default: - return -1; - } + switch (tcv) + { + case XCT_BOTH: + case XCT_UNKNOWN_BO: + /* These negate each other. */ + return 0; + case XCT_OPENING: + case XCT_UNKNOWN_OP: + ++(*depth); + return 0; + case XCT_CLOSING: + case XCT_UNKNOWN_CL: + if (--(*depth) == 0) return (tcv == XCT_CLOSING) ? 2 : 1; + return 0; + default: + return -1; + } } diff --git a/src/core/libs/supl/asn-supl/xer_decoder.h b/src/core/libs/supl/asn-supl/xer_decoder.h index ebd323450..eee9777e1 100644 --- a/src/core/libs/supl/asn-supl/xer_decoder.h +++ b/src/core/libs/supl/asn-supl/xer_decoder.h @@ -15,62 +15,65 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ /* - * The XER decoder of any ASN.1 type. May be invoked by the application. - */ - asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, - struct asn_TYPE_descriptor_s *td, + * The XER decoder of any ASN.1 type. May be invoked by the application. + */ + asn_dec_rval_t xer_decode( + struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *td, void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ size_t size /* Size of data buffer */ ); /* - * Type of the type-specific XER decoder function. - */ - typedef asn_dec_rval_t(xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, - struct asn_TYPE_descriptor_s *type_descriptor, - void **struct_ptr, + * Type of the type-specific XER decoder function. + */ + typedef asn_dec_rval_t(xer_type_decoder_f)( + asn_codec_ctx_t *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, const char *opt_mname, /* Member name */ const void *buf_ptr, size_t size); /******************************* - * INTERNALLY USEFUL FUNCTIONS * - *******************************/ + * INTERNALLY USEFUL FUNCTIONS * + *******************************/ /* - * Generalized function for decoding the primitive values. - * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 - * and others. This function should not be used by applications, as its API - * is subject to changes. - */ - asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, + * Generalized function for decoding the primitive values. + * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 + * and others. This function should not be used by applications, as its API + * is subject to changes. + */ + asn_dec_rval_t xer_decode_general( + asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, /* Type decoder context */ void *struct_key, /* Treated as opaque pointer */ const char *xml_tag, /* Expected XML tag name */ const void *buf_ptr, size_t size, - int (*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, size_t chunk_size), - ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, size_t chunk_size, - int have_more)); - + int (*opt_unexpected_tag_decoder)(void *struct_key, + const void *chunk_buf, + size_t chunk_size), + ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf, + size_t chunk_size, int have_more)); /* - * Fetch the next XER (XML) token from the stream. - * The function returns the number of bytes occupied by the chunk type, - * returned in the _ch_type. The _ch_type is only set (and valid) when - * the return value is greater than 0. - */ + * Fetch the next XER (XML) token from the stream. + * The function returns the number of bytes occupied by the chunk type, + * returned in the _ch_type. The _ch_type is only set (and valid) when + * the return value is greater than 0. + */ typedef enum pxer_chunk_type { PXER_TAG, /* Complete XER tag */ PXER_TEXT, /* Plain text between XER tags */ PXER_COMMENT /* A comment, may be part of */ } pxer_chunk_type_e; - ssize_t xer_next_token(int *stateContext, - const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); + ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, + pxer_chunk_type_e *_ch_type); /* - * This function checks the buffer against the tag name is expected to occur. - */ + * This function checks the buffer against the tag name is expected to + * occur. + */ typedef enum xer_check_tag { XCT_BROKEN = 0, /* The tag is broken */ @@ -83,19 +86,19 @@ extern "C" XCT_UNKNOWN_BO = 7 /* Unexpected tag */ } xer_check_tag_e; xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, - const char *need_tag); + const char *need_tag); /* - * Check whether this buffer consists of entirely XER whitespace characters. - * RETURN VALUES: - * 1: Whitespace or empty string - * 0: Non-whitespace - */ + * Check whether this buffer consists of entirely XER whitespace characters. + * RETURN VALUES: + * 1: Whitespace or empty string + * 0: Non-whitespace + */ int xer_is_whitespace(const void *chunk_buf, size_t chunk_size); /* - * Skip the series of anticipated extensions. - */ + * Skip the series of anticipated extensions. + */ int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/xer_encoder.c b/src/core/libs/supl/asn-supl/xer_encoder.c index c7df92060..e723695ae 100644 --- a/src/core/libs/supl/asn-supl/xer_encoder.c +++ b/src/core/libs/supl/asn-supl/xer_encoder.c @@ -9,17 +9,17 @@ /* * The XER encoder of any type. May be invoked by the application. */ -asn_enc_rval_t -xer_encode(asn_TYPE_descriptor_t *td, void *sptr, - enum xer_encoder_flags_e xer_flags, - asn_app_consume_bytes_f *cb, void *app_key) { +asn_enc_rval_t xer_encode(asn_TYPE_descriptor_t *td, void *sptr, + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *cb, void *app_key) +{ asn_enc_rval_t er; asn_enc_rval_t tmper; const char *mname; size_t mlen; int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; - if(!td || !sptr) goto cb_failed; + if (!td || !sptr) goto cb_failed; mname = td->xml_tag; mlen = strlen(mname); @@ -27,7 +27,7 @@ xer_encode(asn_TYPE_descriptor_t *td, void *sptr, _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1); tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); - if(tmper.encoded == -1) return tmper; + if (tmper.encoded == -1) return tmper; _ASN_CALLBACK3("\n", xcan); @@ -42,27 +42,24 @@ cb_failed: * This is a helper function for xer_fprint, which directs all incoming data * into the provided file descriptor. */ -static int -xer__print2fp(const void *buffer, size_t size, void *app_key) { +static int xer__print2fp(const void *buffer, size_t size, void *app_key) +{ FILE *stream = (FILE *)app_key; - if(fwrite(buffer, 1, size, stream) != size) - return -1; + if (fwrite(buffer, 1, size, stream) != size) return -1; return 0; } -int -xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { +int xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) +{ asn_enc_rval_t er; - if(!stream) stream = stdout; - if(!td || !sptr) - return -1; + if (!stream) stream = stdout; + if (!td || !sptr) return -1; er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); - if(er.encoded == -1) - return -1; + if (er.encoded == -1) return -1; return fflush(stream); } diff --git a/src/core/libs/supl/asn-supl/xer_encoder.h b/src/core/libs/supl/asn-supl/xer_encoder.h index 5edf7b56d..c6e9e6c38 100644 --- a/src/core/libs/supl/asn-supl/xer_encoder.h +++ b/src/core/libs/supl/asn-supl/xer_encoder.h @@ -14,7 +14,8 @@ extern "C" struct asn_TYPE_descriptor_s; /* Forward declaration */ - /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ + /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below + */ enum xer_encoder_flags_e { /* Mode of encoding */ @@ -23,35 +24,35 @@ extern "C" }; /* - * The XER encoder of any type. May be invoked by the application. - */ + * The XER encoder of any type. May be invoked by the application. + */ asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *td, - void *sptr, /* Structure to be encoded */ - enum xer_encoder_flags_e xer_flags, - asn_app_consume_bytes_f *consume_bytes_cb, - void *app_key /* Arbitrary callback argument */ + void *sptr, /* Structure to be encoded */ + enum xer_encoder_flags_e xer_flags, + asn_app_consume_bytes_f *consume_bytes_cb, + void *app_key /* Arbitrary callback argument */ ); /* - * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) - * output into the chosen file pointer. - * RETURN VALUES: - * 0: The structure is printed. - * -1: Problem printing the structure. - * WARNING: No sensible errno value is returned. - */ + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen file pointer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); /* - * Type of the generic XER encoder. - */ + * Type of the generic XER encoder. + */ typedef asn_enc_rval_t(xer_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int ilevel, /* Level of indentation */ enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ - void *app_key /* Arbitrary callback argument */ + void *app_key /* Arbitrary callback argument */ ); #ifdef __cplusplus diff --git a/src/core/libs/supl/asn-supl/xer_support.c b/src/core/libs/supl/asn-supl/xer_support.c index 96e3d9e51..fca8b4fac 100644 --- a/src/core/libs/supl/asn-supl/xer_support.c +++ b/src/core/libs/supl/asn-supl/xer_support.c @@ -8,226 +8,253 @@ #include /* Parser states */ -typedef enum { +typedef enum +{ ST_TEXT, ST_TAG_START, ST_TAG_BODY, ST_TAG_QUOTE_WAIT, ST_TAG_QUOTED_STRING, ST_TAG_UNQUOTED_STRING, - ST_COMMENT_WAIT_DASH1, /* ""[0] */ - ST_COMMENT_CLO_RT /* "-->"[1] */ + ST_COMMENT_CLO_DASH2, /* "-->"[0] */ + ST_COMMENT_CLO_RT /* "-->"[1] */ } pstate_e; static pxml_chunk_type_e final_chunk_type[] = { - PXML_TEXT, - PXML_TAG_END, - PXML_COMMENT_END, - PXML_TAG_END, - PXML_COMMENT_END, + PXML_TEXT, PXML_TAG_END, PXML_COMMENT_END, PXML_TAG_END, PXML_COMMENT_END, }; - -static int -_charclass[256] = { - 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, - 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, - 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, - 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ - 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ - 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ - 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ - 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ +static int _charclass[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, /* 01234567 89 + */ + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* ABCDEFG HIJKLMNO */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, /* PQRSTUVW XYZ */ + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* abcdefg hijklmno */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0 /* pqrstuvw xyz */ }; -#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) -#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) -#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) +#define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) +#define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) +#define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) /* Aliases for characters, ASCII/UTF-8 */ -#define EXCLAM 0x21 /* '!' */ -#define CQUOTE 0x22 /* '"' */ -#define CDASH 0x2d /* '-' */ -#define CSLASH 0x2f /* '/' */ -#define LANGLE 0x3c /* '<' */ -#define CEQUAL 0x3d /* '=' */ -#define RANGLE 0x3e /* '>' */ -#define CQUEST 0x3f /* '?' */ +#define EXCLAM 0x21 /* '!' */ +#define CQUOTE 0x22 /* '"' */ +#define CDASH 0x2d /* '-' */ +#define CSLASH 0x2f /* '/' */ +#define LANGLE 0x3c /* '<' */ +#define CEQUAL 0x3d /* '=' */ +#define RANGLE 0x3e /* '>' */ +#define CQUEST 0x3f /* '?' */ /* Invoke token callback */ -#define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ - int _ret; \ - pstate_e ns = _ns; \ - ssize_t _sz = (p - chunk_start) + (_current_too); \ - if (!_sz) { \ - /* Shortcut */ \ - state = _ns; \ - break; \ - } \ - _ret = cb(type, chunk_start, _sz, key); \ - if(_ret < _sz) { \ - if((_current_too) && _ret == -1) \ - state = ns; \ - goto finish; \ - } \ - chunk_start = p + (_current_too); \ - state = ns; \ - } while(0) +#define TOKEN_CB_CALL(type, _ns, _current_too, _final) \ + do \ + { \ + int _ret; \ + pstate_e ns = _ns; \ + ssize_t _sz = (p - chunk_start) + (_current_too); \ + if (!_sz) \ + { \ + /* Shortcut */ \ + state = _ns; \ + break; \ + } \ + _ret = cb(type, chunk_start, _sz, key); \ + if (_ret < _sz) \ + { \ + if ((_current_too) && _ret == -1) state = ns; \ + goto finish; \ + } \ + chunk_start = p + (_current_too); \ + state = ns; \ + } \ + while (0) -#define TOKEN_CB(_type, _ns, _current_too) \ +#define TOKEN_CB(_type, _ns, _current_too) \ TOKEN_CB_CALL(_type, _ns, _current_too, 0) -#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ +#define TOKEN_CB_FINAL(_type, _ns, _current_too) \ TOKEN_CB_CALL(final_chunk_type[_type], _ns, _current_too, 1) /* * Parser itself */ -ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { +ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, + pxml_callback_f *cb, void *key) +{ pstate_e state = (pstate_e)*stateContext; const char *chunk_start = (const char *)xmlbuf; const char *p = chunk_start; const char *end = p + size; - for(; p < end; p++) { - int C = *(const unsigned char *)p; - switch(state) { - case ST_TEXT: - /* - * Initial state: we're in the middle of some text, - * or just have started. - */ - if (C == LANGLE) - /* We're now in the tag, probably */ - TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); - break; - case ST_TAG_START: - if (ALPHA(C) || (C == CSLASH)) - state = ST_TAG_BODY; - else if (C == EXCLAM) - state = ST_COMMENT_WAIT_DASH1; - else - /* - * Not characters and not whitespace. - * Must be something like "3 < 4". - */ - TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ - break; - case ST_TAG_BODY: - switch(C) { - case RANGLE: - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - break; - case LANGLE: - /* - * The previous tag wasn't completed, but still - * recognized as valid. (Mozilla-compatible) - */ - TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); - break; - case CEQUAL: - state = ST_TAG_QUOTE_WAIT; - break; - } - break; - case ST_TAG_QUOTE_WAIT: - /* - * State after the equal sign ("=") in the tag. - */ - switch(C) { - case CQUOTE: - state = ST_TAG_QUOTED_STRING; - break; - case RANGLE: - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - break; - default: - if(!WHITESPACE(C)) - /* Unquoted string value */ - state = ST_TAG_UNQUOTED_STRING; - } - break; - case ST_TAG_QUOTED_STRING: - /* - * Tag attribute's string value in quotes. - */ - if(C == CQUOTE) { - /* Return back to the tag state */ - state = ST_TAG_BODY; - } - break; - case ST_TAG_UNQUOTED_STRING: - if(C == RANGLE) { - /* End of the tag */ - TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); - } else if(WHITESPACE(C)) { - /* Return back to the tag state */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT_WAIT_DASH1: - if(C == CDASH) { - state = ST_COMMENT_WAIT_DASH2; - } else { - /* Some ordinary tag. */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT_WAIT_DASH2: - if(C == CDASH) { - /* Seen "<--" */ - state = ST_COMMENT; - } else { - /* Some ordinary tag */ - state = ST_TAG_BODY; - } - break; - case ST_COMMENT: - if(C == CDASH) { - state = ST_COMMENT_CLO_DASH2; - } - break; - case ST_COMMENT_CLO_DASH2: - if(C == CDASH) { - state = ST_COMMENT_CLO_RT; - } else { - /* This is not an end of a comment */ - state = ST_COMMENT; - } - break; - case ST_COMMENT_CLO_RT: - if(C == RANGLE) { - TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); - } else if(C == CDASH) { - /* Maintain current state, still waiting for '>' */ - } else { - state = ST_COMMENT; - } - break; - } /* switch(*ptr) */ - } /* for() */ + for (; p < end; p++) + { + int C = *(const unsigned char *)p; + switch (state) + { + case ST_TEXT: + /* + * Initial state: we're in the middle of some text, + * or just have started. + */ + if (C == LANGLE) /* We're now in the tag, probably */ + TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); + break; + case ST_TAG_START: + if (ALPHA(C) || (C == CSLASH)) + state = ST_TAG_BODY; + else if (C == EXCLAM) + state = ST_COMMENT_WAIT_DASH1; + else + /* + * Not characters and not whitespace. + * Must be something like "3 < 4". + */ + TOKEN_CB(PXML_TEXT, ST_TEXT, 1); /* Flush as data */ + break; + case ST_TAG_BODY: + switch (C) + { + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + case LANGLE: + /* + * The previous tag wasn't completed, but + * still recognized as valid. + * (Mozilla-compatible) + */ + TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); + break; + case CEQUAL: + state = ST_TAG_QUOTE_WAIT; + break; + } + break; + case ST_TAG_QUOTE_WAIT: + /* + * State after the equal sign ("=") in the tag. + */ + switch (C) + { + case CQUOTE: + state = ST_TAG_QUOTED_STRING; + break; + case RANGLE: + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + break; + default: + if (!WHITESPACE( + C)) /* Unquoted string value */ + state = ST_TAG_UNQUOTED_STRING; + } + break; + case ST_TAG_QUOTED_STRING: + /* + * Tag attribute's string value in quotes. + */ + if (C == CQUOTE) + { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_TAG_UNQUOTED_STRING: + if (C == RANGLE) + { + /* End of the tag */ + TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); + } + else if (WHITESPACE(C)) + { + /* Return back to the tag state */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH1: + if (C == CDASH) + { + state = ST_COMMENT_WAIT_DASH2; + } + else + { + /* Some ordinary tag. */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT_WAIT_DASH2: + if (C == CDASH) + { + /* Seen "<--" */ + state = ST_COMMENT; + } + else + { + /* Some ordinary tag */ + state = ST_TAG_BODY; + } + break; + case ST_COMMENT: + if (C == CDASH) + { + state = ST_COMMENT_CLO_DASH2; + } + break; + case ST_COMMENT_CLO_DASH2: + if (C == CDASH) + { + state = ST_COMMENT_CLO_RT; + } + else + { + /* This is not an end of a comment */ + state = ST_COMMENT; + } + break; + case ST_COMMENT_CLO_RT: + if (C == RANGLE) + { + TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); + } + else if (C == CDASH) + { + /* Maintain current state, still waiting for '>' + */ + } + else + { + state = ST_COMMENT; + } + break; + } /* switch(*ptr) */ + } /* for() */ /* * Flush the partially processed chunk, state permitting. */ - if(p - chunk_start) { - switch (state) { - case ST_COMMENT: - TOKEN_CB(PXML_COMMENT, state, 0); - break; - case ST_TEXT: - TOKEN_CB(PXML_TEXT, state, 0); - break; - default: break; /* a no-op */ + if (p - chunk_start) + { + switch (state) + { + case ST_COMMENT: + TOKEN_CB(PXML_COMMENT, state, 0); + break; + case ST_TEXT: + TOKEN_CB(PXML_TEXT, state, 0); + break; + default: + break; /* a no-op */ + } } - } finish: *stateContext = (int)state; return chunk_start - (const char *)xmlbuf; } - diff --git a/src/core/libs/supl/asn-supl/xer_support.h b/src/core/libs/supl/asn-supl/xer_support.h index ca71776c0..af413aae4 100644 --- a/src/core/libs/supl/asn-supl/xer_support.h +++ b/src/core/libs/supl/asn-supl/xer_support.h @@ -14,41 +14,42 @@ extern "C" #endif /* - * Types of data transferred to the application. - */ + * Types of data transferred to the application. + */ typedef enum { PXML_TEXT, /* Plain text between XML tags. */ PXML_TAG, /* A tag, starting with '<'. */ PXML_COMMENT, /* An XML comment, including "". */ /* - * The following chunk types are reported if the chunk - * terminates the specified XML element. - */ + * The following chunk types are reported if the chunk + * terminates the specified XML element. + */ PXML_TAG_END, /* Tag ended */ PXML_COMMENT_END /* Comment ended */ } pxml_chunk_type_e; /* - * Callback function that is called by the parser when parsed data is - * available. The _opaque is the pointer to a field containing opaque user - * data specified in pxml_create() call. The chunk type is _type and the text - * data is the piece of buffer identified by _bufid (as supplied to - * pxml_feed() call) starting at offset _offset and of _size bytes size. - * The chunk is NOT '\0'-terminated. - */ + * Callback function that is called by the parser when parsed data is + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the + * text data is the piece of buffer identified by _bufid (as supplied to + * pxml_feed() call) starting at offset _offset and of _size bytes size. + * The chunk is NOT '\0'-terminated. + */ typedef int(pxml_callback_f)(pxml_chunk_type_e _type, - const void *_chunk_data, size_t _chunk_size, void *_key); + const void *_chunk_data, size_t _chunk_size, + void *_key); /* - * Parse the given buffer as it were a chunk of XML data. - * Invoke the specified callback each time the meaningful data is found. - * This function returns number of bytes consumed from the buffer. - * It will always be lesser than or equal to the specified _size. - * The next invocation of this function must account the difference. - */ + * Parse the given buffer as it were a chunk of XML data. + * Invoke the specified callback each time the meaningful data is found. + * This function returns number of bytes consumed from the buffer. + * It will always be lesser than or equal to the specified _size. + * The next invocation of this function must account the difference. + */ ssize_t pxml_parse(int *_stateContext, const void *xmlbuf, size_t _size, - pxml_callback_f *cb, void *_key); + pxml_callback_f *cb, void *_key); #ifdef __cplusplus }