1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +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++)
@ -157,15 +158,16 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
// This function is based on the GNU software GPS for MATLAB in Kay Borre's book // This function is based on the GNU software GPS for MATLAB in Kay Borre's book
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;
const uint32_t delay = ((static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) - _chip_shift) % static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS)) * _samplesPerCode / Galileo_E1_B_CODE_LENGTH_CHIPS; const uint32_t delay = ((static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS) - _chip_shift) % static_cast<int32_t>(Galileo_E1_B_CODE_LENGTH_CHIPS)) * _samplesPerCode / Galileo_E1_B_CODE_LENGTH_CHIPS;
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
float* _signal_E1; float* _signal_E1;
@ -174,24 +176,26 @@ void galileo_e1_code_gen_float_sampled(float* _dest, char _Signal[3],
if (_cboc == true) if (_cboc == true)
{ {
galileo_e1_gen_float(_signal_E1, primary_code_E1_chips, _Signal); //generate cboc 12 samples per chip galileo_e1_gen_float(_signal_E1, primary_code_E1_chips, _Signal); // generate cboc 12 samples per chip
} }
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
delete[] _signal_E1; delete[] _signal_E1;
_signal_E1 = _resampled_signal; _signal_E1 = _resampled_signal;
@ -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);
} }
@ -229,7 +234,7 @@ void galileo_e1_code_gen_complex_sampled(std::complex<float>* _dest, char _Signa
bool _secondary_flag) bool _secondary_flag)
{ {
std::string _galileo_signal = _Signal; std::string _galileo_signal = _Signal;
const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; //Hz const int32_t _codeFreqBasis = Galileo_E1_CODE_CHIP_RATE_HZ; // Hz
uint32_t _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) / uint32_t _samplesPerCode = static_cast<uint32_t>(static_cast<double>(_fs) /
(static_cast<double>(_codeFreqBasis) / static_cast<double>(Galileo_E1_B_CODE_LENGTH_CHIPS))); (static_cast<double>(_codeFreqBasis) / static_cast<double>(Galileo_E1_B_CODE_LENGTH_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,7 +87,11 @@ 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.
// return true if everything is ok.
// 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; 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,7 +136,11 @@ 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)
{ {
current_s++; //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++;
if ((current_s % 60) == 0) if ((current_s % 60) == 0)
{ {
current_s = 0; current_s = 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"
@ -48,26 +47,26 @@
* Block Viterbi decoding parameters. * Block Viterbi decoding parameters.
*/ */
/** Viterbi decoder reversed polynomial A */ /** Viterbi decoder reversed polynomial A */
#define GPS_L2C_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/ #define GPS_L2C_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/
/** Viterbi decoder reversed polynomial B */ /** Viterbi decoder reversed polynomial B */
#define GPS_L2C_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */ #define GPS_L2C_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */
/* /*
* GPS L2C message constants. * GPS L2C message constants.
*/ */
/** 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 */
#define GPS_CNAV_MSG_LENGTH (300) #define GPS_CNAV_MSG_LENGTH (300)
/** GPS LC2 CNAV CRC length in bits */ /** GPS LC2 CNAV CRC length in bits */
#define GPS_CNAV_MSG_CRC_LENGTH (24) #define GPS_CNAV_MSG_CRC_LENGTH (24)
/** GPS L2C CNAV message payload length in bits */ /** GPS L2C CNAV message payload length in bits */
#define GPS_CNAV_MSG_DATA_LENGTH (GPS_CNAV_MSG_LENGTH - GPS_CNAV_MSG_CRC_LENGTH) #define GPS_CNAV_MSG_DATA_LENGTH (GPS_CNAV_MSG_LENGTH - GPS_CNAV_MSG_CRC_LENGTH)
/** GPS L2C CNAV message lock detector threshold */ /** GPS L2C CNAV message lock detector threshold */
#define GPS_CNAV_LOCK_MAX_CRC_FAILS (10) #define GPS_CNAV_LOCK_MAX_CRC_FAILS (10)
@ -85,7 +84,7 @@
static u32 _cnav_compute_crc(cnav_v27_part_t *part) static u32 _cnav_compute_crc(cnav_v27_part_t *part)
{ {
u32 crc = crc24q_bits(0, part->decoded, GPS_CNAV_MSG_DATA_LENGTH, u32 crc = crc24q_bits(0, part->decoded, GPS_CNAV_MSG_DATA_LENGTH,
part->invert); part->invert);
return crc; return crc;
} }
@ -104,7 +103,7 @@ static u32 _cnav_compute_crc(cnav_v27_part_t *part)
static u32 _cnav_extract_crc(const cnav_v27_part_t *part) static u32 _cnav_extract_crc(const cnav_v27_part_t *part)
{ {
u32 crc = getbitu(part->decoded, GPS_CNAV_MSG_DATA_LENGTH, u32 crc = getbitu(part->decoded, GPS_CNAV_MSG_DATA_LENGTH,
GPS_CNAV_MSG_CRC_LENGTH); GPS_CNAV_MSG_CRC_LENGTH);
if (part->invert) if (part->invert)
{ {
crc ^= 0xFFFFFF; crc ^= 0xFFFFFF;
@ -152,7 +151,7 @@ static void _cnav_rescan_preamble(cnav_v27_part_t *part)
if (!part->preamble_seen && part->n_decoded >= GPS_CNAV_PREAMBLE_LENGTH) if (!part->preamble_seen && part->n_decoded >= GPS_CNAV_PREAMBLE_LENGTH)
{ {
bitshl(part->decoded, sizeof(part->decoded), bitshl(part->decoded, sizeof(part->decoded),
part->n_decoded - GPS_CNAV_PREAMBLE_LENGTH + 1); part->n_decoded - GPS_CNAV_PREAMBLE_LENGTH + 1);
part->n_decoded = GPS_CNAV_PREAMBLE_LENGTH - 1; part->n_decoded = GPS_CNAV_PREAMBLE_LENGTH - 1;
} }
} }
@ -200,11 +199,12 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
* - N - Number of bits to put into decoded buffer * - N - Number of bits to put into decoded buffer
* - 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);
/* Read decoded bits and add them to the decoded buffer */ /* Read decoded bits and add them to the decoded buffer */
bitcopy(part->decoded, part->n_decoded, tmp_bits, 0, GPS_L2C_V27_DECODE_BITS); bitcopy(part->decoded, part->n_decoded, tmp_bits, 0, GPS_L2C_V27_DECODE_BITS);
@ -238,10 +238,9 @@ 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);
u32 crc2 = _cnav_extract_crc(part); u32 crc2 = _cnav_extract_crc(part);
if (part->message_lock) if (part->message_lock)
@ -260,8 +259,8 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
if (part->n_crc_fail > GPS_CNAV_LOCK_MAX_CRC_FAILS) if (part->n_crc_fail > GPS_CNAV_LOCK_MAX_CRC_FAILS)
{ {
/* CRC has failed too many times - drop the lock. */ /* CRC has failed too many times - drop the lock. */
part->n_crc_fail = 0; part->n_crc_fail = 0;
part->message_lock = false; part->message_lock = false;
part->preamble_seen = false; part->preamble_seen = false;
/* Try to find a new preamble, reuse data from buffer. */ /* Try to find a new preamble, reuse data from buffer. */
retry = true; retry = true;
@ -272,8 +271,8 @@ static void _cnav_add_symbol(cnav_v27_part_t *part, u8 ch)
{ {
/* CRC match - message can be decoded */ /* CRC match - message can be decoded */
part->message_lock = true; part->message_lock = true;
part->crc_ok = true; part->crc_ok = true;
part->n_crc_fail = 0; part->n_crc_fail = 0;
} }
else else
{ {
@ -346,13 +345,13 @@ static bool _cnav_msg_decode(cnav_v27_part_t *part, cnav_msg_t *msg, u32 *delay)
_cnav_msg_invert(part); _cnav_msg_invert(part);
} }
msg->prn = getbitu(part->decoded, 8, 6); msg->prn = getbitu(part->decoded, 8, 6);
msg->msg_id = getbitu(part->decoded, 14, 6); msg->msg_id = getbitu(part->decoded, 14, 6);
msg->tow = getbitu(part->decoded, 20, 17); msg->tow = getbitu(part->decoded, 20, 17);
msg->alert = getbitu(part->decoded, 37, 1) ? true : false; msg->alert = getbitu(part->decoded, 37, 1) ? true : false;
/* copy RAW message for GNSS-SDR */ /* copy RAW message for GNSS-SDR */
memcpy(msg->raw_msg,part->decoded,GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS); memcpy(msg->raw_msg, part->decoded, GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS);
*delay = (part->n_decoded - GPS_CNAV_MSG_LENGTH + GPS_L2C_V27_DELAY_BITS) * 2 + part->n_symbols; *delay = (part->n_decoded - GPS_CNAV_MSG_LENGTH + GPS_L2C_V27_DELAY_BITS) * 2 + part->n_symbols;
@ -388,15 +387,15 @@ void cnav_msg_decoder_init(cnav_msg_decoder_t *dec)
{ {
memset(dec, 0, sizeof(*dec)); memset(dec, 0, sizeof(*dec));
v27_init(&dec->part1.dec, v27_init(&dec->part1.dec,
dec->part1.decisions, dec->part1.decisions,
GPS_L2_V27_HISTORY_LENGTH_BITS, GPS_L2_V27_HISTORY_LENGTH_BITS,
cnav_msg_decoder_get_poly(), cnav_msg_decoder_get_poly(),
0); 0);
v27_init(&dec->part2.dec, v27_init(&dec->part2.dec,
dec->part2.decisions, dec->part2.decisions,
GPS_L2_V27_HISTORY_LENGTH_BITS, GPS_L2_V27_HISTORY_LENGTH_BITS,
cnav_msg_decoder_get_poly(), cnav_msg_decoder_get_poly(),
0); 0);
dec->part1.init = true; dec->part1.init = true;
dec->part2.init = true; dec->part2.init = true;
_cnav_add_symbol(&dec->part2, 0x80); _cnav_add_symbol(&dec->part2, 0x80);
@ -426,9 +425,9 @@ void cnav_msg_decoder_init(cnav_msg_decoder_t *dec)
* \retval false More data is required. * \retval false More data is required.
*/ */
bool cnav_msg_decoder_add_symbol(cnav_msg_decoder_t *dec, bool cnav_msg_decoder_add_symbol(cnav_msg_decoder_t *dec,
u8 symbol, u8 symbol,
cnav_msg_t *msg, cnav_msg_t *msg,
u32 *pdelay) u32 *pdelay)
{ {
_cnav_add_symbol(&dec->part1, symbol); _cnav_add_symbol(&dec->part1, symbol);
_cnav_add_symbol(&dec->part2, symbol); _cnav_add_symbol(&dec->part2, symbol);
@ -470,7 +469,7 @@ const v27_poly_t *cnav_msg_decoder_get_poly(void)
if (!initialized) if (!initialized)
{ {
/* Coefficients for polynomial object */ /* Coefficients for polynomial object */
const signed char coeffs[2] = { GPS_L2C_V27_POLY_A, GPS_L2C_V27_POLY_B }; const signed char coeffs[2] = {GPS_L2C_V27_POLY_A, GPS_L2C_V27_POLY_B};
/* Racing condition handling: the data can be potential initialized more /* Racing condition handling: the data can be potential initialized more
* than once in case multiple threads request concurrent access. However, * than once in case multiple threads request concurrent access. However,

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,11 +7,12 @@
#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 */ {
size_t unclaimed; asn_per_data_t oldpd; /* Old per data source */
size_t ot_moved; /* Number of bits moved by OT processing */ size_t unclaimed;
int repeat; size_t ot_moved; /* Number of bits moved by OT processing */
int repeat;
} uper_ugot_key; } uper_ugot_key;
static int uper_ugot_refill(asn_per_data_t *pd); static int uper_ugot_refill(asn_per_data_t *pd);
@ -24,243 +25,272 @@ 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;
size_t toGo; size_t toGo;
ASN_DEBUG("Open type put %s ...", td->name); ASN_DEBUG("Open type put %s ...", td->name);
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); {
if(maySave < 0) break; ssize_t maySave = uper_put_length(po, toGo);
if(per_put_many_bits(po, bptr, maySave * 8)) break; if (maySave < 0) break;
bptr = (char *)bptr + maySave; if (per_put_many_bits(po, bptr, maySave * 8)) break;
toGo -= maySave; bptr = (char *)bptr + maySave;
} toGo -= maySave;
}
FREEMEM(buf); FREEMEM(buf);
if(toGo) return -1; if (toGo) return -1;
ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)",
td->name, size); td->name, size);
return 0; return 0;
} }
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; {
ssize_t chunk_bytes; asn_dec_rval_t rv;
int repeat; ssize_t chunk_bytes;
uint8_t *buf = 0; int repeat;
size_t bufLen = 0; uint8_t *buf = 0;
size_t bufSize = 0; size_t bufLen = 0;
asn_per_data_t spd; size_t bufSize = 0;
size_t padding; asn_per_data_t spd;
size_t padding;
_ASN_STACK_OVERFLOW_CHECK(ctx); _ASN_STACK_OVERFLOW_CHECK(ctx);
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); {
if(chunk_bytes < 0) { chunk_bytes = uper_get_length(pd, -1, &repeat);
FREEMEM(buf); if (chunk_bytes < 0)
_ASN_DECODE_STARVED; {
} FREEMEM(buf);
if(bufLen + chunk_bytes > bufSize) { _ASN_DECODE_STARVED;
void *ptr; }
bufSize = chunk_bytes + (bufSize << 2); if (bufLen + chunk_bytes > bufSize)
ptr = REALLOC(buf, bufSize); {
if(!ptr) { void *ptr;
FREEMEM(buf); bufSize = chunk_bytes + (bufSize << 2);
_ASN_DECODE_FAILED; ptr = REALLOC(buf, bufSize);
} if (!ptr)
buf = ptr; {
} FREEMEM(buf);
if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { _ASN_DECODE_FAILED;
FREEMEM(buf); }
_ASN_DECODE_STARVED; buf = ptr;
} }
bufLen += chunk_bytes; if (per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3))
} while(repeat); {
FREEMEM(buf);
_ASN_DECODE_STARVED;
}
bufLen += chunk_bytes;
}
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);
memset(&spd, 0, sizeof(spd)); memset(&spd, 0, sizeof(spd));
spd.buffer = buf; spd.buffer = buf;
spd.nbits = bufLen << 3; spd.nbits = bufLen << 3;
asn_debug_indent += 4; asn_debug_indent += 4;
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 */ {
padding = spd.nbits - spd.nboff; /* Check padding validity */
if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { padding = spd.nbits - spd.nboff;
/* Everything is cool */ if (padding < 8 && per_get_few_bits(&spd, padding) == 0)
FREEMEM(buf); {
return rv; /* Everything is cool */
} FREEMEM(buf);
FREEMEM(buf); return rv;
if(padding >= 8) { }
ASN_DEBUG("Too large padding %d in open type", padding); FREEMEM(buf);
_ASN_DECODE_FAILED; if (padding >= 8)
} else { {
ASN_DEBUG("Non-zero padding"); ASN_DEBUG("Too large padding %d in open type", padding);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} else { else
FREEMEM(buf); {
/* rv.code could be RC_WMORE, nonsense in this context */ ASN_DEBUG("Non-zero padding");
rv.code = RC_FAIL; /* Noone would give us more */ _ASN_DECODE_FAILED;
} }
}
else
{
FREEMEM(buf);
/* rv.code could be RC_WMORE, nonsense in this context */
rv.code = RC_FAIL; /* Noone would give us more */
}
return rv; return rv;
} }
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; {
asn_dec_rval_t rv; uper_ugot_key arg;
ssize_t padding; asn_dec_rval_t rv;
ssize_t padding;
_ASN_STACK_OVERFLOW_CHECK(ctx); _ASN_STACK_OVERFLOW_CHECK(ctx);
ASN_DEBUG("Getting open type %s from %s", td->name, ASN_DEBUG("Getting open type %s from %s", td->name,
per_data_string(pd)); per_data_string(pd));
arg.oldpd = *pd; arg.oldpd = *pd;
arg.unclaimed = 0; arg.unclaimed = 0;
arg.ot_moved = 0; arg.ot_moved = 0;
arg.repeat = 1; arg.repeat = 1;
pd->refill = uper_ugot_refill; pd->refill = uper_ugot_refill;
pd->refill_key = &arg; pd->refill_key = &arg;
pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */
pd->moved = 0; /* This now counts the open type size in bits */ pd->moved = 0; /* This now counts the open type size in bits */
asn_debug_indent += 4; asn_debug_indent += 4;
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 \
/* buffer and nboff are valid, preserve them. */ \ do \
pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ { \
pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ /* buffer and nboff are valid, preserve them. */ \
pd->refill = arg.oldpd.refill; \ pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \
pd->refill_key = arg.oldpd.refill_key; \ pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \
} while(0) pd->refill = arg.oldpd.refill; \
pd->refill_key = arg.oldpd.refill_key; \
} \
while (0)
if(rv.code != RC_OK) { if (rv.code != RC_OK)
UPDRESTOREPD; {
return rv; UPDRESTOREPD;
} 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; {
if(padding > 7) { int32_t pvalue;
ASN_DEBUG("Too large padding %d in open type", if (padding > 7)
padding); {
rv.code = RC_FAIL; ASN_DEBUG("Too large padding %d in open type",
UPDRESTOREPD; padding);
return rv; rv.code = RC_FAIL;
} UPDRESTOREPD;
padding = 8 - padding; return rv;
ASN_DEBUG("Getting padding of %d bits", padding); }
pvalue = per_get_few_bits(pd, padding); padding = 8 - padding;
switch(pvalue) { ASN_DEBUG("Getting padding of %d bits", padding);
case -1: pvalue = per_get_few_bits(pd, padding);
ASN_DEBUG("Padding skip failed"); switch (pvalue)
UPDRESTOREPD; {
_ASN_DECODE_STARVED; case -1:
case 0: break; ASN_DEBUG("Padding skip failed");
default: UPDRESTOREPD;
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", _ASN_DECODE_STARVED;
padding, (int)pvalue); case 0:
UPDRESTOREPD; break;
_ASN_DECODE_FAILED; default:
} ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
} padding, (int)pvalue);
if(pd->nboff != pd->nbits) { UPDRESTOREPD;
ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, _ASN_DECODE_FAILED;
per_data_string(pd), per_data_string(&arg.oldpd)); }
if(1) { }
UPDRESTOREPD; if (pd->nboff != pd->nbits)
_ASN_DECODE_FAILED; {
} else { ASN_DEBUG("Open type %s overhead pd%s old%s", td->name,
arg.unclaimed += pd->nbits - pd->nboff; per_data_string(pd), per_data_string(&arg.oldpd));
} if (1)
} {
UPDRESTOREPD;
_ASN_DECODE_FAILED;
}
else
{
arg.unclaimed += pd->nbits - pd->nboff;
}
}
/* Adjust pd back so it points to original data */ /* Adjust pd back so it points to original data */
UPDRESTOREPD; UPDRESTOREPD;
/* 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)) { {
case -1: switch (per_skip_bits(pd, arg.unclaimed))
ASN_DEBUG("Claim of %d failed", arg.unclaimed); {
_ASN_DECODE_STARVED; case -1:
case 0: ASN_DEBUG("Claim of %d failed", arg.unclaimed);
ASN_DEBUG("Got claim of %d", arg.unclaimed); _ASN_DECODE_STARVED;
break; case 0:
default: ASN_DEBUG("Got claim of %d", arg.unclaimed);
/* Padding must be blank */ break;
ASN_DEBUG("Non-blank unconsumed padding"); default:
_ASN_DECODE_FAILED; /* Padding must be blank */
} ASN_DEBUG("Non-blank unconsumed padding");
arg.unclaimed = 0; _ASN_DECODE_FAILED;
} }
arg.unclaimed = 0;
}
if(arg.repeat) { if (arg.repeat)
ASN_DEBUG("Not consumed the whole thing"); {
rv.code = RC_FAIL; ASN_DEBUG("Not consumed the whole thing");
return rv; rv.code = RC_FAIL;
} return rv;
}
return rv; return rv;
} }
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;
s_td.name = "<unknown extension>"; s_td.name = "<unknown extension>";
s_td.uper_decoder = uper_sot_suck; s_td.uper_decoder = uper_sot_suck;
rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); rv = uper_open_type_get(ctx, &s_td, 0, 0, pd);
if(rv.code != RC_OK) if (rv.code != RC_OK)
return -1; return -1;
else else
return 0; return 0;
} }
/* /*
@ -269,105 +299,122 @@ 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;
(void)td; (void)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;
return rv; return rv;
} }
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; {
ssize_t next_chunk_bytes, next_chunk_bits; uper_ugot_key *arg = pd->refill_key;
ssize_t avail; ssize_t next_chunk_bytes, next_chunk_bits;
ssize_t avail;
asn_per_data_t *oldpd = &arg->oldpd; asn_per_data_t *oldpd = &arg->oldpd;
ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d",
pd->moved, oldpd->moved); pd->moved, oldpd->moved);
/* Advance our position to where pd is */ /* Advance our position to where pd is */
oldpd->buffer = pd->buffer; oldpd->buffer = pd->buffer;
oldpd->nboff = pd->nboff; oldpd->nboff = pd->nboff;
oldpd->nbits -= pd->moved - arg->ot_moved; oldpd->nbits -= pd->moved - arg->ot_moved;
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 */ {
if(per_get_few_bits(oldpd, 1)) /* Refill the container */
return -1; if (per_get_few_bits(oldpd, 1))
if(oldpd->nboff == 0) { return -1;
assert(0); if (oldpd->nboff == 0)
return -1; {
} assert(0);
pd->buffer = oldpd->buffer; return -1;
pd->nboff = oldpd->nboff - 1; }
pd->nbits = oldpd->nbits; pd->buffer = oldpd->buffer;
ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved); pd->nboff = oldpd->nboff - 1;
return 0; pd->nbits = oldpd->nbits;
} ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved);
return 0;
}
if(!arg->repeat) { if (!arg->repeat)
ASN_DEBUG("Want more but refill doesn't have it"); {
return -1; ASN_DEBUG("Want more but refill doesn't have it");
} return -1;
}
next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat);
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 */ {
assert(!arg->repeat); /* Implementation guarantee */ pd->refill = 0; /* No more refills, naturally */
} assert(!arg->repeat); /* Implementation guarantee */
next_chunk_bits = next_chunk_bytes << 3; }
avail = oldpd->nbits - oldpd->nboff; next_chunk_bits = next_chunk_bytes << 3;
if(avail >= next_chunk_bits) { avail = oldpd->nbits - oldpd->nboff;
pd->nbits = oldpd->nboff + next_chunk_bits; if (avail >= next_chunk_bits)
arg->unclaimed = 0; {
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", pd->nbits = oldpd->nboff + next_chunk_bits;
next_chunk_bits, oldpd->moved, arg->unclaimed = 0;
oldpd->nboff, oldpd->nbits, ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)",
oldpd->nbits - oldpd->nboff); next_chunk_bits, oldpd->moved,
} else { oldpd->nboff, oldpd->nbits,
pd->nbits = oldpd->nbits; oldpd->nbits - oldpd->nboff);
arg->unclaimed = next_chunk_bits - avail; }
ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); else
} {
pd->buffer = oldpd->buffer; pd->nbits = oldpd->nbits;
pd->nboff = oldpd->nboff; arg->unclaimed = next_chunk_bits - avail;
ASN_DEBUG("Refilled pd%s old%s", ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed);
per_data_string(pd), per_data_string(oldpd)); }
return 0; pd->buffer = oldpd->buffer;
pd->nboff = oldpd->nboff;
ASN_DEBUG("Refilled pd%s old%s",
per_data_string(pd), per_data_string(oldpd));
return 0;
} }
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; {
while(skip_nbits > 0) { int hasNonZeroBits = 0;
int skip; while (skip_nbits > 0)
if(skip_nbits < skip) {
skip = skip_nbits; int skip = 0;
else if (skip_nbits < skip)
skip = 24; skip = skip_nbits;
skip_nbits -= skip; else
skip = 24;
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 */
return hasNonZeroBits; default:
hasNonZeroBits = 1;
continue;
}
}
return hasNonZeroBits;
} }

