1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-08 09:34:10 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-08-17 01:31:06 +02:00
commit c3a4c49ffd
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
35 changed files with 2988 additions and 2333 deletions

View File

@ -270,7 +270,19 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif(${DARWIN_VERSION} MATCHES "10") endif(${DARWIN_VERSION} MATCHES "10")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
#select the release build type by default to get optimization flags # Define extra build types and select Release by default to get optimization flags
include(GnsssdrBuildTypes)
# Available options:
# - None: nothing set
# - Debug: -O2 -g
# - Release: -O3
# - RelWithDebInfo: -O3 -g
# - MinSizeRel: -Os
# - Coverage: -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage
# - NoOptWithASM: -O0 -g -save-temps
# - O2WithASM: -O2 -g -save-temps
# - O3WithASM: -O3 -g -save-temps
# - ASAN: -Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
if(ENABLE_GPERFTOOLS OR ENABLE_GPROF) if(ENABLE_GPERFTOOLS OR ENABLE_GPROF)
set(CMAKE_BUILD_TYPE "RelWithDebInfo") set(CMAKE_BUILD_TYPE "RelWithDebInfo")
@ -282,11 +294,9 @@ if(NOT CMAKE_BUILD_TYPE)
else(NOT CMAKE_BUILD_TYPE) else(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.")
endif(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE)
GNSSSDR_CHECK_BUILD_TYPE(${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# Append -O2 optimization flag for Debug builds
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
# allow 'large' files in 32 bit builds # allow 'large' files in 32 bit builds
if(UNIX) if(UNIX)
add_definitions( -D_LARGEFILE_SOURCE add_definitions( -D_LARGEFILE_SOURCE

View File

@ -0,0 +1,219 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
if(DEFINED __INCLUDED_GNSSSDR_BUILD_TYPES_CMAKE)
return()
endif()
set(__INCLUDED_GNSSSDR_BUILD_TYPES_CMAKE TRUE)
# Standard CMake Build Types and their basic CFLAGS:
# - None: nothing set
# - Debug: -O2 -g
# - Release: -O3
# - RelWithDebInfo: -O3 -g
# - MinSizeRel: -Os
# Additional Build Types, defined below:
# - NoOptWithASM: -O0 -g -save-temps
# - O2WithASM: -O2 -g -save-temps
# - O3WithASM: -O3 -g -save-temps
# Defines the list of acceptable cmake build types. When adding a new
# build type below, make sure to add it to this list.
list(APPEND AVAIL_BUILDTYPES
None Debug Release RelWithDebInfo MinSizeRel
Coverage NoOptWithASM O2WithASM O3WithASM ASAN
)
########################################################################
# GNSSSDR_CHECK_BUILD_TYPE(build type)
#
# Use this to check that the build type set in CMAKE_BUILD_TYPE on the
# commandline is one of the valid build types used by this project. It
# checks the value set in the cmake interface against the list of
# known build types in AVAIL_BUILDTYPES. If the build type is found,
# the function exits immediately. If nothing is found by the end of
# checking all available build types, we exit with an error and list
# the avialable build types.
########################################################################
function(GNSSSDR_CHECK_BUILD_TYPE settype)
string(TOUPPER ${settype} _settype)
foreach(btype ${AVAIL_BUILDTYPES})
string(TOUPPER ${btype} _btype)
if(${_settype} STREQUAL ${_btype})
return() # found it; exit cleanly
endif(${_settype} STREQUAL ${_btype})
endforeach(btype)
# Build type not found; error out
message(FATAL_ERROR "Build type '${settype}' not valid, must be one of: ${AVAIL_BUILDTYPES}")
endfunction(GNSSSDR_CHECK_BUILD_TYPE)
########################################################################
# For GCC and Clang, we can set a build type:
#
# -DCMAKE_BUILD_TYPE=Coverage
#
# This type uses no optimization (-O0), outputs debug symbols (-g) and
# outputs all intermediary files the build system produces, including
# all assembly (.s) files. Look in the build directory for these
# files.
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
set(CMAKE_CXX_FLAGS_COVERAGE "-Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING
"Flags used by the C++ compiler during Coverage builds." FORCE)
set(CMAKE_C_FLAGS_COVERAGE "-Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING
"Flags used by the C compiler during Coverage builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"-Wl" CACHE STRING
"Flags used for linking binaries during Coverage builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
"-Wl" CACHE STRING
"Flags used by the shared lib linker during Coverage builds." FORCE)
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE)
endif(NOT WIN32)
########################################################################
# For GCC and Clang, we can set a build type:
#
# -DCMAKE_BUILD_TYPE=NoOptWithASM
#
# This type uses no optimization (-O0), outputs debug symbols (-g) and
# outputs all intermediary files the build system produces, including
# all assembly (.s) files. Look in the build directory for these
# files.
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
set(CMAKE_CXX_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
"Flags used by the C++ compiler during NoOptWithASM builds." FORCE)
set(CMAKE_C_FLAGS_NOOPTWITHASM "-Wall -save-temps -g -O0" CACHE STRING
"Flags used by the C compiler during NoOptWithASM builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
"-Wl" CACHE STRING
"Flags used for linking binaries during NoOptWithASM builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM
"-Wl" CACHE STRING
"Flags used by the shared lib linker during NoOptWithASM builds." FORCE)
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_NOOPTWITHASM
CMAKE_C_FLAGS_NOOPTWITHASM
CMAKE_EXE_LINKER_FLAGS_NOOPTWITHASM
CMAKE_SHARED_LINKER_FLAGS_NOOPTWITHASM)
endif(NOT WIN32)
########################################################################
# For GCC and Clang, we can set a build type:
#
# -DCMAKE_BUILD_TYPE=O2WithASM
#
# This type uses level 2 optimization (-O2), outputs debug symbols
# (-g) and outputs all intermediary files the build system produces,
# including all assembly (.s) files. Look in the build directory for
# these files.
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
set(CMAKE_CXX_FLAGS_O2WITHASM "-Wall -save-temps -g -O2" CACHE STRING
"Flags used by the C++ compiler during O2WithASM builds." FORCE)
set(CMAKE_C_FLAGS_O2WITHASM "-Wall -save-temps -g -O2" CACHE STRING
"Flags used by the C compiler during O2WithASM builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_O2WITHASM
"-Wl" CACHE STRING
"Flags used for linking binaries during O2WithASM builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_O2WITHASM
"-Wl" CACHE STRING
"Flags used by the shared lib linker during O2WithASM builds." FORCE)
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_O2WITHASM
CMAKE_C_FLAGS_O2WITHASM
CMAKE_EXE_LINKER_FLAGS_O2WITHASM
CMAKE_SHARED_LINKER_FLAGS_O2WITHASM)
endif(NOT WIN32)
########################################################################
# For GCC and Clang, we can set a build type:
#
# -DCMAKE_BUILD_TYPE=O3WithASM
#
# This type uses level 3 optimization (-O3), outputs debug symbols
# (-g) and outputs all intermediary files the build system produces,
# including all assembly (.s) files. Look in the build directory for
# these files.
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
set(CMAKE_CXX_FLAGS_O3WITHASM "-Wall -save-temps -g -O3" CACHE STRING
"Flags used by the C++ compiler during O3WithASM builds." FORCE)
set(CMAKE_C_FLAGS_O3WITHASM "-Wall -save-temps -g -O3" CACHE STRING
"Flags used by the C compiler during O3WithASM builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_O3WITHASM
"-Wl" CACHE STRING
"Flags used for linking binaries during O3WithASM builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_O3WITHASM
"-Wl" CACHE STRING
"Flags used by the shared lib linker during O3WithASM builds." FORCE)
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_O3WITHASM
CMAKE_C_FLAGS_O3WITHASM
CMAKE_EXE_LINKER_FLAGS_O3WITHASM
CMAKE_SHARED_LINKER_FLAGS_O3WITHASM)
endif(NOT WIN32)
########################################################################
# For GCC and Clang, we can set a build type:
#
# -DCMAKE_BUILD_TYPE=ASAN
#
# This type creates an address sanitized build (-fsanitize=address)
# and defaults to the DebugParanoid linker flags.
# NOTE: This is not defined on Windows systems.
########################################################################
if(NOT WIN32)
set(CMAKE_CXX_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler during Address Sanitized builds." FORCE)
set(CMAKE_C_FLAGS_ASAN "-Wall -Wextra -g -O2 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler during Address Sanitized builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_ASAN
"-Wl" CACHE STRING
"Flags used for linking binaries during Address Sanitized builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"-Wl" CACHE STRING
"Flags used by the shared lib linker during Address Sanitized builds." FORCE)
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_ASAN
CMAKE_C_FLAGS_ASAN
CMAKE_EXE_LINKER_FLAGS_ASAN
CMAKE_SHARED_LINKER_ASAN)
endif(NOT WIN32)

View File

@ -504,7 +504,7 @@ bool RtklibPvt::save_assistance_to_XML()
LOG(INFO) << "SUPL: Try to save GPS ephemeris to XML file " << eph_xml_filename_; LOG(INFO) << "SUPL: Try to save GPS ephemeris to XML file " << eph_xml_filename_;
std::map<int, Gps_Ephemeris> eph_map = pvt_->get_GPS_L1_ephemeris_map(); std::map<int, Gps_Ephemeris> eph_map = pvt_->get_GPS_L1_ephemeris_map();
if (eph_map.size() > 0) if (eph_map.empty() == false)
{ {
try try
{ {

View File

@ -412,7 +412,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
// save GPS L2CM ephemeris to XML file // save GPS L2CM ephemeris to XML file
std::string file_name = "eph_GPS_CNAV.xml"; std::string file_name = "eph_GPS_CNAV.xml";
if (d_ls_pvt->gps_cnav_ephemeris_map.size() > 0) if (d_ls_pvt->gps_cnav_ephemeris_map.empty() == false)
{ {
try try
{ {
@ -435,7 +435,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
// save GPS L1 CA ephemeris to XML file // save GPS L1 CA ephemeris to XML file
file_name = "eph_GPS_L1CA.xml"; file_name = "eph_GPS_L1CA.xml";
if (d_ls_pvt->gps_ephemeris_map.size() > 0) if (d_ls_pvt->gps_ephemeris_map.empty() == false)
{ {
try try
{ {
@ -458,7 +458,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
// save Galileo E1 ephemeris to XML file // save Galileo E1 ephemeris to XML file
file_name = "eph_Galileo_E1.xml"; file_name = "eph_Galileo_E1.xml";
if (d_ls_pvt->galileo_ephemeris_map.size() > 0) if (d_ls_pvt->galileo_ephemeris_map.empty() == false)
{ {
try try
{ {
@ -481,7 +481,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc()
// save GLONASS GNAV ephemeris to XML file // save GLONASS GNAV ephemeris to XML file
file_name = "eph_GLONASS_GNAV.xml"; file_name = "eph_GLONASS_GNAV.xml";
if (d_ls_pvt->glonass_gnav_ephemeris_map.size() > 0) if (d_ls_pvt->glonass_gnav_ephemeris_map.empty() == false)
{ {
try try
{ {
@ -573,28 +573,28 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
try try
{ {
if (d_ls_pvt->gps_ephemeris_map.size() > 0) if (d_ls_pvt->gps_ephemeris_map.empty() == false)
{ {
if (tmp_eph_iter_gps != d_ls_pvt->gps_ephemeris_map.end()) if (tmp_eph_iter_gps != d_ls_pvt->gps_ephemeris_map.end())
{ {
d_rtcm_printer->lock_time(d_ls_pvt->gps_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time d_rtcm_printer->lock_time(d_ls_pvt->gps_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time
} }
} }
if (d_ls_pvt->galileo_ephemeris_map.size() > 0) if (d_ls_pvt->galileo_ephemeris_map.empty() == false)
{ {
if (tmp_eph_iter_gal != d_ls_pvt->galileo_ephemeris_map.end()) if (tmp_eph_iter_gal != d_ls_pvt->galileo_ephemeris_map.end())
{ {
d_rtcm_printer->lock_time(d_ls_pvt->galileo_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time d_rtcm_printer->lock_time(d_ls_pvt->galileo_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time
} }
} }
if (d_ls_pvt->gps_cnav_ephemeris_map.size() > 0) if (d_ls_pvt->gps_cnav_ephemeris_map.empty() == false)
{ {
if (tmp_eph_iter_cnav != d_ls_pvt->gps_cnav_ephemeris_map.end()) if (tmp_eph_iter_cnav != d_ls_pvt->gps_cnav_ephemeris_map.end())
{ {
d_rtcm_printer->lock_time(d_ls_pvt->gps_cnav_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time d_rtcm_printer->lock_time(d_ls_pvt->gps_cnav_ephemeris_map.find(in[i][epoch].PRN)->second, in[i][epoch].RX_time, in[i][epoch]); // keep track of locking time
} }
} }
if (d_ls_pvt->glonass_gnav_ephemeris_map.size() > 0) if (d_ls_pvt->glonass_gnav_ephemeris_map.empty() == false)
{ {
if (tmp_eph_iter_glo_gnav != d_ls_pvt->glonass_gnav_ephemeris_map.end()) if (tmp_eph_iter_glo_gnav != d_ls_pvt->glonass_gnav_ephemeris_map.end())
{ {
@ -616,7 +616,7 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item
} }
// ############ 2 COMPUTE THE PVT ################################ // ############ 2 COMPUTE THE PVT ################################
if (gnss_observables_map.size() > 0) if (gnss_observables_map.empty() == false)
{ {
double current_RX_time = gnss_observables_map.begin()->second.RX_time; double current_RX_time = gnss_observables_map.begin()->second.RX_time;
uint32_t current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0); uint32_t current_RX_time_ms = static_cast<uint32_t>(current_RX_time * 1000.0);

View File

@ -496,7 +496,8 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_
if (rtk_.ssat[i].vsat[0] == 1) used_sats++; if (rtk_.ssat[i].vsat[0] == 1) used_sats++;
} }
double azel[used_sats * 2]; std::vector<double> azel;
azel.reserve(used_sats * 2);
unsigned int index_aux = 0; unsigned int index_aux = 0;
for (unsigned int i = 0; i < MAXSAT; i++) for (unsigned int i = 0; i < MAXSAT; i++)
{ {
@ -507,7 +508,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_
index_aux++; index_aux++;
} }
} }
if (index_aux > 0) dops(index_aux, azel, 0.0, dop_); if (index_aux > 0) dops(index_aux, azel.data(), 0.0, dop_);
this->set_valid_position(true); this->set_valid_position(true);
arma::vec rx_position_and_time(4); arma::vec rx_position_and_time(4);

View File

@ -33,6 +33,7 @@
#include "galileo_e1_signal_processing.h" #include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <string> #include <string>
@ -42,7 +43,7 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn)
int32_t prn = _prn - 1; int32_t prn = _prn - 1;
int32_t index = 0; int32_t index = 0;
/* A simple error check */ // A simple error check
if ((_prn < 1) || (_prn > 50)) if ((_prn < 1) || (_prn > 50))
{ {
return; return;
@ -107,7 +108,7 @@ void galileo_e1_sinboc_61_gen_int(int* _dest, int* _prn, uint32_t _length_out)
void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn) void galileo_e1_code_gen_sinboc11_float(float* _dest, char _Signal[3], uint32_t _prn)
{ {
std::string _galileo_signal = _Signal; std::string _galileo_signal = _Signal;
uint32_t _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS); const uint32_t _codeLength = static_cast<const uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang int32_t primary_code_E1_chips[4092]; // _codeLength not accepted by Clang
galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip galileo_e1_code_gen_int(primary_code_E1_chips, _Signal, _prn); //generate Galileo E1 code, 1 sample per chip
for (uint32_t i = 0; i < _codeLength; i++) for (uint32_t i = 0; i < _codeLength; i++)
@ -158,8 +159,9 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
std::string _galileo_signal = _Signal; std::string _galileo_signal = _Signal;
uint32_t _samplesPerCode; uint32_t _samplesPerCode;
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz
uint32_t _codeLength = Galileo_E1_B_CODE_LENGTH_CHIPS; uint32_t _codeLength = static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS);
int32_t primary_code_E1_chips[static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS)]; int32_t* primary_code_E1_chips = static_cast<int32_t*>(volk_gnsssdr_malloc(static_cast<uint32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
_samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength))); _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
const int32_t _samplesPerChip = (_cboc == true) ? 12 : 2; const int32_t _samplesPerChip = (_cboc == true) ? 12 : 2;
@ -178,18 +180,20 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
} }
else else
{ {
int32_t _signal_E1_int[_codeLength]; int32_t* _signal_E1_int = static_cast<int32_t*>(volk_gnsssdr_malloc(_codeLength * sizeof(int32_t), volk_gnsssdr_get_alignment()));
galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); // generate sinboc(1,1) 2 samples per chip galileo_e1_sinboc_11_gen_int(_signal_E1_int, primary_code_E1_chips, _codeLength); // generate sinboc(1,1) 2 samples per chip
for (uint32_t ii = 0; ii < _codeLength; ++ii) for (uint32_t ii = 0; ii < _codeLength; ++ii)
{ {
_signal_E1[ii] = static_cast<float>(_signal_E1_int[ii]); _signal_E1[ii] = static_cast<float>(_signal_E1_int[ii]);
} }
volk_gnsssdr_free(_signal_E1_int);
} }
if (_fs != _samplesPerChip * _codeFreqBasis) if (_fs != _samplesPerChip * _codeFreqBasis)
{ {
float* _resampled_signal = new float[_samplesPerCode]; float* _resampled_signal = new float[_samplesPerCode];
resampler(_signal_E1, _resampled_signal, _samplesPerChip * _codeFreqBasis, _fs, resampler(_signal_E1, _resampled_signal, _samplesPerChip * _codeFreqBasis, _fs,
_codeLength, _samplesPerCode); // resamples code to fs _codeLength, _samplesPerCode); // resamples code to fs
@ -221,6 +225,7 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
} }
delete[] _signal_E1; delete[] _signal_E1;
volk_gnsssdr_free(primary_code_E1_chips);
} }
@ -238,7 +243,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
_samplesPerCode *= static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH); _samplesPerCode *= static_cast<int32_t>(Galileo_E1_C_SECONDARY_CODE_LENGTH);
} }
float real_code[_samplesPerCode]; float* real_code = static_cast<float*>(volk_gnsssdr_malloc(_samplesPerCode * sizeof(float), volk_gnsssdr_get_alignment()));
galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag); galileo_e1_code_gen_float_sampled(real_code, _Signal, _cboc, _prn, _fs, _chip_shift, _secondary_flag);
@ -246,6 +251,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
{ {
_dest[ii] = std::complex<float>(real_code[ii], 0.0f); _dest[ii] = std::complex<float>(real_code[ii], 0.0f);
} }
volk_gnsssdr_free(real_code);
} }

View File

@ -35,6 +35,14 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <glog/logging.h>
#include <fcntl.h> // libraries used by the GIPO
#include <sys/mman.h> // libraries used by the GIPO
#include <inttypes.h>
#define PAGE_SIZE 0x10000 // default page size for the multicorrelator memory map
#define TEST_REG_SANITY_CHECK 0x55AA // value to check the presence of the test register (to detect the hw)
gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms) : gr::block("fpga_fpga_sample_counter", gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms) : gr::block("fpga_fpga_sample_counter",
gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0),
@ -44,11 +52,15 @@ gnss_sdr_fpga_sample_counter::gnss_sdr_fpga_sample_counter(double _fs, int32_t _
set_max_noutput_items(1); set_max_noutput_items(1);
interval_ms = _interval_ms; interval_ms = _interval_ms;
fs = _fs; fs = _fs;
//printf("CREATOR fs = %f\n", fs);
//printf("CREATOR interval_ms = %" PRIu32 "\n", interval_ms);
samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3); samples_per_output = std::round(fs * static_cast<double>(interval_ms) / 1e3);
//printf("CREATOR samples_per_output = %" PRIu32 "\n", samples_per_output);
//todo: Load here the hardware counter register with this amount of samples. It should produce an //todo: Load here the hardware counter register with this amount of samples. It should produce an
//interrupt every samples_per_output count. //interrupt every samples_per_output count.
//The hardware timer must keep always interrupting the PS. It must not wait for the interrupt to //The hardware timer must keep always interrupting the PS. It must not wait for the interrupt to
//be served. //be served.
open_device();
sample_counter = 0ULL; sample_counter = 0ULL;
current_T_rx_ms = 0; current_T_rx_ms = 0;
@ -75,6 +87,10 @@ gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs,
bool gnss_sdr_fpga_sample_counter::start() bool gnss_sdr_fpga_sample_counter::start()
{ {
//todo: place here the RE-INITIALIZATION routines. This function will be called by GNURadio at every start of the flowgraph. //todo: place here the RE-INITIALIZATION routines. This function will be called by GNURadio at every start of the flowgraph.
// configure the number of samples per output in the FPGA and enable the interrupts
configure_samples_per_output(samples_per_output);
// return true if everything is ok. // return true if everything is ok.
return true; return true;
} }
@ -85,6 +101,8 @@ bool gnss_sdr_fpga_sample_counter::stop()
{ {
//todo: place here the routines to stop the associated hardware (if needed).This function will be called by GNURadio at every stop of the flowgraph. //todo: place here the routines to stop the associated hardware (if needed).This function will be called by GNURadio at every stop of the flowgraph.
// return true if everything is ok. // return true if everything is ok.
close_device();
return true; return true;
} }
@ -101,6 +119,15 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((
// Possible problem: what happen if the PS is overloaded and gnuradio does not call this function // Possible problem: what happen if the PS is overloaded and gnuradio does not call this function
// with the sufficient rate to catch all the interrupts in the counter. To be evaluated later. // with the sufficient rate to catch all the interrupts in the counter. To be evaluated later.
uint32_t counter = wait_for_interrupt_and_read_counter();
uint64_t samples_passed = 2*static_cast<uint64_t>(samples_per_output) - static_cast<uint64_t>(counter); // ellapsed samples
//printf("============================================ interrupter : samples_passed = %" PRIu64 "\n", samples_passed);
// Note: at this moment the sample counter is implemented as a sample counter that decreases to zero and then it is automatically
// reloaded again and keeps counter. It is done in this way to minimize the logic in the FPGA and maximize the FPGA clock performance
// (it takes less resources and latency in the FPGA to compare a number against a fixed value like zero than to compare it to a programmable
// variable number).
sample_counter = sample_counter + samples_passed; //samples_per_output;
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]);
out[0] = Gnss_Synchro(); out[0] = Gnss_Synchro();
out[0].Flag_valid_symbol_output = false; out[0].Flag_valid_symbol_output = false;
@ -109,6 +136,10 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((
out[0].fs = fs; out[0].fs = fs;
if ((current_T_rx_ms % report_interval_ms) == 0) if ((current_T_rx_ms % report_interval_ms) == 0)
{ {
//printf("time to print sample_counter = %" PRIu64 "\n", sample_counter);
//printf("time to print current Tx ms : %" PRIu64 "\n", current_T_rx_ms);
//printf("time to print report_interval_ms : %" PRIu32 "\n", report_interval_ms);
//printf("time to print %f\n", (current_T_rx_ms % report_interval_ms));
current_s++; current_s++;
if ((current_s % 60) == 0) if ((current_s % 60) == 0)
{ {
@ -166,6 +197,109 @@ int gnss_sdr_fpga_sample_counter::general_work(int noutput_items __attribute__((
} }
} }
out[0].Tracking_sample_counter = sample_counter; out[0].Tracking_sample_counter = sample_counter;
current_T_rx_ms = (sample_counter * 1000) / samples_per_output; //current_T_rx_ms = (sample_counter * 1000) / samples_per_output;
current_T_rx_ms = interval_ms*(sample_counter) / samples_per_output;
return 1; return 1;
} }
uint32_t gnss_sdr_fpga_sample_counter::test_register(uint32_t writeval)
{
uint32_t readval;
// write value to test register
map_base[3] = writeval;
// read value from test register
readval = map_base[3];
// return read value
return readval;
}
void gnss_sdr_fpga_sample_counter::configure_samples_per_output(uint32_t interval)
{
// note : the counter is a 48-bit value in the HW.
//printf("============================================ total counter - interrupted interval : %" PRIu32 "\n", interval);
//uint64_t temp_interval;
//temp_interval = (interval & static_cast<uint32_t>(0xFFFFFFFF));
//printf("LSW counter - interrupted interval : %" PRIu32 "\n", static_cast<uint32_t>(temp_interval));
//map_base[0] = static_cast<uint32_t>(temp_interval);
map_base[0] = interval - 1;
//temp_interval = (interval >> 32) & static_cast<uint32_t>(0xFFFFFFFF);
//printf("MSbits counter - interrupted interval : %" PRIu32 "\n", static_cast<uint32_t>(temp_interval));
//map_base[1] = static_cast<uint32_t>(temp_interval); // writing the most significant bits also enables the interrupts
}
void gnss_sdr_fpga_sample_counter::open_device()
{
// open communication with HW accelerator
if ((fd = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
LOG(WARNING) << "Cannot open deviceio" << device_name;
std::cout << "Counter-Intr: cannot open deviceio" << device_name << std::endl;
}
map_base = reinterpret_cast<volatile uint32_t *>(mmap(NULL, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
if (map_base == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA acquisition module into user memory";
std::cout << "Counter-Intr: cannot map deviceio" << device_name << std::endl;
}
// sanity check : check test register
uint32_t writeval = TEST_REG_SANITY_CHECK;
uint32_t readval;
readval = gnss_sdr_fpga_sample_counter::test_register(writeval);
if (writeval != readval)
{
LOG(WARNING) << "Acquisition test register sanity check failed";
}
else
{
LOG(INFO) << "Acquisition test register sanity check success!";
//std::cout << "Acquisition test register sanity check success!" << std::endl;
}
}
void gnss_sdr_fpga_sample_counter::close_device()
{
//printf("=========================================== NOW closing device ...\n");
map_base[2] = 0; // disable the generation of the interrupt in the device
uint32_t *aux = const_cast<uint32_t *>(map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
{
printf("Failed to unmap memory uio\n");
}
close(fd);
}
uint32_t gnss_sdr_fpga_sample_counter::wait_for_interrupt_and_read_counter()
{
int32_t irq_count;
ssize_t nb;
int32_t counter;
// enable interrupts
int32_t reenable = 1;
write(fd, reinterpret_cast<void *>(&reenable), sizeof(int32_t));
// wait for interrupt
//printf("============================================ interrupter : going to wait for interupt\n");
nb = read(fd, &irq_count, sizeof(irq_count));
//printf("============================================ interrupter : interrupt received\n");
//printf("interrupt received\n");
if (nb != sizeof(irq_count))
{
printf("acquisition module Read failed to retrieve 4 bytes!\n");
printf("acquisition module Interrupt number %d\n", irq_count);
}
// acknowledge the interrupt
map_base[1] = 0; // writing anything to reg 1 acknowledges the interrupt
// add number of passed samples or read the current counter value for more accuracy
counter = samples_per_output; //map_base[0];
return counter;
}

View File

@ -45,13 +45,18 @@ class gnss_sdr_fpga_sample_counter : public gr::block
{ {
private: private:
gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms); gnss_sdr_fpga_sample_counter(double _fs, int32_t _interval_ms);
uint32_t test_register(uint32_t writeval);
void configure_samples_per_output(uint32_t interval);
void close_device(void);
void open_device(void);
bool start(); bool start();
bool stop(); bool stop();
uint32_t wait_for_interrupt_and_read_counter(void);
uint32_t samples_per_output; uint32_t samples_per_output;
double fs; double fs;
uint64_t sample_counter; uint64_t sample_counter;
int32_t interval_ms; uint32_t interval_ms;
int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run uint64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
uint32_t current_s; // Receiver time in seconds, modulo 60 uint32_t current_s; // Receiver time in seconds, modulo 60
bool flag_m; // True if the receiver has been running for at least 1 minute bool flag_m; // True if the receiver has been running for at least 1 minute
uint32_t current_m; // Receiver time in minutes, modulo 60 uint32_t current_m; // Receiver time in minutes, modulo 60
@ -61,6 +66,9 @@ private:
uint32_t current_days; // Receiver time in days since the beginning of the run uint32_t current_days; // Receiver time in days since the beginning of the run
int32_t report_interval_ms; int32_t report_interval_ms;
bool flag_enable_send_msg; bool flag_enable_send_msg;
int32_t fd; // driver descriptor
volatile uint32_t *map_base; // driver memory map
std::string device_name = "/dev/uio26"; // HW device name
public: public:
friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms); friend gnss_sdr_fpga_sample_counter_sptr gnss_sdr_make_fpga_sample_counter(double _fs, int32_t _interval_ms);

View File

@ -158,7 +158,7 @@ void hex_to_binary_converter(int32_t* _dest, char _from)
} }
void resampler(float* _from, float* _dest, float _fs_in, void resampler(const float* _from, float* _dest, float _fs_in,
float _fs_out, uint32_t _length_in, uint32_t _length_out) float _fs_out, uint32_t _length_in, uint32_t _length_out)
{ {
uint32_t _codeValueIndex; uint32_t _codeValueIndex;
@ -182,7 +182,7 @@ void resampler(float* _from, float* _dest, float _fs_in,
} }
void resampler(std::complex<float>* _from, std::complex<float>* _dest, float _fs_in, void resampler(const std::complex<float>* _from, std::complex<float>* _dest, float _fs_in,
float _fs_out, uint32_t _length_in, uint32_t _length_out) float _fs_out, uint32_t _length_in, uint32_t _length_out)
{ {
uint32_t _codeValueIndex; uint32_t _codeValueIndex;

View File

@ -65,14 +65,14 @@ void hex_to_binary_converter(int32_t* _dest, char _from);
* \brief This function resamples a sequence of float values. * \brief This function resamples a sequence of float values.
* *
*/ */
void resampler(float* _from, float* _dest, void resampler(const float* _from, float* _dest,
float _fs_in, float _fs_out, uint32_t _length_in, float _fs_in, float _fs_out, uint32_t _length_in,
uint32_t _length_out); uint32_t _length_out);
/*! /*!
* \brief This function resamples a sequence of complex values. * \brief This function resamples a sequence of complex values.
* *
*/ */
void resampler(std::complex<float>* _from, std::complex<float>* _dest, void resampler(const std::complex<float>* _from, std::complex<float>* _dest,
float _fs_in, float _fs_out, uint32_t _length_in, float _fs_in, float _fs_out, uint32_t _length_in,
uint32_t _length_out); uint32_t _length_out);

View File

@ -116,7 +116,7 @@ void gps_l1_ca_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift)
void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
{ {
uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
int32_t ca_code_int[_code_length]; int32_t ca_code_int[_code_length];
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift); gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);
@ -130,7 +130,7 @@ void gps_l1_ca_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift) void gps_l1_ca_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift)
{ {
uint32_t _code_length = 1023; const uint32_t _code_length = 1023;
int32_t ca_code_int[_code_length]; int32_t ca_code_int[_code_length];
gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift); gps_l1_ca_code_gen_int(ca_code_int, _prn, _chip_shift);

View File

@ -163,8 +163,8 @@ galileo_e1b_telemetry_decoder_cc::~galileo_e1b_telemetry_decoder_cc()
void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, int32_t frame_length) void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, int32_t frame_length)
{ {
double page_part_symbols_deint[frame_length];
// 1. De-interleave // 1. De-interleave
double *page_part_symbols_deint = static_cast<double *>(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment()));
deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint);
// 2. Viterbi decoder // 2. Viterbi decoder
@ -178,8 +178,9 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in
} }
} }
int32_t page_part_bits[frame_length / 2]; int32_t *page_part_bits = static_cast<int32_t *>(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
viterbi_decoder(page_part_symbols_deint, page_part_bits); viterbi_decoder(page_part_symbols_deint, page_part_bits);
volk_gnsssdr_free(page_part_symbols_deint);
// 3. Call the Galileo page decoder // 3. Call the Galileo page decoder
std::string page_String; std::string page_String;
@ -217,6 +218,7 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in
d_nav.split_page(page_String.c_str(), flag_even_word_arrived); d_nav.split_page(page_String.c_str(), flag_even_word_arrived);
flag_even_word_arrived = 1; flag_even_word_arrived = 1;
} }
volk_gnsssdr_free(page_part_bits);
// 4. Push the new navigation data to the queues // 4. Push the new navigation data to the queues
if (d_nav.have_new_ephemeris() == true) if (d_nav.have_new_ephemeris() == true)
@ -370,7 +372,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
// NEW Galileo page part is received // NEW Galileo page part is received
// 0. fetch the symbols into an array // 0. fetch the symbols into an array
int32_t frame_length = GALILEO_INAV_PAGE_PART_SYMBOLS - d_symbols_per_preamble; int32_t frame_length = GALILEO_INAV_PAGE_PART_SYMBOLS - d_symbols_per_preamble;
double page_part_symbols[frame_length]; double *page_part_symbols = static_cast<double *>(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment()));
for (int32_t i = 0; i < frame_length; i++) for (int32_t i = 0; i < frame_length; i++)
{ {
@ -412,6 +414,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
d_nav.flag_TOW_set = false; d_nav.flag_TOW_set = false;
} }
} }
volk_gnsssdr_free(page_part_symbols);
} }
} }

View File

@ -79,8 +79,8 @@ void galileo_e5a_telemetry_decoder_cc::deinterleaver(int32_t rows, int32_t cols,
void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int32_t frame_length) void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int32_t frame_length)
{ {
double page_symbols_deint[frame_length];
// 1. De-interleave // 1. De-interleave
double *page_symbols_deint = static_cast<double *>(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment()));
deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint); deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint);
// 2. Viterbi decoder // 2. Viterbi decoder
@ -93,8 +93,9 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int32_t
page_symbols_deint[i] = -page_symbols_deint[i]; page_symbols_deint[i] = -page_symbols_deint[i];
} }
} }
int32_t page_bits[frame_length / 2]; int32_t *page_bits = static_cast<int32_t *>(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment()));
viterbi_decoder(page_symbols_deint, page_bits); viterbi_decoder(page_symbols_deint, page_bits);
volk_gnsssdr_free(page_symbols_deint);
// 3. Call the Galileo page decoder // 3. Call the Galileo page decoder
std::string page_String; std::string page_String;
@ -109,6 +110,7 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int32_t
page_String.push_back('0'); page_String.push_back('0');
} }
} }
volk_gnsssdr_free(page_bits);
// DECODE COMPLETE WORD (even + odd) and TEST CRC // DECODE COMPLETE WORD (even + odd) and TEST CRC
d_nav.split_page(page_String); d_nav.split_page(page_String);