View File

@ -8,318 +8,356 @@
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 1)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 1)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 9)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 9)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 16)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 16)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 8)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 8)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 8)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 8)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 8)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 8)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = { static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, {APC_CONSTRAINED, 0, 0, 1, 1} /* (SIZE(1..1)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = { static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = { static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = { static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_horuncertspeed_constr_6 = { static asn_per_constraints_t asn_PER_memb_horuncertspeed_constr_6 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_veruncertspeed_constr_7 = { static asn_per_constraints_t asn_PER_memb_veruncertspeed_constr_7 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = { static asn_TYPE_member_t asn_MBR_Horandveruncert_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verdirect), {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verdirect),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_BIT_STRING, &asn_DEF_BIT_STRING,
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 */ &asn_DEF_BIT_STRING,
&asn_DEF_BIT_STRING, 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),
}, (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
{ ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horspeed), -1, /* IMPLICIT tag at current level */
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), &asn_DEF_BIT_STRING,
-1, /* IMPLICIT tag at current level */ memb_horspeed_constraint_1,
&asn_DEF_BIT_STRING, &asn_PER_memb_horspeed_constr_4,
memb_horspeed_constraint_1, 0,
&asn_PER_memb_horspeed_constr_4, "horspeed"},
0, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed),
"horspeed" (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
}, -1, /* IMPLICIT tag at current level */
{ ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, verspeed), &asn_DEF_BIT_STRING,
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), memb_verspeed_constraint_1,
-1, /* IMPLICIT tag at current level */ &asn_PER_memb_verspeed_constr_5,
&asn_DEF_BIT_STRING, 0,
memb_verspeed_constraint_1, "verspeed"},
&asn_PER_memb_verspeed_constr_5, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed),
0, (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
"verspeed" -1, /* IMPLICIT tag at current level */
}, &asn_DEF_BIT_STRING,
{ ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, horuncertspeed), memb_horuncertspeed_constraint_1,
(ASN_TAG_CLASS_CONTEXT | (4 << 2)), &asn_PER_memb_horuncertspeed_constr_6,
-1, /* IMPLICIT tag at current level */ 0,
&asn_DEF_BIT_STRING, "horuncertspeed"},
memb_horuncertspeed_constraint_1, {ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed),
&asn_PER_memb_horuncertspeed_constr_6, (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
0, -1, /* IMPLICIT tag at current level */
"horuncertspeed" &asn_DEF_BIT_STRING,
}, memb_veruncertspeed_constraint_1,
{ ATF_NOFLAGS, 0, offsetof(struct Horandveruncert, veruncertspeed), &asn_PER_memb_veruncertspeed_constr_7,
(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0,
-1, /* IMPLICIT tag at current level */ "veruncertspeed"},
&asn_DEF_BIT_STRING,
memb_veruncertspeed_constraint_1,
&asn_PER_memb_veruncertspeed_constr_7,
0,
"veruncertspeed"
},
}; };
static ber_tlv_tag_t asn_DEF_Horandveruncert_tags_1[] = { 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 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horspeed at 253 */ {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* horspeed at 253 */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* verspeed at 254 */ {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* verspeed at 254 */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* horuncertspeed at 255 */ {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* horuncertspeed at 255 */
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* veruncertspeed at 256 */ {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* veruncertspeed at 256 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_Horandveruncert_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_Horandveruncert_specs_1 = {
sizeof(struct Horandveruncert), sizeof(struct Horandveruncert),
offsetof(struct Horandveruncert, _asn_ctx), offsetof(struct Horandveruncert, _asn_ctx),
asn_MAP_Horandveruncert_tag2el_1, asn_MAP_Horandveruncert_tag2el_1,
6, /* Count of tags in the map */ 6, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
5, /* Start extensions */ 5, /* Start extensions */
7 /* Stop extensions */ 7 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Horandveruncert = { asn_TYPE_descriptor_t asn_DEF_Horandveruncert = {
"Horandveruncert", "Horandveruncert",
"Horandveruncert", "Horandveruncert",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_Horandveruncert_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_Horandveruncert_tags_1[0]), /* 1 */ asn_MBR_Horandveruncert_1,
0, /* No PER visible constraints */ 6, /* Elements count */
asn_MBR_Horandveruncert_1, &asn_SPC_Horandveruncert_specs_1 /* Additional specs */
6, /* Elements count */
&asn_SPC_Horandveruncert_specs_1 /* Additional specs */
}; };

View File

@ -8,226 +8,250 @@
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 1)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 1)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 9)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 9)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 16)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 16)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 8)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 8)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = { static asn_per_constraints_t asn_PER_memb_verdirect_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */, {APC_CONSTRAINED, 0, 0, 1, 1} /* (SIZE(1..1)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = { static asn_per_constraints_t asn_PER_memb_bearing_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = { static asn_per_constraints_t asn_PER_memb_horspeed_constr_4 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = { static asn_per_constraints_t asn_PER_memb_verspeed_constr_5 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = { static asn_TYPE_member_t asn_MBR_Horandvervel_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verdirect), {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verdirect),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_BIT_STRING, &asn_DEF_BIT_STRING,
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 */ &asn_DEF_BIT_STRING,
&asn_DEF_BIT_STRING, 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),
}, (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
{ ATF_NOFLAGS, 0, offsetof(struct Horandvervel, horspeed), -1, /* IMPLICIT tag at current level */
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), &asn_DEF_BIT_STRING,
-1, /* IMPLICIT tag at current level */ memb_horspeed_constraint_1,
&asn_DEF_BIT_STRING, &asn_PER_memb_horspeed_constr_4,
memb_horspeed_constraint_1, 0,
&asn_PER_memb_horspeed_constr_4, "horspeed"},
0, {ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed),
"horspeed" (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
}, -1, /* IMPLICIT tag at current level */
{ ATF_NOFLAGS, 0, offsetof(struct Horandvervel, verspeed), &asn_DEF_BIT_STRING,
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), memb_verspeed_constraint_1,
-1, /* IMPLICIT tag at current level */ &asn_PER_memb_verspeed_constr_5,
&asn_DEF_BIT_STRING, 0,
memb_verspeed_constraint_1, "verspeed"},
&asn_PER_memb_verspeed_constr_5,
0,
"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 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* horspeed at 240 */ {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* horspeed at 240 */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* verspeed at 241 */ {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0} /* verspeed at 241 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_Horandvervel_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_Horandvervel_specs_1 = {
sizeof(struct Horandvervel), sizeof(struct Horandvervel),
offsetof(struct Horandvervel, _asn_ctx), offsetof(struct Horandvervel, _asn_ctx),
asn_MAP_Horandvervel_tag2el_1, asn_MAP_Horandvervel_tag2el_1,
4, /* Count of tags in the map */ 4, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
3, /* Start extensions */ 3, /* Start extensions */
5 /* Stop extensions */ 5 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Horandvervel = { asn_TYPE_descriptor_t asn_DEF_Horandvervel = {
"Horandvervel", "Horandvervel",
"Horandvervel", "Horandvervel",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_Horandvervel_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_Horandvervel_tags_1[0]), /* 1 */ asn_MBR_Horandvervel_1,
0, /* No PER visible constraints */ 4, /* Elements count */
asn_MBR_Horandvervel_1, &asn_SPC_Horandvervel_specs_1 /* Additional specs */
4, /* Elements count */
&asn_SPC_Horandvervel_specs_1 /* Additional specs */
}; };