View File

@ -189,7 +189,7 @@ sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::symbol_aligner_and_dec
{ {
// convolutional code properties // convolutional code properties
d_KK = 7; d_KK = 7;
int32_t nn = 2; const int32_t nn = 2;
int32_t g_encoder[nn]; int32_t g_encoder[nn];
g_encoder[0] = 121; g_encoder[0] = 121;
g_encoder[1] = 91; g_encoder[1] = 91;

View File

@ -30,7 +30,6 @@
*/ */
#include "edc.h" #include "edc.h"
#include "bits.h" #include "bits.h"
#include "cnav_msg.h" #include "cnav_msg.h"
@ -57,9 +56,9 @@
*/ */
/** GPS L2C preamble */ /** GPS L2C preamble */
#define GPS_CNAV_PREAMBLE1 (0b10001011u) const u32 GPS_CNAV_PREAMBLE1 = 0x8Bu; /* (0b10001011u) */
/** Inverted GPS L2C preamble */ /** Inverted GPS L2C preamble */
#define GPS_CNAV_PREAMBLE2 (0b01110100u) const u32 GPS_CNAV_PREAMBLE2 = 0x74u; /* (0b01110100u) */
/** GPS L2C preamble length in bits */ /** GPS L2C preamble length in bits */
#define GPS_CNAV_PREAMBLE_LENGTH (8) #define GPS_CNAV_PREAMBLE_LENGTH (8)
/** GPS L2C CNAV message length in bits */ /** GPS L2C CNAV message length in bits */
@ -201,7 +200,8 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
* - M - Number of bits in the tail to ignore. * - M - Number of bits in the tail to ignore.
*/ */
unsigned char tmp_bits[(GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS + unsigned char tmp_bits[(GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS +
CHAR_BIT - 1) / CHAR_BIT]; CHAR_BIT - 1) /
CHAR_BIT];
v27_chainback_likely(&part->dec, tmp_bits, v27_chainback_likely(&part->dec, tmp_bits,
GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS); GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS);
@ -238,7 +238,6 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
} }
if (part->preamble_seen && GPS_CNAV_MSG_LENGTH <= part->n_decoded) if (part->preamble_seen && GPS_CNAV_MSG_LENGTH <= part->n_decoded)
{ {
/* We have collected 300 bits starting from message preamble. Now try /* We have collected 300 bits starting from message preamble. Now try
* to compute CRC-24Q */ * to compute CRC-24Q */
u32 crc = _cnav_compute_crc(part); u32 crc = _cnav_compute_crc(part);

View File

@ -47,8 +47,10 @@ gnss_sdr_supl_client::gnss_sdr_supl_client()
request = 0; request = 0;
} }
gnss_sdr_supl_client::~gnss_sdr_supl_client() {} gnss_sdr_supl_client::~gnss_sdr_supl_client() {}
void gnss_sdr_supl_client::print_assistance() void gnss_sdr_supl_client::print_assistance()
{ {
if (assist.set & SUPL_RRLP_ASSIST_REFTIME) if (assist.set & SUPL_RRLP_ASSIST_REFTIME)
@ -189,6 +191,7 @@ int gnss_sdr_supl_client::get_assistance(int i_mcc, int i_mns, int i_lac, int i_
return err; return err;
} }
void gnss_sdr_supl_client::read_supl_data() void gnss_sdr_supl_client::read_supl_data()
{ {
// READ REFERENCE LOCATION // READ REFERENCE LOCATION
@ -270,7 +273,6 @@ void gnss_sdr_supl_client::read_supl_data()
} }
} }
// READ SV EPHEMERIS // READ SV EPHEMERIS
if (assist.cnt_eph) if (assist.cnt_eph)
{ {
@ -385,9 +387,10 @@ bool gnss_sdr_supl_client::load_ephemeris_xml(const std::string file_name)
return true; return true;
} }
bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, std::map<int, Gps_Ephemeris> eph_map) bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, std::map<int, Gps_Ephemeris> eph_map)
{ {
if (eph_map.size() > 0) if (eph_map.empty() == false)
{ {
try try
{ {
@ -411,6 +414,7 @@ bool gnss_sdr_supl_client::save_ephemeris_map_xml(const std::string file_name, s
} }
} }
bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name) bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
{ {
try try
@ -429,9 +433,10 @@ bool gnss_sdr_supl_client::load_utc_xml(const std::string file_name)
return true; return true;
} }
bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::map<int, Gps_Utc_Model> utc_map) bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::map<int, Gps_Utc_Model> utc_map)
{ {
if (utc_map.size() > 0) if (utc_map.empty() == false)
{ {
try try
{ {
@ -455,6 +460,7 @@ bool gnss_sdr_supl_client::save_utc_map_xml(const std::string file_name, std::ma
} }
} }
bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name) bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
{ {
try try
@ -473,9 +479,10 @@ bool gnss_sdr_supl_client::load_iono_xml(const std::string file_name)
return true; return true;
} }
bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::map<int, Gps_Iono> iono_map) bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::map<int, Gps_Iono> iono_map)
{ {
if (iono_map.size() > 0) if (iono_map.empty() == false)
{ {
try try
{ {
@ -499,6 +506,7 @@ bool gnss_sdr_supl_client::save_iono_map_xml(const std::string file_name, std::m
} }
} }
bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name) bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
{ {
try try
@ -517,9 +525,10 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
return true; return true;
} }
bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, std::map<int, Gps_Ref_Time> ref_time_map) bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, std::map<int, Gps_Ref_Time> ref_time_map)
{ {
if (ref_time_map.size() > 0) if (ref_time_map.empty() == false)
{ {
try try
{ {
@ -543,6 +552,7 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
} }
} }
bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name) bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
{ {
try try
@ -561,9 +571,10 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
return true; return true;
} }
bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name, std::map<int, Gps_Ref_Location> ref_location_map) bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name, std::map<int, Gps_Ref_Location> ref_location_map)
{ {
if (ref_location_map.size() > 0) if (ref_location_map.empty() == false)
{ {
try try
{ {

View File

@ -7,7 +7,8 @@
#include <constr_TYPE.h> #include <constr_TYPE.h>
#include <per_opentype.h> #include <per_opentype.h>
typedef struct uper_ugot_key { typedef struct uper_ugot_key
{
asn_per_data_t oldpd; /* Old per data source */ asn_per_data_t oldpd; /* Old per data source */
size_t unclaimed; size_t unclaimed;
size_t ot_moved; /* Number of bits moved by OT processing */ size_t ot_moved; /* Number of bits moved by OT processing */
@ -24,8 +25,8 @@ int asn_debug_indent;
* Encode an "open type field". * Encode an "open type field".
* #10.1, #10.2 * #10.1, #10.2
*/ */
int int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po)
uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { {
void *buf; void *buf;
void *bptr; void *bptr;
ssize_t size; ssize_t size;
@ -36,7 +37,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); size = uper_encode_to_new_buffer(td, constraints, sptr, &buf);
if (size <= 0) return -1; if (size <= 0) return -1;
for(bptr = buf, toGo = size; toGo;) { for (bptr = buf, toGo = size; toGo;)
{
ssize_t maySave = uper_put_length(po, toGo); ssize_t maySave = uper_put_length(po, toGo);
if (maySave < 0) break; if (maySave < 0) break;
if (per_put_many_bits(po, bptr, maySave * 8)) break; if (per_put_many_bits(po, bptr, maySave * 8)) break;
@ -55,7 +57,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
static asn_dec_rval_t static asn_dec_rval_t
uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
asn_dec_rval_t rv; asn_dec_rval_t rv;
ssize_t chunk_bytes; ssize_t chunk_bytes;
int repeat; int repeat;
@ -69,28 +72,34 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
ASN_DEBUG("Getting open type %s...", td->name); ASN_DEBUG("Getting open type %s...", td->name);
do { do
{
chunk_bytes = uper_get_length(pd, -1, &repeat); chunk_bytes = uper_get_length(pd, -1, &repeat);
if(chunk_bytes < 0) { if (chunk_bytes < 0)
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
} }
if(bufLen + chunk_bytes > bufSize) { if (bufLen + chunk_bytes > bufSize)
{
void *ptr; void *ptr;
bufSize = chunk_bytes + (bufSize << 2); bufSize = chunk_bytes + (bufSize << 2);
ptr = REALLOC(buf, bufSize); ptr = REALLOC(buf, bufSize);
if(!ptr) { if (!ptr)
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
buf = ptr; buf = ptr;
} }
if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { if (per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3))
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
} }
bufLen += chunk_bytes; bufLen += chunk_bytes;
} while(repeat); }
while (repeat);
ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name,
bufLen); bufLen);
@ -103,23 +112,30 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); rv = td->uper_decoder(ctx, td, constraints, sptr, &spd);
asn_debug_indent -= 4; asn_debug_indent -= 4;
if(rv.code == RC_OK) { if (rv.code == RC_OK)
{
/* Check padding validity */ /* Check padding validity */
padding = spd.nbits - spd.nboff; padding = spd.nbits - spd.nboff;
if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { if (padding < 8 && per_get_few_bits(&spd, padding) == 0)
{
/* Everything is cool */ /* Everything is cool */
FREEMEM(buf); FREEMEM(buf);
return rv; return rv;
} }
FREEMEM(buf); FREEMEM(buf);
if(padding >= 8) { if (padding >= 8)
{
ASN_DEBUG("Too large padding %d in open type", padding); ASN_DEBUG("Too large padding %d in open type", padding);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} else { }
else
{
ASN_DEBUG("Non-zero padding"); ASN_DEBUG("Non-zero padding");
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} else { }
else
{
FREEMEM(buf); FREEMEM(buf);
/* rv.code could be RC_WMORE, nonsense in this context */ /* rv.code could be RC_WMORE, nonsense in this context */
rv.code = RC_FAIL; /* Noone would give us more */ rv.code = RC_FAIL; /* Noone would give us more */
@ -130,7 +146,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
static asn_dec_rval_t GCC_NOTUSED static asn_dec_rval_t GCC_NOTUSED
uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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) { asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
uper_ugot_key arg; uper_ugot_key arg;
asn_dec_rval_t rv; asn_dec_rval_t rv;
ssize_t padding; ssize_t padding;
@ -152,29 +169,34 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
rv = td->uper_decoder(ctx, td, constraints, sptr, pd); rv = td->uper_decoder(ctx, td, constraints, sptr, pd);
asn_debug_indent -= 4; asn_debug_indent -= 4;
#define UPDRESTOREPD do { \ #define UPDRESTOREPD \
do \
{ \
/* buffer and nboff are valid, preserve them. */ \ /* buffer and nboff are valid, preserve them. */ \
pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \
pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \
pd->refill = arg.oldpd.refill; \ pd->refill = arg.oldpd.refill; \
pd->refill_key = arg.oldpd.refill_key; \ pd->refill_key = arg.oldpd.refill_key; \
} while(0) } \
while (0)
if(rv.code != RC_OK) { if (rv.code != RC_OK)
{
UPDRESTOREPD; UPDRESTOREPD;
return rv; return rv;
} }
ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d" ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name,
, td->name,
per_data_string(pd), per_data_string(pd),
per_data_string(&arg.oldpd), per_data_string(&arg.oldpd),
arg.unclaimed, arg.repeat); arg.unclaimed, arg.repeat);
padding = pd->moved % 8; padding = pd->moved % 8;
if(padding) { if (padding)
{
int32_t pvalue; int32_t pvalue;
if(padding > 7) { if (padding > 7)
{
ASN_DEBUG("Too large padding %d in open type", ASN_DEBUG("Too large padding %d in open type",
padding); padding);
rv.code = RC_FAIL; rv.code = RC_FAIL;
@ -184,12 +206,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
padding = 8 - padding; padding = 8 - padding;
ASN_DEBUG("Getting padding of %d bits", padding); ASN_DEBUG("Getting padding of %d bits", padding);
pvalue = per_get_few_bits(pd, padding); pvalue = per_get_few_bits(pd, padding);
switch(pvalue) { switch (pvalue)
{
case -1: case -1:
ASN_DEBUG("Padding skip failed"); ASN_DEBUG("Padding skip failed");
UPDRESTOREPD; UPDRESTOREPD;
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
case 0: break; case 0:
break;
default: default:
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
padding, (int)pvalue); padding, (int)pvalue);
@ -197,13 +221,17 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} }
if(pd->nboff != pd->nbits) { if (pd->nboff != pd->nbits)
{
ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, 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) { if (1)
{
UPDRESTOREPD; UPDRESTOREPD;
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} else { }
else
{
arg.unclaimed += pd->nbits - pd->nboff; arg.unclaimed += pd->nbits - pd->nboff;
} }
} }
@ -213,8 +241,10 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
/* Skip data not consumed by the decoder */ /* Skip data not consumed by the decoder */
if (arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed); if (arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed);
if(arg.unclaimed) { if (arg.unclaimed)
switch(per_skip_bits(pd, arg.unclaimed)) { {
switch (per_skip_bits(pd, arg.unclaimed))
{
case -1: case -1:
ASN_DEBUG("Claim of %d failed", arg.unclaimed); ASN_DEBUG("Claim of %d failed", arg.unclaimed);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
@ -229,7 +259,8 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
arg.unclaimed = 0; arg.unclaimed = 0;
} }
if(arg.repeat) { if (arg.repeat)
{
ASN_DEBUG("Not consumed the whole thing"); ASN_DEBUG("Not consumed the whole thing");
rv.code = RC_FAIL; rv.code = RC_FAIL;
return rv; return rv;
@ -241,15 +272,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t asn_dec_rval_t
uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
return uper_open_type_get_simple(ctx, td, constraints, return uper_open_type_get_simple(ctx, td, constraints,
sptr, pd); sptr, pd);
} }
int int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd)
uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { {
asn_TYPE_descriptor_t s_td; asn_TYPE_descriptor_t s_td;
asn_dec_rval_t rv; asn_dec_rval_t rv;
@ -269,7 +299,8 @@ uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) {
static asn_dec_rval_t static asn_dec_rval_t
uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
asn_dec_rval_t rv; asn_dec_rval_t rv;
(void)ctx; (void)ctx;
@ -277,7 +308,8 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
(void)constraints; (void)constraints;
(void)sptr; (void)sptr;
while(per_get_few_bits(pd, 24) >= 0); while (per_get_few_bits(pd, 24) >= 0)
;
rv.code = RC_OK; rv.code = RC_OK;
rv.consumed = pd->moved; rv.consumed = pd->moved;
@ -286,7 +318,8 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
} }
static int static int
uper_ugot_refill(asn_per_data_t *pd) { uper_ugot_refill(asn_per_data_t *pd)
{
uper_ugot_key *arg = pd->refill_key; uper_ugot_key *arg = pd->refill_key;
ssize_t next_chunk_bytes, next_chunk_bits; ssize_t next_chunk_bytes, next_chunk_bits;
ssize_t avail; ssize_t avail;
@ -303,11 +336,13 @@ uper_ugot_refill(asn_per_data_t *pd) {
oldpd->moved += pd->moved - arg->ot_moved; oldpd->moved += pd->moved - arg->ot_moved;
arg->ot_moved = pd->moved; arg->ot_moved = pd->moved;
if(arg->unclaimed) { if (arg->unclaimed)
{
/* Refill the container */ /* Refill the container */
if (per_get_few_bits(oldpd, 1)) if (per_get_few_bits(oldpd, 1))
return -1; return -1;
if(oldpd->nboff == 0) { if (oldpd->nboff == 0)
{
assert(0); assert(0);
return -1; return -1;
} }
@ -318,7 +353,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
return 0; return 0;
} }
if(!arg->repeat) { if (!arg->repeat)
{
ASN_DEBUG("Want more but refill doesn't have it"); ASN_DEBUG("Want more but refill doesn't have it");
return -1; return -1;
} }
@ -327,20 +363,24 @@ uper_ugot_refill(asn_per_data_t *pd) {
ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", 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) return -1;
if(next_chunk_bytes == 0) { if (next_chunk_bytes == 0)
{
pd->refill = 0; /* No more refills, naturally */ pd->refill = 0; /* No more refills, naturally */
assert(!arg->repeat); /* Implementation guarantee */ assert(!arg->repeat); /* Implementation guarantee */
} }
next_chunk_bits = next_chunk_bytes << 3; next_chunk_bits = next_chunk_bytes << 3;
avail = oldpd->nbits - oldpd->nboff; avail = oldpd->nbits - oldpd->nboff;
if(avail >= next_chunk_bits) { if (avail >= next_chunk_bits)
{
pd->nbits = oldpd->nboff + next_chunk_bits; pd->nbits = oldpd->nboff + next_chunk_bits;
arg->unclaimed = 0; arg->unclaimed = 0;
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)",
next_chunk_bits, oldpd->moved, next_chunk_bits, oldpd->moved,
oldpd->nboff, oldpd->nbits, oldpd->nboff, oldpd->nbits,
oldpd->nbits - oldpd->nboff); oldpd->nbits - oldpd->nboff);
} else { }
else
{
pd->nbits = oldpd->nbits; pd->nbits = oldpd->nbits;
arg->unclaimed = next_chunk_bits - avail; 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);
@ -353,20 +393,27 @@ uper_ugot_refill(asn_per_data_t *pd) {
} }
static int static int
per_skip_bits(asn_per_data_t *pd, int skip_nbits) { per_skip_bits(asn_per_data_t *pd, int skip_nbits)
{
int hasNonZeroBits = 0; int hasNonZeroBits = 0;
while(skip_nbits > 0) { while (skip_nbits > 0)
int skip; {
int skip = 0;
if (skip_nbits < skip) if (skip_nbits < skip)
skip = skip_nbits; skip = skip_nbits;
else else
skip = 24; skip = 24;
skip_nbits -= skip; skip_nbits -= skip;
switch(per_get_few_bits(pd, skip)) { switch (per_get_few_bits(pd, skip))
case -1: return -1; /* Starving */ {
case 0: continue; /* Skipped empty space */ case -1:
default: hasNonZeroBits = 1; continue; return -1; /* Starving */
case 0:
continue; /* Skipped empty space */
default:
hasNonZeroBits = 1;
continue;
} }
} }
return hasNonZeroBits; return hasNonZeroBits;

View File

@ -8,28 +8,36 @@
static int static int
memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_verdirect_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 1)) { if (size == 1)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -39,28 +47,36 @@ memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_bearing_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 9)) { if (size == 9)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -70,28 +86,36 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_horspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 16)) { if (size == 16)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -101,28 +125,36 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_verspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -132,28 +164,36 @@ memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_horuncertspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -163,28 +203,36 @@ memb_horuncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_veruncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_veruncertspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -230,8 +278,7 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_verdirect_constraint_1, memb_verdirect_constraint_1,
&asn_PER_memb_verdirect_constr_2, &asn_PER_memb_verdirect_constr_2,
0, 0,
"verdirect" "verdirect"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, bearing), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, bearing),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -239,8 +286,7 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_bearing_constraint_1, memb_bearing_constraint_1,
&asn_PER_memb_bearing_constr_3, &asn_PER_memb_bearing_constr_3,
0, 0,
"bearing" "bearing"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horspeed),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -248,8 +294,7 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_horspeed_constraint_1, memb_horspeed_constraint_1,
&asn_PER_memb_horspeed_constr_4, &asn_PER_memb_horspeed_constr_4,
0, 0,
"horspeed" "horspeed"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -257,8 +302,7 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_verspeed_constraint_1, memb_verspeed_constraint_1,
&asn_PER_memb_verspeed_constr_5, &asn_PER_memb_verspeed_constr_5,
0, 0,
"verspeed" "verspeed"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -266,8 +310,7 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_horuncertspeed_constraint_1, memb_horuncertspeed_constraint_1,
&asn_PER_memb_horuncertspeed_constr_6, &asn_PER_memb_horuncertspeed_constr_6,
0, 0,
"horuncertspeed" "horuncertspeed"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed),
(ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -275,12 +318,10 @@ static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
memb_veruncertspeed_constraint_1, memb_veruncertspeed_constraint_1,
&asn_PER_memb_veruncertspeed_constr_7, &asn_PER_memb_veruncertspeed_constr_7,
0, 0,
"veruncertspeed" "veruncertspeed"},
},
}; };
static ber_tlv_tag_t asn_DEF_Horandveruncert_tags_1[] = { static ber_tlv_tag_t asn_DEF_Horandveruncert_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_Horandveruncert_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_Horandveruncert_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* verdirect at 251 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* verdirect at 251 */
{(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bearing at 252 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bearing at 252 */
@ -312,14 +353,11 @@ asn_TYPE_descriptor_t asn_DEF_Horandveruncert = {
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_Horandveruncert_tags_1, asn_DEF_Horandveruncert_tags_1,
sizeof(asn_DEF_Horandveruncert_tags_1) sizeof(asn_DEF_Horandveruncert_tags_1) / sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */
asn_DEF_Horandveruncert_tags_1, /* Same as above */ asn_DEF_Horandveruncert_tags_1, /* Same as above */
sizeof(asn_DEF_Horandveruncert_tags_1) sizeof(asn_DEF_Horandveruncert_tags_1) / sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Horandveruncert_1, asn_MBR_Horandveruncert_1,
6, /* Elements count */ 6, /* Elements count */
&asn_SPC_Horandveruncert_specs_1 /* Additional specs */ &asn_SPC_Horandveruncert_specs_1 /* Additional specs */
}; };

View File

@ -8,28 +8,36 @@
static int static int
memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_verdirect_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 1)) { if (size == 1)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -39,28 +47,36 @@ memb_verdirect_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_bearing_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 9)) { if (size == 9)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -70,28 +86,36 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_horspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 16)) { if (size == 16)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -101,28 +125,36 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_verspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_verspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -158,8 +190,7 @@ static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = {
memb_verdirect_constraint_1, memb_verdirect_constraint_1,
&asn_PER_memb_verdirect_constr_2, &asn_PER_memb_verdirect_constr_2,
0, 0,
"verdirect" "verdirect"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandvervel, bearing), {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, bearing),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -167,8 +198,7 @@ static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = {
memb_bearing_constraint_1, memb_bearing_constraint_1,
&asn_PER_memb_bearing_constr_3, &asn_PER_memb_bearing_constr_3,
0, 0,
"bearing" "bearing"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandvervel, horspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, horspeed),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -176,8 +206,7 @@ static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = {
memb_horspeed_constraint_1, memb_horspeed_constraint_1,
&asn_PER_memb_horspeed_constr_4, &asn_PER_memb_horspeed_constr_4,
0, 0,
"horspeed" "horspeed"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed), {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -185,12 +214,10 @@ static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = {
memb_verspeed_constraint_1, memb_verspeed_constraint_1,
&asn_PER_memb_verspeed_constr_5, &asn_PER_memb_verspeed_constr_5,
0, 0,
"verspeed" "verspeed"},
},
}; };
static ber_tlv_tag_t asn_DEF_Horandvervel_tags_1[] = { static ber_tlv_tag_t asn_DEF_Horandvervel_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_Horandvervel_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_Horandvervel_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* verdirect at 238 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* verdirect at 238 */
{(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bearing at 239 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* bearing at 239 */
@ -220,14 +247,11 @@ asn_TYPE_descriptor_t asn_DEF_Horandvervel = {
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_Horandvervel_tags_1, asn_DEF_Horandvervel_tags_1,
sizeof(asn_DEF_Horandvervel_tags_1) sizeof(asn_DEF_Horandvervel_tags_1) / sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */
asn_DEF_Horandvervel_tags_1, /* Same as above */ asn_DEF_Horandvervel_tags_1, /* Same as above */
sizeof(asn_DEF_Horandvervel_tags_1) sizeof(asn_DEF_Horandvervel_tags_1) / sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Horandvervel_1, asn_MBR_Horandvervel_1,
4, /* Elements count */ 4, /* Elements count */
&asn_SPC_Horandvervel_specs_1 /* Additional specs */ &asn_SPC_Horandvervel_specs_1 /* Additional specs */
}; };

View File

@ -8,28 +8,36 @@
static int static int
memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_bearing_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 9)) { if (size == 9)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -39,28 +47,36 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_horspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 16)) { if (size == 16)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -86,8 +102,7 @@ static asn_TYPE_member_t asn_MBR_Horvel_1[] = {
memb_bearing_constraint_1, memb_bearing_constraint_1,
&asn_PER_memb_bearing_constr_2, &asn_PER_memb_bearing_constr_2,
0, 0,
"bearing" "bearing"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horvel, horspeed), {ATF_NOFLAGS, 0, offsetof(struct Horvel, horspeed),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -95,12 +110,10 @@ static asn_TYPE_member_t asn_MBR_Horvel_1[] = {
memb_horspeed_constraint_1, memb_horspeed_constraint_1,
&asn_PER_memb_horspeed_constr_3, &asn_PER_memb_horspeed_constr_3,
0, 0,
"horspeed" "horspeed"},
},
}; };
static ber_tlv_tag_t asn_DEF_Horvel_tags_1[] = { static ber_tlv_tag_t asn_DEF_Horvel_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_Horvel_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_Horvel_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bearing at 233 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bearing at 233 */
{(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* horspeed at 234 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* horspeed at 234 */
@ -128,14 +141,11 @@ asn_TYPE_descriptor_t asn_DEF_Horvel = {
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_Horvel_tags_1, asn_DEF_Horvel_tags_1,
sizeof(asn_DEF_Horvel_tags_1) sizeof(asn_DEF_Horvel_tags_1) / sizeof(asn_DEF_Horvel_tags_1[0]), /* 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) / sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Horvel_1, asn_MBR_Horvel_1,
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_Horvel_specs_1 /* Additional specs */ &asn_SPC_Horvel_specs_1 /* Additional specs */
}; };

View File

@ -8,28 +8,36 @@
static int static int
memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_bearing_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 9)) { if (size == 9)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -39,28 +47,36 @@ memb_bearing_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_horspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 16)) { if (size == 16)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -70,28 +86,36 @@ memb_horspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_uncertspeed_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_uncertspeed_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -122,8 +146,7 @@ static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = {
memb_bearing_constraint_1, memb_bearing_constraint_1,
&asn_PER_memb_bearing_constr_2, &asn_PER_memb_bearing_constr_2,
0, 0,
"bearing" "bearing"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horveluncert, horspeed), {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, horspeed),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -131,8 +154,7 @@ static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = {
memb_horspeed_constraint_1, memb_horspeed_constraint_1,
&asn_PER_memb_horspeed_constr_3, &asn_PER_memb_horspeed_constr_3,
0, 0,
"horspeed" "horspeed"},
},
{ATF_NOFLAGS, 0, offsetof(struct Horveluncert, uncertspeed), {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, uncertspeed),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -140,12 +162,10 @@ static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = {
memb_uncertspeed_constraint_1, memb_uncertspeed_constraint_1,
&asn_PER_memb_uncertspeed_constr_4, &asn_PER_memb_uncertspeed_constr_4,
0, 0,
"uncertspeed" "uncertspeed"},
},
}; };
static ber_tlv_tag_t asn_DEF_Horveluncert_tags_1[] = { static ber_tlv_tag_t asn_DEF_Horveluncert_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_Horveluncert_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_Horveluncert_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bearing at 245 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* bearing at 245 */
{(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* horspeed at 246 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* horspeed at 246 */
@ -174,14 +194,11 @@ asn_TYPE_descriptor_t asn_DEF_Horveluncert = {
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_Horveluncert_tags_1, asn_DEF_Horveluncert_tags_1,
sizeof(asn_DEF_Horveluncert_tags_1) sizeof(asn_DEF_Horveluncert_tags_1) / sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */
asn_DEF_Horveluncert_tags_1, /* Same as above */ asn_DEF_Horveluncert_tags_1, /* Same as above */
sizeof(asn_DEF_Horveluncert_tags_1) sizeof(asn_DEF_Horveluncert_tags_1) / sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_Horveluncert_1, asn_MBR_Horveluncert_1,
3, /* Elements count */ 3, /* Elements count */
&asn_SPC_Horveluncert_specs_1 /* Additional specs */ &asn_SPC_Horveluncert_specs_1 /* Additional specs */
}; };

View File

@ -8,11 +8,13 @@
static int static int
memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_ipv4Address_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -21,10 +23,13 @@ memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 4)) { if (size == 4)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -34,11 +39,13 @@ memb_ipv4Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_ipv6Address_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -47,10 +54,13 @@ memb_ipv6Address_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 16)) { if (size == 16)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -81,8 +91,7 @@ static asn_TYPE_member_t asn_MBR_IPAddress_1[] = {
memb_ipv4Address_constraint_1, memb_ipv4Address_constraint_1,
&asn_PER_memb_ipv4Address_constr_2, &asn_PER_memb_ipv4Address_constr_2,
0, 0,
"ipv4Address" "ipv4Address"},
},
{ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv6Address), {ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv6Address),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -90,8 +99,7 @@ static asn_TYPE_member_t asn_MBR_IPAddress_1[] = {
memb_ipv6Address_constraint_1, memb_ipv6Address_constraint_1,
&asn_PER_memb_ipv6Address_constr_3, &asn_PER_memb_ipv6Address_constr_3,
0, 0,
"ipv6Address" "ipv6Address"},
},
}; };
static asn_TYPE_tag2member_t asn_MAP_IPAddress_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_IPAddress_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ipv4Address at 41 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* ipv4Address at 41 */
@ -129,4 +137,3 @@ asn_TYPE_descriptor_t asn_DEF_IPAddress = {
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_IPAddress_specs_1 /* Additional specs */ &asn_SPC_IPAddress_specs_1 /* Additional specs */
}; };

View File

@ -6,30 +6,37 @@
#include "KeyIdentity.h" #include "KeyIdentity.h"
int int KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 128)) { if (size == 128)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -42,7 +49,8 @@ KeyIdentity_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
static void static void
KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td)
{
td->free_struct = asn_DEF_BIT_STRING.free_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->print_struct = asn_DEF_BIT_STRING.print_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
@ -58,23 +66,24 @@ KeyIdentity_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->specifics = asn_DEF_BIT_STRING.specifics; td->specifics = asn_DEF_BIT_STRING.specifics;
} }
void void KeyIdentity_free(asn_TYPE_descriptor_t *td,
KeyIdentity_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only)
void *struct_ptr, int contents_only) { {
KeyIdentity_1_inherit_TYPE_descriptor(td); KeyIdentity_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only); td->free_struct(td, struct_ptr, contents_only);
} }
int int KeyIdentity_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
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); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const void *bufptr, size_t size, int tag_mode)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); 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);
} }
@ -82,14 +91,16 @@ KeyIdentity_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td
asn_enc_rval_t asn_enc_rval_t
KeyIdentity_encode_der(asn_TYPE_descriptor_t *td, KeyIdentity_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag, void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const char *opt_mname, const void *bufptr, size_t size)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); 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);
} }
@ -97,14 +108,16 @@ KeyIdentity_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td
asn_enc_rval_t asn_enc_rval_t
KeyIdentity_encode_xer(asn_TYPE_descriptor_t *td, void *structure, KeyIdentity_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); 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);
} }
@ -112,7 +125,8 @@ KeyIdentity_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *t
asn_enc_rval_t asn_enc_rval_t
KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td, KeyIdentity_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) { void *structure, asn_per_outp_t *per_out)
{
KeyIdentity_1_inherit_TYPE_descriptor(td); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out); return td->uper_encoder(td, constraints, structure, per_out);
} }
@ -123,8 +137,7 @@ static asn_per_constraints_t asn_PER_type_KeyIdentity_constr_1 = {
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_KeyIdentity_tags_1[] = { static ber_tlv_tag_t asn_DEF_KeyIdentity_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))};
};
asn_TYPE_descriptor_t asn_DEF_KeyIdentity = { asn_TYPE_descriptor_t asn_DEF_KeyIdentity = {
"KeyIdentity", "KeyIdentity",
"KeyIdentity", "KeyIdentity",
@ -139,13 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_KeyIdentity = {
KeyIdentity_encode_uper, KeyIdentity_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_KeyIdentity_tags_1, asn_DEF_KeyIdentity_tags_1,
sizeof(asn_DEF_KeyIdentity_tags_1) sizeof(asn_DEF_KeyIdentity_tags_1) / sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */
/sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */
asn_DEF_KeyIdentity_tags_1, /* Same as above */ asn_DEF_KeyIdentity_tags_1, /* Same as above */
sizeof(asn_DEF_KeyIdentity_tags_1) sizeof(asn_DEF_KeyIdentity_tags_1) / sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */
/sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */
&asn_PER_type_KeyIdentity_constr_1, &asn_PER_type_KeyIdentity_constr_1,
0, 0, /* No members */ 0, 0, /* No members */
0 /* No specifics */ 0 /* No specifics */
}; };

View File

@ -6,30 +6,37 @@
#include "KeyIdentity4.h" #include "KeyIdentity4.h"
int int KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 128)) { if (size == 128)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -42,7 +49,8 @@ KeyIdentity4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
static void static void
KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td)
{
td->free_struct = asn_DEF_BIT_STRING.free_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->print_struct = asn_DEF_BIT_STRING.print_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
@ -58,23 +66,24 @@ KeyIdentity4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->specifics = asn_DEF_BIT_STRING.specifics; td->specifics = asn_DEF_BIT_STRING.specifics;
} }
void void KeyIdentity4_free(asn_TYPE_descriptor_t *td,
KeyIdentity4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only)
void *struct_ptr, int contents_only) { {
KeyIdentity4_1_inherit_TYPE_descriptor(td); KeyIdentity4_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only); td->free_struct(td, struct_ptr, contents_only);
} }
int int KeyIdentity4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
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); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const void *bufptr, size_t size, int tag_mode)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); 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);
} }
@ -82,14 +91,16 @@ KeyIdentity4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *t
asn_enc_rval_t asn_enc_rval_t
KeyIdentity4_encode_der(asn_TYPE_descriptor_t *td, KeyIdentity4_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag, void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const char *opt_mname, const void *bufptr, size_t size)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); 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);
} }
@ -97,14 +108,16 @@ KeyIdentity4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *t
asn_enc_rval_t asn_enc_rval_t
KeyIdentity4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, KeyIdentity4_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
KeyIdentity4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); 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);
} }
@ -112,7 +125,8 @@ KeyIdentity4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *
asn_enc_rval_t asn_enc_rval_t
KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td, KeyIdentity4_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) { void *structure, asn_per_outp_t *per_out)
{
KeyIdentity4_1_inherit_TYPE_descriptor(td); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out); return td->uper_encoder(td, constraints, structure, per_out);
} }
@ -123,8 +137,7 @@ static asn_per_constraints_t asn_PER_type_KeyIdentity4_constr_1 = {
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_KeyIdentity4_tags_1[] = { static ber_tlv_tag_t asn_DEF_KeyIdentity4_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))};
};
asn_TYPE_descriptor_t asn_DEF_KeyIdentity4 = { asn_TYPE_descriptor_t asn_DEF_KeyIdentity4 = {
"KeyIdentity4", "KeyIdentity4",
"KeyIdentity4", "KeyIdentity4",
@ -139,13 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_KeyIdentity4 = {
KeyIdentity4_encode_uper, KeyIdentity4_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_KeyIdentity4_tags_1, asn_DEF_KeyIdentity4_tags_1,
sizeof(asn_DEF_KeyIdentity4_tags_1) sizeof(asn_DEF_KeyIdentity4_tags_1) / sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */
/sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */
asn_DEF_KeyIdentity4_tags_1, /* Same as above */ asn_DEF_KeyIdentity4_tags_1, /* Same as above */
sizeof(asn_DEF_KeyIdentity4_tags_1) sizeof(asn_DEF_KeyIdentity4_tags_1) / sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */
/sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */
&asn_PER_type_KeyIdentity4_constr_1, &asn_PER_type_KeyIdentity4_constr_1,
0, 0, /* No members */ 0, 0, /* No members */
0 /* No specifics */ 0 /* No specifics */
}; };

View File

@ -6,30 +6,37 @@
#include "MAC.h" #include "MAC.h"
int int MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 64)) { if (size == 64)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -42,7 +49,8 @@ MAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
static void static void
MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td)
{
td->free_struct = asn_DEF_BIT_STRING.free_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->print_struct = asn_DEF_BIT_STRING.print_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
@ -58,23 +66,24 @@ MAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->specifics = asn_DEF_BIT_STRING.specifics; td->specifics = asn_DEF_BIT_STRING.specifics;
} }
void void MAC_free(asn_TYPE_descriptor_t *td,
MAC_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only)
void *struct_ptr, int contents_only) { {
MAC_1_inherit_TYPE_descriptor(td); MAC_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only); td->free_struct(td, struct_ptr, contents_only);
} }
int int MAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
MAC_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) { {
MAC_1_inherit_TYPE_descriptor(td); MAC_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
MAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const void *bufptr, size_t size, int tag_mode)
{
MAC_1_inherit_TYPE_descriptor(td); 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);
} }
@ -82,14 +91,16 @@ MAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
MAC_encode_der(asn_TYPE_descriptor_t *td, MAC_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag, void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
MAC_1_inherit_TYPE_descriptor(td); MAC_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
MAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const char *opt_mname, const void *bufptr, size_t size)
{
MAC_1_inherit_TYPE_descriptor(td); 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);
} }
@ -97,14 +108,16 @@ MAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
MAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, MAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
MAC_1_inherit_TYPE_descriptor(td); MAC_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
MAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data)
{
MAC_1_inherit_TYPE_descriptor(td); 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);
} }
@ -112,7 +125,8 @@ MAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
MAC_encode_uper(asn_TYPE_descriptor_t *td, MAC_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) { void *structure, asn_per_outp_t *per_out)
{
MAC_1_inherit_TYPE_descriptor(td); MAC_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out); return td->uper_encoder(td, constraints, structure, per_out);
} }
@ -123,8 +137,7 @@ static asn_per_constraints_t asn_PER_type_MAC_constr_1 = {
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_MAC_tags_1[] = { static ber_tlv_tag_t asn_DEF_MAC_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))};
};
asn_TYPE_descriptor_t asn_DEF_MAC = { asn_TYPE_descriptor_t asn_DEF_MAC = {
"MAC", "MAC",
"MAC", "MAC",
@ -139,13 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_MAC = {
MAC_encode_uper, MAC_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_MAC_tags_1, asn_DEF_MAC_tags_1,
sizeof(asn_DEF_MAC_tags_1) sizeof(asn_DEF_MAC_tags_1) / sizeof(asn_DEF_MAC_tags_1[0]), /* 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) / sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */
/sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */
&asn_PER_type_MAC_constr_1, &asn_PER_type_MAC_constr_1,
0, 0, /* No members */ 0, 0, /* No members */
0 /* No specifics */ 0 /* No specifics */
}; };

View File

@ -8,28 +8,36 @@
static int static int
memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_shortKey_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 128)) { if (size == 128)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -39,28 +47,36 @@ memb_shortKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_longKey_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_longKey_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 256)) { if (size == 256)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -91,8 +107,7 @@ static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = {
memb_shortKey_constraint_1, memb_shortKey_constraint_1,
&asn_PER_memb_shortKey_constr_2, &asn_PER_memb_shortKey_constr_2,
0, 0,
"shortKey" "shortKey"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.longKey), {ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.longKey),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -100,8 +115,7 @@ static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = {
memb_longKey_constraint_1, memb_longKey_constraint_1,
&asn_PER_memb_longKey_constr_3, &asn_PER_memb_longKey_constr_3,
0, 0,
"longKey" "longKey"},
},
}; };
static asn_TYPE_tag2member_t asn_MAP_SETAuthKey_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_SETAuthKey_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* shortKey at 17 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* shortKey at 17 */
@ -139,4 +153,3 @@ asn_TYPE_descriptor_t asn_DEF_SETAuthKey = {
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_SETAuthKey_specs_1 /* Additional specs */ &asn_SPC_SETAuthKey_specs_1 /* Additional specs */
}; };