View File

@ -8,134 +8,144 @@
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 9)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 9)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 16)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 16)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = { static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = { static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_Horvel_1[] = { static asn_TYPE_member_t asn_MBR_Horvel_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Horvel, bearing), {ATF_NOFLAGS, 0, offsetof(struct Horvel, bearing),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_BIT_STRING, &asn_DEF_BIT_STRING,
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 */ &asn_DEF_BIT_STRING,
&asn_DEF_BIT_STRING, 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 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_Horvel_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_Horvel_specs_1 = {
sizeof(struct Horvel), sizeof(struct Horvel),
offsetof(struct Horvel, _asn_ctx), offsetof(struct Horvel, _asn_ctx),
asn_MAP_Horvel_tag2el_1, asn_MAP_Horvel_tag2el_1,
2, /* Count of tags in the map */ 2, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
1, /* Start extensions */ 1, /* Start extensions */
3 /* Stop extensions */ 3 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Horvel = { asn_TYPE_descriptor_t asn_DEF_Horvel = {
"Horvel", "Horvel",
"Horvel", "Horvel",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_Horvel_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_Horvel_tags_1[0]), /* 1 */ asn_MBR_Horvel_1,
0, /* No PER visible constraints */ 2, /* Elements count */
asn_MBR_Horvel_1, &asn_SPC_Horvel_specs_1 /* Additional specs */
2, /* Elements count */
&asn_SPC_Horvel_specs_1 /* Additional specs */
}; };

View File

@ -8,180 +8,197 @@
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 9)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 9)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 16)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 16)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 8)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 8)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = { static asn_per_constraints_t asn_PER_memb_bearing_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 9, 9 } /* (SIZE(9..9)) */, {APC_CONSTRAINED, 0, 0, 9, 9} /* (SIZE(9..9)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = { static asn_per_constraints_t asn_PER_memb_horspeed_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_uncertspeed_constr_4 = { static asn_per_constraints_t asn_PER_memb_uncertspeed_constr_4 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = { static asn_TYPE_member_t asn_MBR_Horveluncert_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Horveluncert, bearing), {ATF_NOFLAGS, 0, offsetof(struct Horveluncert, bearing),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_BIT_STRING, &asn_DEF_BIT_STRING,
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 */ &asn_DEF_BIT_STRING,
&asn_DEF_BIT_STRING, 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),
}, (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
{ ATF_NOFLAGS, 0, offsetof(struct Horveluncert, uncertspeed), -1, /* IMPLICIT tag at current level */
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), &asn_DEF_BIT_STRING,
-1, /* IMPLICIT tag at current level */ memb_uncertspeed_constraint_1,
&asn_DEF_BIT_STRING, &asn_PER_memb_uncertspeed_constr_4,
memb_uncertspeed_constraint_1, 0,
&asn_PER_memb_uncertspeed_constr_4, "uncertspeed"},
0,
"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 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* uncertspeed at 247 */ {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0} /* uncertspeed at 247 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_Horveluncert_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_Horveluncert_specs_1 = {
sizeof(struct Horveluncert), sizeof(struct Horveluncert),
offsetof(struct Horveluncert, _asn_ctx), offsetof(struct Horveluncert, _asn_ctx),
asn_MAP_Horveluncert_tag2el_1, asn_MAP_Horveluncert_tag2el_1,
3, /* Count of tags in the map */ 3, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
2, /* Start extensions */ 2, /* Start extensions */
4 /* Stop extensions */ 4 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_Horveluncert = { asn_TYPE_descriptor_t asn_DEF_Horveluncert = {
"Horveluncert", "Horveluncert",
"Horveluncert", "Horveluncert",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_Horveluncert_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_Horveluncert_tags_1[0]), /* 1 */ asn_MBR_Horveluncert_1,
0, /* No PER visible constraints */ 3, /* Elements count */
asn_MBR_Horveluncert_1, &asn_SPC_Horveluncert_specs_1 /* Additional specs */
3, /* Elements count */
&asn_SPC_Horveluncert_specs_1 /* Additional specs */
}; };

View File

@ -8,125 +8,132 @@
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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 4)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 4)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 16)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 16)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_ipv4Address_constr_2 = { static asn_per_constraints_t asn_PER_memb_ipv4Address_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, {APC_CONSTRAINED, 0, 0, 4, 4} /* (SIZE(4..4)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_ipv6Address_constr_3 = { static asn_per_constraints_t asn_PER_memb_ipv6Address_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 16, 16 } /* (SIZE(16..16)) */, {APC_CONSTRAINED, 0, 0, 16, 16} /* (SIZE(16..16)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_type_IPAddress_constr_1 = { static asn_per_constraints_t asn_PER_type_IPAddress_constr_1 = {
{ APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, {APC_CONSTRAINED, 1, 1, 0, 1} /* (0..1) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_IPAddress_1[] = { static asn_TYPE_member_t asn_MBR_IPAddress_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv4Address), {ATF_NOFLAGS, 0, offsetof(struct IPAddress, choice.ipv4Address),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_OCTET_STRING, &asn_DEF_OCTET_STRING,
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 */ &asn_DEF_OCTET_STRING,
&asn_DEF_OCTET_STRING, 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 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ipv6Address at 42 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* ipv6Address at 42 */
}; };
static asn_CHOICE_specifics_t asn_SPC_IPAddress_specs_1 = { static asn_CHOICE_specifics_t asn_SPC_IPAddress_specs_1 = {
sizeof(struct IPAddress), sizeof(struct IPAddress),
offsetof(struct IPAddress, _asn_ctx), offsetof(struct IPAddress, _asn_ctx),
offsetof(struct IPAddress, present), offsetof(struct IPAddress, present),
sizeof(((struct IPAddress *)0)->present), sizeof(((struct IPAddress *)0)->present),
asn_MAP_IPAddress_tag2el_1, asn_MAP_IPAddress_tag2el_1,
2, /* Count of tags in the map */ 2, /* Count of tags in the map */
0, 0,
-1 /* Extensions start */ -1 /* Extensions start */
}; };
asn_TYPE_descriptor_t asn_DEF_IPAddress = { asn_TYPE_descriptor_t asn_DEF_IPAddress = {
"IPAddress", "IPAddress",
"IPAddress", "IPAddress",
CHOICE_free, CHOICE_free,
CHOICE_print, CHOICE_print,
CHOICE_constraint, CHOICE_constraint,
CHOICE_decode_ber, CHOICE_decode_ber,
CHOICE_encode_der, CHOICE_encode_der,
CHOICE_decode_xer, CHOICE_decode_xer,
CHOICE_encode_xer, CHOICE_encode_xer,
CHOICE_decode_uper, CHOICE_decode_uper,
CHOICE_encode_uper, CHOICE_encode_uper,
CHOICE_outmost_tag, CHOICE_outmost_tag,
0, /* No effective tags (pointer) */ 0, /* No effective tags (pointer) */
0, /* No effective tags (count) */ 0, /* No effective tags (count) */
0, /* No tags (pointer) */ 0, /* No tags (pointer) */
0, /* No tags (count) */ 0, /* No tags (count) */
&asn_PER_type_IPAddress_constr_1, &asn_PER_type_IPAddress_constr_1,
asn_MBR_IPAddress_1, asn_MBR_IPAddress_1,
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_IPAddress_specs_1 /* Additional specs */ &asn_SPC_IPAddress_specs_1 /* Additional specs */
}; };

View File