View File

@ -6,13 +6,15 @@
#include "SETId.h" #include "SETId.h"
static int check_permitted_alphabet_6(const void *sptr) { static int check_permitted_alphabet_6(const void *sptr)
{
/* The underlying type is IA5String */ /* The underlying type is IA5String */
const IA5String_t *st = (const IA5String_t *)sptr; const IA5String_t *st = (const IA5String_t *)sptr;
const uint8_t *ch = st->buf; const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size; const uint8_t *end = ch + st->size;
for(; ch < end; ch++) { for (; ch < end; ch++)
{
uint8_t cv = *ch; uint8_t cv = *ch;
if (!(cv <= 127)) return -1; if (!(cv <= 127)) return -1;
} }
@ -21,11 +23,13 @@ static int check_permitted_alphabet_6(const void *sptr) {
static int static int
memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_msisdn_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -34,10 +38,13 @@ memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -47,11 +54,13 @@ memb_msisdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_mdn_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -60,10 +69,13 @@ memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -73,28 +85,36 @@ memb_mdn_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_min_constraint_1(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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 34)) { if (size == 34)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -104,11 +124,13 @@ memb_min_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_imsi_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -117,10 +139,13 @@ memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 8)) { if (size == 8)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -130,11 +155,13 @@ memb_imsi_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
static int static int
memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_nai_constraint_1(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 IA5String_t *st = (const IA5String_t *)sptr; const IA5String_t *st = (const IA5String_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -143,11 +170,13 @@ memb_nai_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size >= 1 && size <= 1000) if ((size >= 1 && size <= 1000) && !check_permitted_alphabet_6(st))
&& !check_permitted_alphabet_6(st)) { {
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -193,8 +222,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
memb_msisdn_constraint_1, memb_msisdn_constraint_1,
&asn_PER_memb_msisdn_constr_2, &asn_PER_memb_msisdn_constr_2,
0, 0,
"msisdn" "msisdn"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETId, choice.mdn), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.mdn),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -202,8 +230,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
memb_mdn_constraint_1, memb_mdn_constraint_1,
&asn_PER_memb_mdn_constr_3, &asn_PER_memb_mdn_constr_3,
0, 0,
"mdn" "mdn"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETId, choice.min), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.min),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -211,8 +238,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
memb_min_constraint_1, memb_min_constraint_1,
&asn_PER_memb_min_constr_4, &asn_PER_memb_min_constr_4,
0, 0,
"min" "min"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -220,8 +246,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
memb_imsi_constraint_1, memb_imsi_constraint_1,
&asn_PER_memb_imsi_constr_5, &asn_PER_memb_imsi_constr_5,
0, 0,
"imsi" "imsi"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
@ -229,8 +254,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
memb_nai_constraint_1, memb_nai_constraint_1,
&asn_PER_memb_nai_constr_6, &asn_PER_memb_nai_constr_6,
0, 0,
"nai" "nai"},
},
{ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress),
(ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
+1, /* EXPLICIT tag at current level */ +1, /* EXPLICIT tag at current level */
@ -238,8 +262,7 @@ static asn_TYPE_member_t asn_MBR_SETId_1[] = {
0, /* Defer constraints checking to the member type */ 0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
0, 0,
"iPAddress" "iPAddress"},
},
}; };
static asn_TYPE_tag2member_t asn_MAP_SETId_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_SETId_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msisdn at 22 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* msisdn at 22 */
@ -281,4 +304,3 @@ asn_TYPE_descriptor_t asn_DEF_SETId = {
6, /* Elements count */ 6, /* Elements count */
&asn_SPC_SETId_specs_1 /* Additional specs */ &asn_SPC_SETId_specs_1 /* Additional specs */
}; };