@ -6,35 +6,42 @@
#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, {
"%s: value not given (%s:%d)", _ASN_CTFAIL(app_key, td, sptr,
td->name, __FILE__, __LINE__); "%s: value not given (%s:%d)",
return -1; td->name, __FILE__, __LINE__);
} return -1;
}
if(st->size > 0) {
/* Size in bits */ if (st->size > 0)
size = 8 * st->size - (st->bits_unused & 0x07); {
} else { /* Size in bits */
size = 0; size = 8 * st->size - (st->bits_unused & 0x07);
} }
else
if((size == 128)) { {
/* Constraint check succeeded */ size = 0;
return 0; }
} else {
_ASN_CTFAIL(app_key, td, sptr, if (size == 128)
"%s: constraint failed (%s:%d)", {
td->name, __FILE__, __LINE__); /* Constraint check succeeded */
return -1; return 0;
} }
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
/* /*
@ -42,110 +49,113 @@ 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->print_struct = asn_DEF_BIT_STRING.print_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder;
td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder;
td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder;
td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder;
if(!td->per_constraints) td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder;
td->per_constraints = asn_DEF_BIT_STRING.per_constraints; if (!td->per_constraints)
td->elements = asn_DEF_BIT_STRING.elements; td->per_constraints = asn_DEF_BIT_STRING.per_constraints;
td->elements_count = asn_DEF_BIT_STRING.elements_count; td->elements = asn_DEF_BIT_STRING.elements;
td->specifics = asn_DEF_BIT_STRING.specifics; td->elements_count = asn_DEF_BIT_STRING.elements_count;
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); {
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
} }
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); {
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); KeyIdentity_1_inherit_TYPE_descriptor(td);
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); {
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
} }
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); {
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); KeyIdentity_1_inherit_TYPE_descriptor(td);
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); {
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
} }
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); {
return td->uper_encoder(td, constraints, structure, per_out); KeyIdentity_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
} }
static asn_per_constraints_t asn_PER_type_KeyIdentity_constr_1 = { static asn_per_constraints_t asn_PER_type_KeyIdentity_constr_1 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_KeyIdentity_tags_1[] = { 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",
KeyIdentity_free, KeyIdentity_free,
KeyIdentity_print, KeyIdentity_print,
KeyIdentity_constraint, KeyIdentity_constraint,
KeyIdentity_decode_ber, KeyIdentity_decode_ber,
KeyIdentity_encode_der, KeyIdentity_encode_der,
KeyIdentity_decode_xer, KeyIdentity_decode_xer,
KeyIdentity_encode_xer, KeyIdentity_encode_xer,
KeyIdentity_decode_uper, KeyIdentity_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_KeyIdentity_tags_1) &asn_PER_type_KeyIdentity_constr_1,
/sizeof(asn_DEF_KeyIdentity_tags_1[0]), /* 1 */ 0, 0, /* No members */
&asn_PER_type_KeyIdentity_constr_1, 0 /* No specifics */
0, 0, /* No members */
0 /* No specifics */
}; };

View File

@ -6,35 +6,42 @@
#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, {
"%s: value not given (%s:%d)", _ASN_CTFAIL(app_key, td, sptr,
td->name, __FILE__, __LINE__); "%s: value not given (%s:%d)",
return -1; td->name, __FILE__, __LINE__);
} return -1;
}
if(st->size > 0) {
/* Size in bits */ if (st->size > 0)
size = 8 * st->size - (st->bits_unused & 0x07); {
} else { /* Size in bits */
size = 0; size = 8 * st->size - (st->bits_unused & 0x07);
} }
else
if((size == 128)) { {
/* Constraint check succeeded */ size = 0;
return 0; }
} else {
_ASN_CTFAIL(app_key, td, sptr, if (size == 128)
"%s: constraint failed (%s:%d)", {
td->name, __FILE__, __LINE__); /* Constraint check succeeded */
return -1; return 0;
} }
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
/* /*
@ -42,110 +49,113 @@ 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->print_struct = asn_DEF_BIT_STRING.print_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder;
td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder;
td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder;
td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder;
if(!td->per_constraints) td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder;
td->per_constraints = asn_DEF_BIT_STRING.per_constraints; if (!td->per_constraints)
td->elements = asn_DEF_BIT_STRING.elements; td->per_constraints = asn_DEF_BIT_STRING.per_constraints;
td->elements_count = asn_DEF_BIT_STRING.elements_count; td->elements = asn_DEF_BIT_STRING.elements;
td->specifics = asn_DEF_BIT_STRING.specifics; td->elements_count = asn_DEF_BIT_STRING.elements_count;
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); {
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
} }
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); {
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); KeyIdentity4_1_inherit_TYPE_descriptor(td);
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); {
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
} }
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); {
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); KeyIdentity4_1_inherit_TYPE_descriptor(td);
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); {
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
} }
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); {
return td->uper_encoder(td, constraints, structure, per_out); KeyIdentity4_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
} }
static asn_per_constraints_t asn_PER_type_KeyIdentity4_constr_1 = { static asn_per_constraints_t asn_PER_type_KeyIdentity4_constr_1 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_KeyIdentity4_tags_1[] = { 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",
KeyIdentity4_free, KeyIdentity4_free,
KeyIdentity4_print, KeyIdentity4_print,
KeyIdentity4_constraint, KeyIdentity4_constraint,
KeyIdentity4_decode_ber, KeyIdentity4_decode_ber,
KeyIdentity4_encode_der, KeyIdentity4_encode_der,
KeyIdentity4_decode_xer, KeyIdentity4_decode_xer,
KeyIdentity4_encode_xer, KeyIdentity4_encode_xer,
KeyIdentity4_decode_uper, KeyIdentity4_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_KeyIdentity4_tags_1) &asn_PER_type_KeyIdentity4_constr_1,
/sizeof(asn_DEF_KeyIdentity4_tags_1[0]), /* 1 */ 0, 0, /* No members */
&asn_PER_type_KeyIdentity4_constr_1, 0 /* No specifics */
0, 0, /* No members */
0 /* No specifics */
}; };

View File

@ -6,35 +6,42 @@
#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, {
"%s: value not given (%s:%d)", _ASN_CTFAIL(app_key, td, sptr,
td->name, __FILE__, __LINE__); "%s: value not given (%s:%d)",
return -1; td->name, __FILE__, __LINE__);
} return -1;
}
if(st->size > 0) {
/* Size in bits */ if (st->size > 0)
size = 8 * st->size - (st->bits_unused & 0x07); {
} else { /* Size in bits */
size = 0; size = 8 * st->size - (st->bits_unused & 0x07);
} }
else
if((size == 64)) { {
/* Constraint check succeeded */ size = 0;
return 0; }
} else {
_ASN_CTFAIL(app_key, td, sptr, if (size == 64)
"%s: constraint failed (%s:%d)", {
td->name, __FILE__, __LINE__); /* Constraint check succeeded */
return -1; return 0;
} }
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
/* /*
@ -42,110 +49,113 @@ 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->print_struct = asn_DEF_BIT_STRING.print_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder;
td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder;
td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder;
td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder;
if(!td->per_constraints) td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder;
td->per_constraints = asn_DEF_BIT_STRING.per_constraints; if (!td->per_constraints)
td->elements = asn_DEF_BIT_STRING.elements; td->per_constraints = asn_DEF_BIT_STRING.per_constraints;
td->elements_count = asn_DEF_BIT_STRING.elements_count; td->elements = asn_DEF_BIT_STRING.elements;
td->specifics = asn_DEF_BIT_STRING.specifics; td->elements_count = asn_DEF_BIT_STRING.elements_count;
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); {
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); MAC_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
} }
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); {
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); MAC_1_inherit_TYPE_descriptor(td);
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); {
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); MAC_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
} }
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); {
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); MAC_1_inherit_TYPE_descriptor(td);
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); {
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); MAC_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
} }
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); {
return td->uper_encoder(td, constraints, structure, per_out); MAC_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
} }
static asn_per_constraints_t asn_PER_type_MAC_constr_1 = { static asn_per_constraints_t asn_PER_type_MAC_constr_1 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 64, 64 } /* (SIZE(64..64)) */, {APC_CONSTRAINED, 0, 0, 64, 64} /* (SIZE(64..64)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_MAC_tags_1[] = { 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",
MAC_free, MAC_free,
MAC_print, MAC_print,
MAC_constraint, MAC_constraint,
MAC_decode_ber, MAC_decode_ber,
MAC_encode_der, MAC_encode_der,
MAC_decode_xer, MAC_decode_xer,
MAC_encode_xer, MAC_encode_xer,
MAC_decode_uper, MAC_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_MAC_tags_1) &asn_PER_type_MAC_constr_1,
/sizeof(asn_DEF_MAC_tags_1[0]), /* 1 */ 0, 0, /* No members */
&asn_PER_type_MAC_constr_1, 0 /* No specifics */
0, 0, /* No members */
0 /* No specifics */
}; };

View File

@ -8,135 +8,148 @@
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 128)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 128)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 256)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 256)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_shortKey_constr_2 = { static asn_per_constraints_t asn_PER_memb_shortKey_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 128, 128 } /* (SIZE(128..128)) */, {APC_CONSTRAINED, 0, 0, 128, 128} /* (SIZE(128..128)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_longKey_constr_3 = { static asn_per_constraints_t asn_PER_memb_longKey_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 256, 256 } /* (SIZE(256..256)) */, {APC_CONSTRAINED, 0, 0, 256, 256} /* (SIZE(256..256)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_type_SETAuthKey_constr_1 = { static asn_per_constraints_t asn_PER_type_SETAuthKey_constr_1 = {
{ APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, {APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1} /* (0..1,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = { static asn_TYPE_member_t asn_MBR_SETAuthKey_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.shortKey), {ATF_NOFLAGS, 0, offsetof(struct SETAuthKey, choice.shortKey),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_BIT_STRING, &asn_DEF_BIT_STRING,
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 */ &asn_DEF_BIT_STRING,
&asn_DEF_BIT_STRING, 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 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* longKey at 18 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* longKey at 18 */
}; };
static asn_CHOICE_specifics_t asn_SPC_SETAuthKey_specs_1 = { static asn_CHOICE_specifics_t asn_SPC_SETAuthKey_specs_1 = {
sizeof(struct SETAuthKey), sizeof(struct SETAuthKey),
offsetof(struct SETAuthKey, _asn_ctx), offsetof(struct SETAuthKey, _asn_ctx),
offsetof(struct SETAuthKey, present), offsetof(struct SETAuthKey, present),
sizeof(((struct SETAuthKey *)0)->present), sizeof(((struct SETAuthKey *)0)->present),
asn_MAP_SETAuthKey_tag2el_1, asn_MAP_SETAuthKey_tag2el_1,
2, /* Count of tags in the map */ 2, /* Count of tags in the map */
0, 0,
2 /* Extensions start */ 2 /* Extensions start */
}; };
asn_TYPE_descriptor_t asn_DEF_SETAuthKey = { asn_TYPE_descriptor_t asn_DEF_SETAuthKey = {
"SETAuthKey", "SETAuthKey",
"SETAuthKey", "SETAuthKey",
CHOICE_free, CHOICE_free,
CHOICE_print, CHOICE_print,
CHOICE_constraint, CHOICE_constraint,
CHOICE_decode_ber, CHOICE_decode_ber,
CHOICE_encode_der, CHOICE_encode_der,
CHOICE_decode_xer, CHOICE_decode_xer,
CHOICE_encode_xer, CHOICE_encode_xer,
CHOICE_decode_uper, CHOICE_decode_uper,
CHOICE_encode_uper, CHOICE_encode_uper,
CHOICE_outmost_tag, CHOICE_outmost_tag,
0, /* No effective tags (pointer) */ 0, /* No effective tags (pointer) */
0, /* No effective tags (count) */ 0, /* No effective tags (count) */
0, /* No tags (pointer) */ 0, /* No tags (pointer) */
0, /* No tags (count) */ 0, /* No tags (count) */
&asn_PER_type_SETAuthKey_constr_1, &asn_PER_type_SETAuthKey_constr_1,
asn_MBR_SETAuthKey_1, asn_MBR_SETAuthKey_1,
2, /* Elements count */ 2, /* Elements count */
&asn_SPC_SETAuthKey_specs_1 /* Additional specs */ &asn_SPC_SETAuthKey_specs_1 /* Additional specs */
}; };