View File

@ -8,11 +8,13 @@
static int static int
memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_sessionID_constraint_1(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 OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -21,10 +23,13 @@ memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size; size = st->size;
if((size == 4)) { if (size == 4)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -45,8 +50,7 @@ static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = {
memb_sessionID_constraint_1, memb_sessionID_constraint_1,
&asn_PER_memb_sessionID_constr_2, &asn_PER_memb_sessionID_constr_2,
0, 0,
"sessionID" "sessionID"},
},
{ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId), {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
+1, /* EXPLICIT tag at current level */ +1, /* EXPLICIT tag at current level */
@ -54,12 +58,10 @@ static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = {
0, /* Defer constraints checking to the member type */ 0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
0, 0,
"slpId" "slpId"},
},
}; };
static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = { static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_SlpSessionID_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_SlpSessionID_tag2el_1[] = {
{(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sessionID at 37 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sessionID at 37 */
{(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* slpId at 38 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* slpId at 38 */
@ -87,14 +89,11 @@ asn_TYPE_descriptor_t asn_DEF_SlpSessionID = {
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_SlpSessionID_tags_1, asn_DEF_SlpSessionID_tags_1,
sizeof(asn_DEF_SlpSessionID_tags_1) sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
/sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
asn_DEF_SlpSessionID_tags_1, /* Same as above */ asn_DEF_SlpSessionID_tags_1, /* Same as above */
sizeof(asn_DEF_SlpSessionID_tags_1) sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
/sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
0, /* No PER visible constraints */ 0, /* No PER visible constraints */
asn_MBR_SlpSessionID_1, asn_MBR_SlpSessionID_1,
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_SlpSessionID_specs_1 /* Additional specs */ &asn_SPC_SlpSessionID_specs_1 /* Additional specs */
}; };

View File

@ -6,30 +6,37 @@
#include "Ver.h" #include "Ver.h"
int int Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
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; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size; size_t size;
if(!sptr) { if (!sptr)
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)", "%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
return -1; return -1;
} }
if(st->size > 0) { if (st->size > 0)
{
/* Size in bits */ /* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); size = 8 * st->size - (st->bits_unused & 0x07);
} else { }
else
{
size = 0; size = 0;
} }
if((size == 64)) { if (size == 64)
{
/* Constraint check succeeded */ /* Constraint check succeeded */
return 0; return 0;
} else { }
else
{
_ASN_CTFAIL(app_key, td, sptr, _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__); td->name, __FILE__, __LINE__);
@ -42,7 +49,8 @@ Ver_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* so here we adjust the DEF accordingly. * so here we adjust the DEF accordingly.
*/ */
static void static void
Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td)
{
td->free_struct = asn_DEF_BIT_STRING.free_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->print_struct = asn_DEF_BIT_STRING.print_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
@ -58,23 +66,24 @@ Ver_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->specifics = asn_DEF_BIT_STRING.specifics; td->specifics = asn_DEF_BIT_STRING.specifics;
} }
void void Ver_free(asn_TYPE_descriptor_t *td,
Ver_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only)
void *struct_ptr, int contents_only) { {
Ver_1_inherit_TYPE_descriptor(td); Ver_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only); td->free_struct(td, struct_ptr, contents_only);
} }
int int Ver_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
Ver_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) { {
Ver_1_inherit_TYPE_descriptor(td); Ver_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
Ver_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const void *bufptr, size_t size, int tag_mode)
{
Ver_1_inherit_TYPE_descriptor(td); 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);
} }
@ -82,14 +91,16 @@ Ver_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
Ver_encode_der(asn_TYPE_descriptor_t *td, Ver_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag, void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
Ver_1_inherit_TYPE_descriptor(td); Ver_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
Ver_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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) { void **structure, const char *opt_mname, const void *bufptr, size_t size)
{
Ver_1_inherit_TYPE_descriptor(td); 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);
} }
@ -97,14 +108,16 @@ Ver_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
Ver_encode_xer(asn_TYPE_descriptor_t *td, void *structure, Ver_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key)
{
Ver_1_inherit_TYPE_descriptor(td); Ver_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
} }
asn_dec_rval_t asn_dec_rval_t
Ver_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data)
{
Ver_1_inherit_TYPE_descriptor(td); 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);
} }
@ -112,7 +125,8 @@ Ver_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t asn_enc_rval_t
Ver_encode_uper(asn_TYPE_descriptor_t *td, Ver_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) { void *structure, asn_per_outp_t *per_out)
{
Ver_1_inherit_TYPE_descriptor(td); Ver_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out); return td->uper_encoder(td, constraints, structure, per_out);
} }
@ -123,8 +137,7 @@ static asn_per_constraints_t asn_PER_type_Ver_constr_1 = {
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_Ver_tags_1[] = { static ber_tlv_tag_t asn_DEF_Ver_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (3 << 2))};
};
asn_TYPE_descriptor_t asn_DEF_Ver = { asn_TYPE_descriptor_t asn_DEF_Ver = {
"Ver", "Ver",
"Ver", "Ver",
@ -139,13 +152,10 @@ asn_TYPE_descriptor_t asn_DEF_Ver = {
Ver_encode_uper, Ver_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_Ver_tags_1, asn_DEF_Ver_tags_1,
sizeof(asn_DEF_Ver_tags_1) sizeof(asn_DEF_Ver_tags_1) / sizeof(asn_DEF_Ver_tags_1[0]), /* 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) / sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */
/sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */
&asn_PER_type_Ver_constr_1, &asn_PER_type_Ver_constr_1,
0, 0, /* No members */ 0, 0, /* No members */
0 /* No specifics */ 0 /* No specifics */
}; };

View File

@ -7,7 +7,8 @@
#include <constr_TYPE.h> #include <constr_TYPE.h>
#include <per_opentype.h> #include <per_opentype.h>
typedef struct uper_ugot_key { typedef struct uper_ugot_key
{
asn_per_data_t oldpd; /* Old per data source */ asn_per_data_t oldpd; /* Old per data source */
size_t unclaimed; size_t unclaimed;
size_t ot_moved; /* Number of bits moved by OT processing */ size_t ot_moved; /* Number of bits moved by OT processing */
@ -24,8 +25,8 @@ int asn_debug_indent;
* Encode an "open type field". * Encode an "open type field".
* #10.1, #10.2 * #10.1, #10.2
*/ */
int int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po)
uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { {
void *buf; void *buf;
void *bptr; void *bptr;
ssize_t size; ssize_t size;
@ -36,7 +37,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); size = uper_encode_to_new_buffer(td, constraints, sptr, &buf);
if (size <= 0) return -1; if (size <= 0) return -1;
for(bptr = buf, toGo = size; toGo;) { for (bptr = buf, toGo = size; toGo;)
{
ssize_t maySave = uper_put_length(po, toGo); ssize_t maySave = uper_put_length(po, toGo);
if (maySave < 0) break; if (maySave < 0) break;
if (per_put_many_bits(po, bptr, maySave * 8)) break; if (per_put_many_bits(po, bptr, maySave * 8)) break;
@ -55,7 +57,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
static asn_dec_rval_t static asn_dec_rval_t
uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
asn_dec_rval_t rv; asn_dec_rval_t rv;
ssize_t chunk_bytes; ssize_t chunk_bytes;
int repeat; int repeat;
@ -69,28 +72,34 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
ASN_DEBUG("Getting open type %s...", td->name); ASN_DEBUG("Getting open type %s...", td->name);
do { do
{
chunk_bytes = uper_get_length(pd, -1, &repeat); chunk_bytes = uper_get_length(pd, -1, &repeat);
if(chunk_bytes < 0) { if (chunk_bytes < 0)
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
} }
if(bufLen + chunk_bytes > bufSize) { if (bufLen + chunk_bytes > bufSize)
{
void *ptr; void *ptr;
bufSize = chunk_bytes + (bufSize << 2); bufSize = chunk_bytes + (bufSize << 2);
ptr = REALLOC(buf, bufSize); ptr = REALLOC(buf, bufSize);
if(!ptr) { if (!ptr)
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
buf = ptr; buf = ptr;
} }
if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { if (per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3))
{
FREEMEM(buf); FREEMEM(buf);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
} }
bufLen += chunk_bytes; bufLen += chunk_bytes;
} while(repeat); }
while (repeat);
ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name,
bufLen); bufLen);
@ -103,23 +112,30 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); rv = td->uper_decoder(ctx, td, constraints, sptr, &spd);
asn_debug_indent -= 4; asn_debug_indent -= 4;
if(rv.code == RC_OK) { if (rv.code == RC_OK)
{
/* Check padding validity */ /* Check padding validity */
padding = spd.nbits - spd.nboff; padding = spd.nbits - spd.nboff;
if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { if (padding < 8 && per_get_few_bits(&spd, padding) == 0)
{
/* Everything is cool */ /* Everything is cool */
FREEMEM(buf); FREEMEM(buf);
return rv; return rv;
} }
FREEMEM(buf); FREEMEM(buf);
if(padding >= 8) { if (padding >= 8)
{
ASN_DEBUG("Too large padding %d in open type", padding); ASN_DEBUG("Too large padding %d in open type", padding);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} else { }
else
{
ASN_DEBUG("Non-zero padding"); ASN_DEBUG("Non-zero padding");
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} else { }
else
{
FREEMEM(buf); FREEMEM(buf);
/* rv.code could be RC_WMORE, nonsense in this context */ /* rv.code could be RC_WMORE, nonsense in this context */
rv.code = RC_FAIL; /* Noone would give us more */ rv.code = RC_FAIL; /* Noone would give us more */
@ -130,7 +146,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
static asn_dec_rval_t GCC_NOTUSED static asn_dec_rval_t GCC_NOTUSED
uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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) { asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
uper_ugot_key arg; uper_ugot_key arg;
asn_dec_rval_t rv; asn_dec_rval_t rv;
ssize_t padding; ssize_t padding;
@ -152,29 +169,34 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
rv = td->uper_decoder(ctx, td, constraints, sptr, pd); rv = td->uper_decoder(ctx, td, constraints, sptr, pd);
asn_debug_indent -= 4; asn_debug_indent -= 4;
#define UPDRESTOREPD do { \ #define UPDRESTOREPD \
do \
{ \
/* buffer and nboff are valid, preserve them. */ \ /* buffer and nboff are valid, preserve them. */ \
pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \
pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \
pd->refill = arg.oldpd.refill; \ pd->refill = arg.oldpd.refill; \
pd->refill_key = arg.oldpd.refill_key; \ pd->refill_key = arg.oldpd.refill_key; \
} while(0) } \
while (0)
if(rv.code != RC_OK) { if (rv.code != RC_OK)
{
UPDRESTOREPD; UPDRESTOREPD;
return rv; return rv;
} }
ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d" ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name,
, td->name,
per_data_string(pd), per_data_string(pd),
per_data_string(&arg.oldpd), per_data_string(&arg.oldpd),
arg.unclaimed, arg.repeat); arg.unclaimed, arg.repeat);
padding = pd->moved % 8; padding = pd->moved % 8;
if(padding) { if (padding)
{
int32_t pvalue; int32_t pvalue;
if(padding > 7) { if (padding > 7)
{
ASN_DEBUG("Too large padding %d in open type", ASN_DEBUG("Too large padding %d in open type",
padding); padding);
rv.code = RC_FAIL; rv.code = RC_FAIL;
@ -184,12 +206,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
padding = 8 - padding; padding = 8 - padding;
ASN_DEBUG("Getting padding of %d bits", padding); ASN_DEBUG("Getting padding of %d bits", padding);
pvalue = per_get_few_bits(pd, padding); pvalue = per_get_few_bits(pd, padding);
switch(pvalue) { switch (pvalue)
{
case -1: case -1:
ASN_DEBUG("Padding skip failed"); ASN_DEBUG("Padding skip failed");
UPDRESTOREPD; UPDRESTOREPD;
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
case 0: break; case 0:
break;
default: default:
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
padding, (int)pvalue); padding, (int)pvalue);
@ -197,13 +221,17 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} }
if(pd->nboff != pd->nbits) { if (pd->nboff != pd->nbits)
{
ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, 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) { if (1)
{
UPDRESTOREPD; UPDRESTOREPD;
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} else { }
else
{
arg.unclaimed += pd->nbits - pd->nboff; arg.unclaimed += pd->nbits - pd->nboff;
} }
} }
@ -213,8 +241,10 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
/* Skip data not consumed by the decoder */ /* Skip data not consumed by the decoder */
if (arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed); if (arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed);
if(arg.unclaimed) { if (arg.unclaimed)
switch(per_skip_bits(pd, arg.unclaimed)) { {
switch (per_skip_bits(pd, arg.unclaimed))
{
case -1: case -1:
ASN_DEBUG("Claim of %d failed", arg.unclaimed); ASN_DEBUG("Claim of %d failed", arg.unclaimed);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
@ -229,7 +259,8 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
arg.unclaimed = 0; arg.unclaimed = 0;
} }
if(arg.repeat) { if (arg.repeat)
{
ASN_DEBUG("Not consumed the whole thing"); ASN_DEBUG("Not consumed the whole thing");
rv.code = RC_FAIL; rv.code = RC_FAIL;
return rv; return rv;
@ -241,15 +272,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t asn_dec_rval_t
uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
return uper_open_type_get_simple(ctx, td, constraints, return uper_open_type_get_simple(ctx, td, constraints,
sptr, pd); sptr, pd);
} }
int int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd)
uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { {
asn_TYPE_descriptor_t s_td; asn_TYPE_descriptor_t s_td;
asn_dec_rval_t rv; asn_dec_rval_t rv;
@ -269,7 +299,8 @@ uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) {
static asn_dec_rval_t static asn_dec_rval_t
uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, 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_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
{
asn_dec_rval_t rv; asn_dec_rval_t rv;
(void)ctx; (void)ctx;
@ -277,7 +308,8 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
(void)constraints; (void)constraints;
(void)sptr; (void)sptr;
while(per_get_few_bits(pd, 24) >= 0); while (per_get_few_bits(pd, 24) >= 0)
;
rv.code = RC_OK; rv.code = RC_OK;
rv.consumed = pd->moved; rv.consumed = pd->moved;
@ -286,7 +318,8 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
} }
static int static int
uper_ugot_refill(asn_per_data_t *pd) { uper_ugot_refill(asn_per_data_t *pd)
{
uper_ugot_key *arg = pd->refill_key; uper_ugot_key *arg = pd->refill_key;
ssize_t next_chunk_bytes, next_chunk_bits; ssize_t next_chunk_bytes, next_chunk_bits;
ssize_t avail; ssize_t avail;
@ -303,11 +336,13 @@ uper_ugot_refill(asn_per_data_t *pd) {
oldpd->moved += pd->moved - arg->ot_moved; oldpd->moved += pd->moved - arg->ot_moved;
arg->ot_moved = pd->moved; arg->ot_moved = pd->moved;
if(arg->unclaimed) { if (arg->unclaimed)
{
/* Refill the container */ /* Refill the container */
if (per_get_few_bits(oldpd, 1)) if (per_get_few_bits(oldpd, 1))
return -1; return -1;
if(oldpd->nboff == 0) { if (oldpd->nboff == 0)
{
assert(0); assert(0);
return -1; return -1;
} }
@ -318,7 +353,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
return 0; return 0;
} }
if(!arg->repeat) { if (!arg->repeat)
{
ASN_DEBUG("Want more but refill doesn't have it"); ASN_DEBUG("Want more but refill doesn't have it");
return -1; return -1;
} }
@ -327,20 +363,24 @@ uper_ugot_refill(asn_per_data_t *pd) {
ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", 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) return -1;
if(next_chunk_bytes == 0) { if (next_chunk_bytes == 0)
{
pd->refill = 0; /* No more refills, naturally */ pd->refill = 0; /* No more refills, naturally */
assert(!arg->repeat); /* Implementation guarantee */ assert(!arg->repeat); /* Implementation guarantee */
} }
next_chunk_bits = next_chunk_bytes << 3; next_chunk_bits = next_chunk_bytes << 3;
avail = oldpd->nbits - oldpd->nboff; avail = oldpd->nbits - oldpd->nboff;
if(avail >= next_chunk_bits) { if (avail >= next_chunk_bits)
{
pd->nbits = oldpd->nboff + next_chunk_bits; pd->nbits = oldpd->nboff + next_chunk_bits;
arg->unclaimed = 0; arg->unclaimed = 0;
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)",
next_chunk_bits, oldpd->moved, next_chunk_bits, oldpd->moved,
oldpd->nboff, oldpd->nbits, oldpd->nboff, oldpd->nbits,
oldpd->nbits - oldpd->nboff); oldpd->nbits - oldpd->nboff);
} else { }
else
{
pd->nbits = oldpd->nbits; pd->nbits = oldpd->nbits;
arg->unclaimed = next_chunk_bits - avail; 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);
@ -353,20 +393,27 @@ uper_ugot_refill(asn_per_data_t *pd) {
} }
static int static int
per_skip_bits(asn_per_data_t *pd, int skip_nbits) { per_skip_bits(asn_per_data_t *pd, int skip_nbits)
{
int hasNonZeroBits = 0; int hasNonZeroBits = 0;
while(skip_nbits > 0) { while (skip_nbits > 0)
int skip; {
int skip = 0;
if (skip_nbits < skip) if (skip_nbits < skip)
skip = skip_nbits; skip = skip_nbits;
else else
skip = 24; skip = 24;
skip_nbits -= skip; skip_nbits -= skip;
switch(per_get_few_bits(pd, skip)) { switch (per_get_few_bits(pd, skip))
case -1: return -1; /* Starving */ {
case 0: continue; /* Skipped empty space */ case -1:
default: hasNonZeroBits = 1; continue; return -1; /* Starving */
case 0:
continue; /* Skipped empty space */
default:
hasNonZeroBits = 1;
continue;
} }
} }
return hasNonZeroBits; return hasNonZeroBits;

View File

@ -262,7 +262,7 @@ bool Galileo_Navigation_Message::CRC_test(std::bitset<GALILEO_DATA_FRAME_BITS> b
uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter) uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
{ {
uint64_t value = 0; uint64_t value = 0ULL;
int32_t num_of_slices = parameter.size(); int32_t num_of_slices = parameter.size();
for (int32_t i = 0; i < num_of_slices; i++) for (int32_t i = 0; i < num_of_slices; i++)
{ {

View File

@ -230,7 +230,7 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset<GLONASS_G
uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter) uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
{ {
uint64_t value = 0; uint64_t value = 0ULL;
int32_t num_of_slices = parameter.size(); int32_t num_of_slices = parameter.size();
for (int32_t i = 0; i < num_of_slices; i++) for (int32_t i = 0; i < num_of_slices; i++)
{ {
@ -249,8 +249,8 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset<G
int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter) int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(std::bitset<GLONASS_GNAV_STRING_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
{ {
int64_t value = 0; int64_t value = 0LL;
int64_t sign = 0; int64_t sign = 0LL;
int32_t num_of_slices = parameter.size(); int32_t num_of_slices = parameter.size();
// read the MSB and perform the sign extension // read the MSB and perform the sign extension
if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1) if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1)

View File

@ -68,7 +68,6 @@ public:
double d_TOW_SF3; //!< Time of GPS Week from HOW word of Subframe 3 [s] double d_TOW_SF3; //!< Time of GPS Week from HOW word of Subframe 3 [s]
double d_TOW_SF4; //!< Time of GPS Week from HOW word of Subframe 4 [s] double d_TOW_SF4; //!< Time of GPS Week from HOW word of Subframe 4 [s]
double d_TOW_SF5; //!< Time of GPS Week from HOW word of Subframe 5 [s] double d_TOW_SF5; //!< Time of GPS Week from HOW word of Subframe 5 [s]
double d_IODE_SF2; double d_IODE_SF2;
double d_IODE_SF3; double d_IODE_SF3;
double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m] double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
@ -102,16 +101,13 @@ public:
double d_IODC; //!< Issue of Data, Clock double d_IODC; //!< Issue of Data, Clock
// broadcast orbit 7 // broadcast orbit 7
int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
double d_spare1; double d_spare1;
double d_spare2; double d_spare2;
double d_A_f0; //!< Coefficient 0 of code phase offset model [s] double d_A_f0; //!< Coefficient 0 of code phase offset model [s]
double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s] double d_A_f1; //!< Coefficient 1 of code phase offset model [s/s]
double d_A_f2; //!< Coefficient 2 of code phase offset model [s/s^2] double d_A_f2; //!< Coefficient 2 of code phase offset model [s/s^2]
// Almanac // Almanac
double d_Toa; //!< Almanac reference time [s] double d_Toa; //!< Almanac reference time [s]
int32_t i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced int32_t i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced

View File

@ -189,7 +189,9 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
{ {
std::string s_aux; std::string s_aux;
int32_t remainder = static_cast<int32_t>(std::fmod(s.length(), 8)); int32_t remainder = static_cast<int32_t>(std::fmod(s.length(), 8));
uint8_t c[s.length()]; std::vector<uint8_t> c;
c.reserve(s.length());
uint32_t k = 0; uint32_t k = 0;
if (remainder != 0) if (remainder != 0)
{ {
@ -213,7 +215,7 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
k++; k++;
} }
std::string ret(c, c + k / sizeof(c[0])); std::string ret(c.begin(), c.begin() + k);
return ret; return ret;
} }

View File

@ -391,7 +391,7 @@ int StaticPositionSystemTest::configure_receiver()
config->set_property("PVT.iono_model", "OFF"); config->set_property("PVT.iono_model", "OFF");
config->set_property("PVT.trop_model", "OFF"); config->set_property("PVT.trop_model", "OFF");
config->set_property("PVT.AR_GPS", "PPP-AR"); config->set_property("PVT.AR_GPS", "PPP-AR");
//config->set_property("PVT.elevation_mask", std::to_string(25)); config->set_property("PVT.elevation_mask", std::to_string(15));
config_f = 0; config_f = 0;
} }