View File

@ -6,279 +6,301 @@
#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 */ {
const IA5String_t *st = (const IA5String_t *)sptr; /* The underlying type is IA5String */
const uint8_t *ch = st->buf; const IA5String_t *st = (const IA5String_t *)sptr;
const uint8_t *end = ch + st->size; const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch; for (; ch < end; ch++)
if(!(cv <= 127)) return -1; {
} uint8_t cv = *ch;
return 0; if (!(cv <= 127)) return -1;
}
return 0;
} }
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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 8)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 8)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 8)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 8)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
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; {
size_t size; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
if(st->size > 0) { }
/* Size in bits */
size = 8 * st->size - (st->bits_unused & 0x07); if (st->size > 0)
} else { {
size = 0; /* Size in bits */
} size = 8 * st->size - (st->bits_unused & 0x07);
}
if((size == 34)) { else
/* Constraint check succeeded */ {
return 0; size = 0;
} else { }
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)", if (size == 34)
td->name, __FILE__, __LINE__); {
return -1; /* Constraint check succeeded */
} return 0;
}
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static int 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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 8)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 8)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
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; {
size_t size; const IA5String_t *st = (const IA5String_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size >= 1 && size <= 1000) size = st->size;
&& !check_permitted_alphabet_6(st)) {
/* Constraint check succeeded */ if ((size >= 1 && size <= 1000) && !check_permitted_alphabet_6(st))
return 0; {
} else { /* Constraint check succeeded */
_ASN_CTFAIL(app_key, td, sptr, return 0;
"%s: constraint failed (%s:%d)", }
td->name, __FILE__, __LINE__); else
return -1; {
} _ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_msisdn_constr_2 = { static asn_per_constraints_t asn_PER_memb_msisdn_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_mdn_constr_3 = { static asn_per_constraints_t asn_PER_memb_mdn_constr_3 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_min_constr_4 = { static asn_per_constraints_t asn_PER_memb_min_constr_4 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 34, 34 } /* (SIZE(34..34)) */, {APC_CONSTRAINED, 0, 0, 34, 34} /* (SIZE(34..34)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_imsi_constr_5 = { static asn_per_constraints_t asn_PER_memb_imsi_constr_5 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */, {APC_CONSTRAINED, 0, 0, 8, 8} /* (SIZE(8..8)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_per_constraints_t asn_PER_memb_nai_constr_6 = { static asn_per_constraints_t asn_PER_memb_nai_constr_6 = {
{ APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, {APC_CONSTRAINED, 7, 7, 0, 127} /* (0..127) */,
{ APC_CONSTRAINED, 10, 10, 1, 1000 } /* (SIZE(1..1000)) */, {APC_CONSTRAINED, 10, 10, 1, 1000} /* (SIZE(1..1000)) */,
0, 0 /* No PER character map necessary */ 0, 0 /* No PER character map necessary */
}; };
static asn_per_constraints_t asn_PER_type_SETId_constr_1 = { static asn_per_constraints_t asn_PER_type_SETId_constr_1 = {
{ APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5 } /* (0..5,...) */, {APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5} /* (0..5,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_SETId_1[] = { static asn_TYPE_member_t asn_MBR_SETId_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct SETId, choice.msisdn), {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.msisdn),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_OCTET_STRING, &asn_DEF_OCTET_STRING,
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 */ &asn_DEF_OCTET_STRING,
&asn_DEF_OCTET_STRING, 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),
}, (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
{ ATF_NOFLAGS, 0, offsetof(struct SETId, choice.min), -1, /* IMPLICIT tag at current level */
(ASN_TAG_CLASS_CONTEXT | (2 << 2)), &asn_DEF_BIT_STRING,
-1, /* IMPLICIT tag at current level */ memb_min_constraint_1,
&asn_DEF_BIT_STRING, &asn_PER_memb_min_constr_4,
memb_min_constraint_1, 0,
&asn_PER_memb_min_constr_4, "min"},
0, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi),
"min" (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
}, -1, /* IMPLICIT tag at current level */
{ ATF_NOFLAGS, 0, offsetof(struct SETId, choice.imsi), &asn_DEF_OCTET_STRING,
(ASN_TAG_CLASS_CONTEXT | (3 << 2)), memb_imsi_constraint_1,
-1, /* IMPLICIT tag at current level */ &asn_PER_memb_imsi_constr_5,
&asn_DEF_OCTET_STRING, 0,
memb_imsi_constraint_1, "imsi"},
&asn_PER_memb_imsi_constr_5, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai),
0, (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
"imsi" -1, /* IMPLICIT tag at current level */
}, &asn_DEF_IA5String,
{ ATF_NOFLAGS, 0, offsetof(struct SETId, choice.nai), memb_nai_constraint_1,
(ASN_TAG_CLASS_CONTEXT | (4 << 2)), &asn_PER_memb_nai_constr_6,
-1, /* IMPLICIT tag at current level */ 0,
&asn_DEF_IA5String, "nai"},
memb_nai_constraint_1, {ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress),
&asn_PER_memb_nai_constr_6, (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
0, +1, /* EXPLICIT tag at current level */
"nai" &asn_DEF_IPAddress,
}, 0, /* Defer constraints checking to the member type */
{ ATF_NOFLAGS, 0, offsetof(struct SETId, choice.iPAddress), 0, /* No PER visible constraints */
(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0,
+1, /* EXPLICIT tag at current level */ "iPAddress"},
&asn_DEF_IPAddress,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
"iPAddress"
},
}; };
static asn_TYPE_tag2member_t asn_MAP_SETId_tag2el_1[] = { 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 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* mdn at 23 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0}, /* mdn at 23 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* min at 24 */ {(ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0}, /* min at 24 */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* imsi at 25 */ {(ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0}, /* imsi at 25 */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* nai at 26 */ {(ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0}, /* nai at 26 */
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 } /* iPAddress at 27 */ {(ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0} /* iPAddress at 27 */
}; };
static asn_CHOICE_specifics_t asn_SPC_SETId_specs_1 = { static asn_CHOICE_specifics_t asn_SPC_SETId_specs_1 = {
sizeof(struct SETId), sizeof(struct SETId),
offsetof(struct SETId, _asn_ctx), offsetof(struct SETId, _asn_ctx),
offsetof(struct SETId, present), offsetof(struct SETId, present),
sizeof(((struct SETId *)0)->present), sizeof(((struct SETId *)0)->present),
asn_MAP_SETId_tag2el_1, asn_MAP_SETId_tag2el_1,
6, /* Count of tags in the map */ 6, /* Count of tags in the map */
0, 0,
6 /* Extensions start */ 6 /* Extensions start */
}; };
asn_TYPE_descriptor_t asn_DEF_SETId = { asn_TYPE_descriptor_t asn_DEF_SETId = {
"SETId", "SETId",
"SETId", "SETId",
CHOICE_free, CHOICE_free,
CHOICE_print, CHOICE_print,
CHOICE_constraint, CHOICE_constraint,
CHOICE_decode_ber, CHOICE_decode_ber,
CHOICE_encode_der, CHOICE_encode_der,
CHOICE_decode_xer, CHOICE_decode_xer,
CHOICE_encode_xer, CHOICE_encode_xer,
CHOICE_decode_uper, CHOICE_decode_uper,
CHOICE_encode_uper, CHOICE_encode_uper,
CHOICE_outmost_tag, CHOICE_outmost_tag,
0, /* No effective tags (pointer) */ 0, /* No effective tags (pointer) */
0, /* No effective tags (count) */ 0, /* No effective tags (count) */
0, /* No tags (pointer) */ 0, /* No tags (pointer) */
0, /* No tags (count) */ 0, /* No tags (count) */
&asn_PER_type_SETId_constr_1, &asn_PER_type_SETId_constr_1,
asn_MBR_SETId_1, asn_MBR_SETId_1,
6, /* Elements count */ 6, /* Elements count */
&asn_SPC_SETId_specs_1 /* Additional specs */ &asn_SPC_SETId_specs_1 /* Additional specs */
}; };

View File

@ -8,93 +8,92 @@
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; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr, if (!sptr)
"%s: value not given (%s:%d)", {
td->name, __FILE__, __LINE__); _ASN_CTFAIL(app_key, td, sptr,
return -1; "%s: value not given (%s:%d)",
} td->name, __FILE__, __LINE__);
return -1;
size = st->size; }
if((size == 4)) { size = st->size;
/* Constraint check succeeded */
return 0; if (size == 4)
} else { {
_ASN_CTFAIL(app_key, td, sptr, /* Constraint check succeeded */
"%s: constraint failed (%s:%d)", return 0;
td->name, __FILE__, __LINE__); }
return -1; else
} {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_sessionID_constr_2 = { static asn_per_constraints_t asn_PER_memb_sessionID_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, {APC_CONSTRAINED, 0, 0, 4, 4} /* (SIZE(4..4)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = { static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID), {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_OCTET_STRING, &asn_DEF_OCTET_STRING,
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 */ &asn_DEF_SLPAddress,
&asn_DEF_SLPAddress, 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 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = {
sizeof(struct SlpSessionID), sizeof(struct SlpSessionID),
offsetof(struct SlpSessionID, _asn_ctx), offsetof(struct SlpSessionID, _asn_ctx),
asn_MAP_SlpSessionID_tag2el_1, asn_MAP_SlpSessionID_tag2el_1,
2, /* Count of tags in the map */ 2, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */ -1, /* Start extensions */
-1 /* Stop extensions */ -1 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_SlpSessionID = { asn_TYPE_descriptor_t asn_DEF_SlpSessionID = {
"SlpSessionID", "SlpSessionID",
"SlpSessionID", "SlpSessionID",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_SlpSessionID_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ asn_MBR_SlpSessionID_1,
0, /* No PER visible constraints */ 2, /* Elements count */
asn_MBR_SlpSessionID_1, &asn_SPC_SlpSessionID_specs_1 /* Additional specs */
2, /* Elements count */
&asn_SPC_SlpSessionID_specs_1 /* Additional specs */
}; };

View File

@ -6,35 +6,42 @@
#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, {
"%s: value not given (%s:%d)", _ASN_CTFAIL(app_key, td, sptr,
td->name, __FILE__, __LINE__); "%s: value not given (%s:%d)",
return -1; td->name, __FILE__, __LINE__);
} return -1;
}
if(st->size > 0) {
/* Size in bits */ if (st->size > 0)
size = 8 * st->size - (st->bits_unused & 0x07); {
} else { /* Size in bits */
size = 0; size = 8 * st->size - (st->bits_unused & 0x07);
} }
else
if((size == 64)) { {
/* Constraint check succeeded */ size = 0;
return 0; }
} else {
_ASN_CTFAIL(app_key, td, sptr, if (size == 64)
"%s: constraint failed (%s:%d)", {
td->name, __FILE__, __LINE__); /* Constraint check succeeded */
return -1; return 0;
} }
else
{
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
/* /*
@ -42,110 +49,113 @@ 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->print_struct = asn_DEF_BIT_STRING.print_struct; td->free_struct = asn_DEF_BIT_STRING.free_struct;
td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->print_struct = asn_DEF_BIT_STRING.print_struct;
td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder;
td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder;
td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder;
td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder;
td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder;
if(!td->per_constraints) td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder;
td->per_constraints = asn_DEF_BIT_STRING.per_constraints; if (!td->per_constraints)
td->elements = asn_DEF_BIT_STRING.elements; td->per_constraints = asn_DEF_BIT_STRING.per_constraints;
td->elements_count = asn_DEF_BIT_STRING.elements_count; td->elements = asn_DEF_BIT_STRING.elements;
td->specifics = asn_DEF_BIT_STRING.specifics; td->elements_count = asn_DEF_BIT_STRING.elements_count;
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); {
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); Ver_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
} }
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); {
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); Ver_1_inherit_TYPE_descriptor(td);
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); {
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); Ver_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
} }
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); {
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); Ver_1_inherit_TYPE_descriptor(td);
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); {
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); Ver_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
} }
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); {
return td->uper_encoder(td, constraints, structure, per_out); Ver_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
} }
static asn_per_constraints_t asn_PER_type_Ver_constr_1 = { static asn_per_constraints_t asn_PER_type_Ver_constr_1 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 64, 64 } /* (SIZE(64..64)) */, {APC_CONSTRAINED, 0, 0, 64, 64} /* (SIZE(64..64)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static ber_tlv_tag_t asn_DEF_Ver_tags_1[] = { 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",
Ver_free, Ver_free,
Ver_print, Ver_print,
Ver_constraint, Ver_constraint,
Ver_decode_ber, Ver_decode_ber,
Ver_encode_der, Ver_encode_der,
Ver_decode_xer, Ver_decode_xer,
Ver_encode_xer, Ver_encode_xer,
Ver_decode_uper, Ver_decode_uper,
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[0]), /* 1 */
sizeof(asn_DEF_Ver_tags_1) &asn_PER_type_Ver_constr_1,
/sizeof(asn_DEF_Ver_tags_1[0]), /* 1 */ 0, 0, /* No members */
&asn_PER_type_Ver_constr_1, 0 /* No specifics */
0, 0, /* No members */
0 /* No specifics */
}; };

View File

@ -7,11 +7,12 @@
#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 */ {
size_t unclaimed; asn_per_data_t oldpd; /* Old per data source */
size_t ot_moved; /* Number of bits moved by OT processing */ size_t unclaimed;
int repeat; size_t ot_moved; /* Number of bits moved by OT processing */
int repeat;
} uper_ugot_key; } uper_ugot_key;
static int uper_ugot_refill(asn_per_data_t *pd); static int uper_ugot_refill(asn_per_data_t *pd);
@ -24,243 +25,272 @@ 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;
size_t toGo; size_t toGo;
ASN_DEBUG("Open type put %s ...", td->name); ASN_DEBUG("Open type put %s ...", td->name);
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); {
if(maySave < 0) break; ssize_t maySave = uper_put_length(po, toGo);
if(per_put_many_bits(po, bptr, maySave * 8)) break; if (maySave < 0) break;
bptr = (char *)bptr + maySave; if (per_put_many_bits(po, bptr, maySave * 8)) break;
toGo -= maySave; bptr = (char *)bptr + maySave;
} toGo -= maySave;
}
FREEMEM(buf); FREEMEM(buf);
if(toGo) return -1; if (toGo) return -1;
ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)",
td->name, size); td->name, size);
return 0; return 0;
} }
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; {
ssize_t chunk_bytes; asn_dec_rval_t rv;
int repeat; ssize_t chunk_bytes;
uint8_t *buf = 0; int repeat;
size_t bufLen = 0; uint8_t *buf = 0;
size_t bufSize = 0; size_t bufLen = 0;
asn_per_data_t spd; size_t bufSize = 0;
size_t padding; asn_per_data_t spd;
size_t padding;
_ASN_STACK_OVERFLOW_CHECK(ctx); _ASN_STACK_OVERFLOW_CHECK(ctx);
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); {
if(chunk_bytes < 0) { chunk_bytes = uper_get_length(pd, -1, &repeat);
FREEMEM(buf); if (chunk_bytes < 0)
_ASN_DECODE_STARVED; {
} FREEMEM(buf);
if(bufLen + chunk_bytes > bufSize) { _ASN_DECODE_STARVED;
void *ptr; }
bufSize = chunk_bytes + (bufSize << 2); if (bufLen + chunk_bytes > bufSize)
ptr = REALLOC(buf, bufSize); {
if(!ptr) { void *ptr;
FREEMEM(buf); bufSize = chunk_bytes + (bufSize << 2);
_ASN_DECODE_FAILED; ptr = REALLOC(buf, bufSize);
} if (!ptr)
buf = ptr; {
} FREEMEM(buf);
if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { _ASN_DECODE_FAILED;
FREEMEM(buf); }
_ASN_DECODE_STARVED; buf = ptr;
} }
bufLen += chunk_bytes; if (per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3))
} while(repeat); {
FREEMEM(buf);
_ASN_DECODE_STARVED;
}
bufLen += chunk_bytes;
}
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);
memset(&spd, 0, sizeof(spd)); memset(&spd, 0, sizeof(spd));
spd.buffer = buf; spd.buffer = buf;
spd.nbits = bufLen << 3; spd.nbits = bufLen << 3;
asn_debug_indent += 4; asn_debug_indent += 4;
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 */ {
padding = spd.nbits - spd.nboff; /* Check padding validity */
if(padding < 8 && per_get_few_bits(&spd, padding) == 0) { padding = spd.nbits - spd.nboff;
/* Everything is cool */ if (padding < 8 && per_get_few_bits(&spd, padding) == 0)
FREEMEM(buf); {
return rv; /* Everything is cool */
} FREEMEM(buf);
FREEMEM(buf); return rv;
if(padding >= 8) { }
ASN_DEBUG("Too large padding %d in open type", padding); FREEMEM(buf);
_ASN_DECODE_FAILED; if (padding >= 8)
} else { {
ASN_DEBUG("Non-zero padding"); ASN_DEBUG("Too large padding %d in open type", padding);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
} else { else
FREEMEM(buf); {
/* rv.code could be RC_WMORE, nonsense in this context */ ASN_DEBUG("Non-zero padding");
rv.code = RC_FAIL; /* Noone would give us more */ _ASN_DECODE_FAILED;
} }
}
else
{
FREEMEM(buf);
/* rv.code could be RC_WMORE, nonsense in this context */
rv.code = RC_FAIL; /* Noone would give us more */
}
return rv; return rv;
} }
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; {
asn_dec_rval_t rv; uper_ugot_key arg;
ssize_t padding; asn_dec_rval_t rv;
ssize_t padding;
_ASN_STACK_OVERFLOW_CHECK(ctx); _ASN_STACK_OVERFLOW_CHECK(ctx);
ASN_DEBUG("Getting open type %s from %s", td->name, ASN_DEBUG("Getting open type %s from %s", td->name,
per_data_string(pd)); per_data_string(pd));
arg.oldpd = *pd; arg.oldpd = *pd;
arg.unclaimed = 0; arg.unclaimed = 0;
arg.ot_moved = 0; arg.ot_moved = 0;
arg.repeat = 1; arg.repeat = 1;
pd->refill = uper_ugot_refill; pd->refill = uper_ugot_refill;
pd->refill_key = &arg; pd->refill_key = &arg;
pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */
pd->moved = 0; /* This now counts the open type size in bits */ pd->moved = 0; /* This now counts the open type size in bits */
asn_debug_indent += 4; asn_debug_indent += 4;
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 \
/* buffer and nboff are valid, preserve them. */ \ do \
pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ { \
pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ /* buffer and nboff are valid, preserve them. */ \
pd->refill = arg.oldpd.refill; \ pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \
pd->refill_key = arg.oldpd.refill_key; \ pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \
} while(0) pd->refill = arg.oldpd.refill; \
pd->refill_key = arg.oldpd.refill_key; \
} \
while (0)
if(rv.code != RC_OK) { if (rv.code != RC_OK)
UPDRESTOREPD; {
return rv; UPDRESTOREPD;
} 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; {
if(padding > 7) { int32_t pvalue;
ASN_DEBUG("Too large padding %d in open type", if (padding > 7)
padding); {
rv.code = RC_FAIL; ASN_DEBUG("Too large padding %d in open type",
UPDRESTOREPD; padding);
return rv; rv.code = RC_FAIL;
} UPDRESTOREPD;
padding = 8 - padding; return rv;
ASN_DEBUG("Getting padding of %d bits", padding); }
pvalue = per_get_few_bits(pd, padding); padding = 8 - padding;
switch(pvalue) { ASN_DEBUG("Getting padding of %d bits", padding);
case -1: pvalue = per_get_few_bits(pd, padding);
ASN_DEBUG("Padding skip failed"); switch (pvalue)
UPDRESTOREPD; {
_ASN_DECODE_STARVED; case -1:
case 0: break; ASN_DEBUG("Padding skip failed");
default: UPDRESTOREPD;
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", _ASN_DECODE_STARVED;
padding, (int)pvalue); case 0:
UPDRESTOREPD; break;
_ASN_DECODE_FAILED; default:
} ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
} padding, (int)pvalue);
if(pd->nboff != pd->nbits) { UPDRESTOREPD;
ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, _ASN_DECODE_FAILED;
per_data_string(pd), per_data_string(&arg.oldpd)); }
if(1) { }
UPDRESTOREPD; if (pd->nboff != pd->nbits)
_ASN_DECODE_FAILED; {
} else { ASN_DEBUG("Open type %s overhead pd%s old%s", td->name,
arg.unclaimed += pd->nbits - pd->nboff; per_data_string(pd), per_data_string(&arg.oldpd));
} if (1)
} {
UPDRESTOREPD;
_ASN_DECODE_FAILED;
}
else
{
arg.unclaimed += pd->nbits - pd->nboff;
}
}
/* Adjust pd back so it points to original data */ /* Adjust pd back so it points to original data */
UPDRESTOREPD; UPDRESTOREPD;
/* 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)) { {
case -1: switch (per_skip_bits(pd, arg.unclaimed))
ASN_DEBUG("Claim of %d failed", arg.unclaimed); {
_ASN_DECODE_STARVED; case -1:
case 0: ASN_DEBUG("Claim of %d failed", arg.unclaimed);
ASN_DEBUG("Got claim of %d", arg.unclaimed); _ASN_DECODE_STARVED;
break; case 0:
default: ASN_DEBUG("Got claim of %d", arg.unclaimed);
/* Padding must be blank */ break;
ASN_DEBUG("Non-blank unconsumed padding"); default:
_ASN_DECODE_FAILED; /* Padding must be blank */
} ASN_DEBUG("Non-blank unconsumed padding");
arg.unclaimed = 0; _ASN_DECODE_FAILED;
} }
arg.unclaimed = 0;
}
if(arg.repeat) { if (arg.repeat)
ASN_DEBUG("Not consumed the whole thing"); {
rv.code = RC_FAIL; ASN_DEBUG("Not consumed the whole thing");
return rv; rv.code = RC_FAIL;
} return rv;
}
return rv; return rv;
} }
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;
s_td.name = "<unknown extension>"; s_td.name = "<unknown extension>";
s_td.uper_decoder = uper_sot_suck; s_td.uper_decoder = uper_sot_suck;
rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); rv = uper_open_type_get(ctx, &s_td, 0, 0, pd);
if(rv.code != RC_OK) if (rv.code != RC_OK)
return -1; return -1;
else else
return 0; return 0;
} }
/* /*
@ -269,105 +299,122 @@ 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;
(void)td; (void)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;
return rv; return rv;
} }
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; {
ssize_t next_chunk_bytes, next_chunk_bits; uper_ugot_key *arg = pd->refill_key;
ssize_t avail; ssize_t next_chunk_bytes, next_chunk_bits;
ssize_t avail;
asn_per_data_t *oldpd = &arg->oldpd; asn_per_data_t *oldpd = &arg->oldpd;
ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d",
pd->moved, oldpd->moved); pd->moved, oldpd->moved);
/* Advance our position to where pd is */ /* Advance our position to where pd is */
oldpd->buffer = pd->buffer; oldpd->buffer = pd->buffer;
oldpd->nboff = pd->nboff; oldpd->nboff = pd->nboff;
oldpd->nbits -= pd->moved - arg->ot_moved; oldpd->nbits -= pd->moved - arg->ot_moved;
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 */ {
if(per_get_few_bits(oldpd, 1)) /* Refill the container */
return -1; if (per_get_few_bits(oldpd, 1))
if(oldpd->nboff == 0) { return -1;
assert(0); if (oldpd->nboff == 0)
return -1; {
} assert(0);
pd->buffer = oldpd->buffer; return -1;
pd->nboff = oldpd->nboff - 1; }
pd->nbits = oldpd->nbits; pd->buffer = oldpd->buffer;
ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved); pd->nboff = oldpd->nboff - 1;
return 0; pd->nbits = oldpd->nbits;
} ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved);
return 0;
}
if(!arg->repeat) { if (!arg->repeat)
ASN_DEBUG("Want more but refill doesn't have it"); {
return -1; ASN_DEBUG("Want more but refill doesn't have it");
} return -1;
}
next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat);
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 */ {
assert(!arg->repeat); /* Implementation guarantee */ pd->refill = 0; /* No more refills, naturally */
} assert(!arg->repeat); /* Implementation guarantee */
next_chunk_bits = next_chunk_bytes << 3; }
avail = oldpd->nbits - oldpd->nboff; next_chunk_bits = next_chunk_bytes << 3;
if(avail >= next_chunk_bits) { avail = oldpd->nbits - oldpd->nboff;
pd->nbits = oldpd->nboff + next_chunk_bits; if (avail >= next_chunk_bits)
arg->unclaimed = 0; {
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", pd->nbits = oldpd->nboff + next_chunk_bits;
next_chunk_bits, oldpd->moved, arg->unclaimed = 0;
oldpd->nboff, oldpd->nbits, ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)",
oldpd->nbits - oldpd->nboff); next_chunk_bits, oldpd->moved,
} else { oldpd->nboff, oldpd->nbits,
pd->nbits = oldpd->nbits; oldpd->nbits - oldpd->nboff);
arg->unclaimed = next_chunk_bits - avail; }
ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); else
} {
pd->buffer = oldpd->buffer; pd->nbits = oldpd->nbits;
pd->nboff = oldpd->nboff; arg->unclaimed = next_chunk_bits - avail;
ASN_DEBUG("Refilled pd%s old%s", ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed);
per_data_string(pd), per_data_string(oldpd)); }
return 0; pd->buffer = oldpd->buffer;
pd->nboff = oldpd->nboff;
ASN_DEBUG("Refilled pd%s old%s",
per_data_string(pd), per_data_string(oldpd));
return 0;
} }
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; {
while(skip_nbits > 0) { int hasNonZeroBits = 0;
int skip; while (skip_nbits > 0)
if(skip_nbits < skip) {
skip = skip_nbits; int skip = 0;
else if (skip_nbits < skip)
skip = 24; skip = skip_nbits;
skip_nbits -= skip; else
skip = 24;
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 */
return hasNonZeroBits; default:
hasNonZeroBits = 1;
continue;
}
}
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

@ -61,57 +61,53 @@ private:
public: public:
bool b_valid_ephemeris_set_flag; // flag indicating that this ephemeris set have passed the validation check bool b_valid_ephemeris_set_flag; // flag indicating that this ephemeris set have passed the validation check
//broadcast orbit 1 // broadcast orbit 1
double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s] double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
double d_TOW_SF1; //!< Time of GPS Week from HOW word of Subframe 1 [s] double d_TOW_SF1; //!< Time of GPS Week from HOW word of Subframe 1 [s]
double d_TOW_SF2; //!< Time of GPS Week from HOW word of Subframe 2 [s] double d_TOW_SF2; //!< Time of GPS Week from HOW word of Subframe 2 [s]
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]
double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s] double d_Delta_n; //!< Mean Motion Difference From Computed Value [semi-circles/s]
double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles] double d_M_0; //!< Mean Anomaly at Reference Time [semi-circles]
//broadcast orbit 2 // broadcast orbit 2
double d_Cuc; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad] double d_Cuc; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
double d_e_eccentricity; //!< Eccentricity [dimensionless] double d_e_eccentricity; //!< Eccentricity [dimensionless]
double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad] double d_Cus; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]
double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)] double d_sqrt_A; //!< Square Root of the Semi-Major Axis [sqrt(m)]
//broadcast orbit 3 // broadcast orbit 3
double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s] double d_Toe; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200E) [s]
double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s] double d_Toc; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200E) [s]
double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad] double d_Cic; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad]
double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] double d_OMEGA0; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad] double d_Cis; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]
//broadcast orbit 4 // broadcast orbit 4
double d_i_0; //!< Inclination Angle at Reference Time [semi-circles] double d_i_0; //!< Inclination Angle at Reference Time [semi-circles]
double d_Crc; //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m] double d_Crc; //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m]
double d_OMEGA; //!< Argument of Perigee [semi-cicles] double d_OMEGA; //!< Argument of Perigee [semi-cicles]
double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s] double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
//broadcast orbit 5 // broadcast orbit 5
double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s] double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s]
int32_t i_code_on_L2; //!< If 1, P code ON in L2; if 2, C/A code ON in L2; int32_t i_code_on_L2; //!< If 1, P code ON in L2; if 2, C/A code ON in L2;
int32_t i_GPS_week; //!< GPS week number, aka WN [week] int32_t i_GPS_week; //!< GPS week number, aka WN [week]
bool b_L2_P_data_flag; //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel bool b_L2_P_data_flag; //!< When true, indicates that the NAV data stream was commanded OFF on the P-code of the L2 channel
//broadcast orbit 6 // broadcast orbit 6
int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E) int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV (reference paragraph 6.2.1) for the standard positioning service user (Ref 20.3.3.3.1.3 IS-GPS-200E)
int32_t i_SV_health; int32_t i_SV_health;
double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s] double d_TGD; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
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
@ -151,7 +147,7 @@ public:
uint32_t i_satellite_PRN; uint32_t i_satellite_PRN;
// time synchro // time synchro
double d_subframe_timestamp_ms; //[ms] double d_subframe_timestamp_ms; // [ms]
// Ionospheric parameters // Ionospheric parameters
bool flag_iono_valid; //!< If set, it indicates that the ionospheric parameters are filled (page 18 has arrived and decoded) bool flag_iono_valid; //!< If set, it indicates that the ionospheric parameters are filled (page 18 has arrived and decoded)

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;
} }