mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Fixes for clang-format 13
This commit is contained in:
parent
5bed35471a
commit
a805940bd7
@ -222,8 +222,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns name of RINEX observation file
|
* \brief Returns name of RINEX observation file
|
||||||
*/
|
*/
|
||||||
inline std::string get_obsfilename() const
|
inline std::string get_obsfilename() const
|
||||||
{
|
{
|
||||||
return obsfilename;
|
return obsfilename;
|
||||||
|
@ -191,12 +191,12 @@ public:
|
|||||||
int32_t read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) const;
|
int32_t read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Prints message type 1020 (GLONASS Ephemeris).
|
* \brief Prints message type 1020 (GLONASS Ephemeris).
|
||||||
* \note Code added as part of GSoC 2017 program
|
* \note Code added as part of GSoC 2017 program
|
||||||
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
|
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
|
||||||
* \param glonass_gnav_utc_model GLONASS GNAV Clock Information
|
* \param glonass_gnav_utc_model GLONASS GNAV Clock Information
|
||||||
* \return Returns message type as a string type
|
* \return Returns message type as a string type
|
||||||
*/
|
*/
|
||||||
std::string print_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
|
std::string print_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -88,8 +88,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set channel fsm associated to this acquisition instance
|
* \brief Set channel fsm associated to this acquisition instance
|
||||||
*/
|
*/
|
||||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||||
{
|
{
|
||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set channel fsm associated to this acquisition instance
|
* \brief Set channel fsm associated to this acquisition instance
|
||||||
*/
|
*/
|
||||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||||
{
|
{
|
||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set channel fsm associated to this acquisition instance
|
* \brief Set channel fsm associated to this acquisition instance
|
||||||
*/
|
*/
|
||||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||||
{
|
{
|
||||||
channel_fsm_ = channel_fsm;
|
channel_fsm_ = channel_fsm;
|
||||||
|
@ -38,8 +38,8 @@ namespace own = gsl;
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generates Galileo E6B code at 1 sample/chip
|
* \brief Generates Galileo E6B code at 1 sample/chip
|
||||||
*/
|
*/
|
||||||
void galileo_e6_b_code_gen_complex_primary(own::span<std::complex<float>> dest,
|
void galileo_e6_b_code_gen_complex_primary(own::span<std::complex<float>> dest,
|
||||||
int32_t prn);
|
int32_t prn);
|
||||||
|
|
||||||
@ -51,9 +51,9 @@ void galileo_e6_b_code_gen_float_primary(own::span<float> dest, int32_t prn);
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Generates Galileo E6B complex code, shifted to the desired chip and
|
* \brief Generates Galileo E6B complex code, shifted to the desired chip and
|
||||||
* sampled at a frequency sampling_freq
|
* sampled at a frequency sampling_freq
|
||||||
*/
|
*/
|
||||||
void galileo_e6_b_code_gen_complex_sampled(own::span<std::complex<float>> dest,
|
void galileo_e6_b_code_gen_complex_sampled(own::span<std::complex<float>> dest,
|
||||||
uint32_t prn,
|
uint32_t prn,
|
||||||
int32_t sampling_freq,
|
int32_t sampling_freq,
|
||||||
|
@ -60,30 +60,30 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
|||||||
int iter, const prcopt_t *opt, double *var);
|
int iter, const prcopt_t *opt, double *var);
|
||||||
|
|
||||||
/* ionospheric correction ------------------------------------------------------
|
/* ionospheric correction ------------------------------------------------------
|
||||||
* compute ionospheric correction
|
* compute ionospheric correction
|
||||||
* args : gtime_t time I time
|
* args : gtime_t time I time
|
||||||
* nav_t *nav I navigation data
|
* nav_t *nav I navigation data
|
||||||
* int sat I satellite number
|
* int sat I satellite number
|
||||||
* double *pos I receiver position {lat,lon,h} (rad|m)
|
* double *pos I receiver position {lat,lon,h} (rad|m)
|
||||||
* double *azel I azimuth/elevation angle {az,el} (rad)
|
* double *azel I azimuth/elevation angle {az,el} (rad)
|
||||||
* int ionoopt I ionospheric correction option (IONOOPT_???)
|
* int ionoopt I ionospheric correction option (IONOOPT_???)
|
||||||
* double *ion O ionospheric delay (L1) (m)
|
* double *ion O ionospheric delay (L1) (m)
|
||||||
* double *var O ionospheric delay (L1) variance (m^2)
|
* double *var O ionospheric delay (L1) variance (m^2)
|
||||||
* return : status(1:ok,0:error)
|
* return : status(1:ok,0:error)
|
||||||
*-----------------------------------------------------------------------------*/
|
*-----------------------------------------------------------------------------*/
|
||||||
int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
|
int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
|
||||||
const double *azel, int ionoopt, double *ion, double *var);
|
const double *azel, int ionoopt, double *ion, double *var);
|
||||||
/* tropospheric correction -----------------------------------------------------
|
/* tropospheric correction -----------------------------------------------------
|
||||||
* compute tropospheric correction
|
* compute tropospheric correction
|
||||||
* args : gtime_t time I time
|
* args : gtime_t time I time
|
||||||
* nav_t *nav I navigation data
|
* nav_t *nav I navigation data
|
||||||
* double *pos I receiver position {lat,lon,h} (rad|m)
|
* double *pos I receiver position {lat,lon,h} (rad|m)
|
||||||
* double *azel I azimuth/elevation angle {az,el} (rad)
|
* double *azel I azimuth/elevation angle {az,el} (rad)
|
||||||
* int tropopt I tropospheric correction option (TROPOPT_???)
|
* int tropopt I tropospheric correction option (TROPOPT_???)
|
||||||
* double *trp O tropospheric delay (m)
|
* double *trp O tropospheric delay (m)
|
||||||
* double *var O tropospheric delay variance (m^2)
|
* double *var O tropospheric delay variance (m^2)
|
||||||
* return : status(1:ok,0:error)
|
* return : status(1:ok,0:error)
|
||||||
*-----------------------------------------------------------------------------*/
|
*-----------------------------------------------------------------------------*/
|
||||||
int tropcorr(gtime_t time, const nav_t *nav, const double *pos,
|
int tropcorr(gtime_t time, const nav_t *nav, const double *pos,
|
||||||
const double *azel, int tropopt, double *trp, double *var);
|
const double *azel, int tropopt, double *trp, double *var);
|
||||||
|
|
||||||
@ -122,22 +122,22 @@ void estvel(const obsd_t *obs, int n, const double *rs, const double *dts,
|
|||||||
const double *azel, const int *vsat);
|
const double *azel, const int *vsat);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief single-point positioning
|
* \brief single-point positioning
|
||||||
* compute receiver position, velocity, clock bias by single-point positioning
|
* compute receiver position, velocity, clock bias by single-point positioning
|
||||||
* with pseudorange and doppler observables
|
* with pseudorange and doppler observables
|
||||||
* args : obsd_t *obs I observation data
|
* args : obsd_t *obs I observation data
|
||||||
* int n I number of observation data
|
* int n I number of observation data
|
||||||
* nav_t *nav I navigation data
|
* nav_t *nav I navigation data
|
||||||
* prcopt_t *opt I processing options
|
* prcopt_t *opt I processing options
|
||||||
* sol_t *sol IO solution
|
* sol_t *sol IO solution
|
||||||
* double *azel IO azimuth/elevation angle (rad) (NULL: no output)
|
* double *azel IO azimuth/elevation angle (rad) (NULL: no output)
|
||||||
* ssat_t *ssat IO satellite status (NULL: no output)
|
* ssat_t *ssat IO satellite status (NULL: no output)
|
||||||
* char *msg O error message for error exit
|
* char *msg O error message for error exit
|
||||||
* return : status(1:ok,0:error)
|
* return : status(1:ok,0:error)
|
||||||
* notes : assuming sbas-gps, galileo-gps, qzss-gps, compass-gps time offset and
|
* notes : assuming sbas-gps, galileo-gps, qzss-gps, compass-gps time offset and
|
||||||
* receiver bias are negligible (only involving glonass-gps time offset
|
* receiver bias are negligible (only involving glonass-gps time offset
|
||||||
* and receiver bias)
|
* and receiver bias)
|
||||||
*/
|
*/
|
||||||
int pntpos(const obsd_t *obs, int n, const nav_t *nav,
|
int pntpos(const obsd_t *obs, int n, const nav_t *nav,
|
||||||
const prcopt_t *opt, sol_t *sol, double *azel, ssat_t *ssat,
|
const prcopt_t *opt, sol_t *sol, double *azel, ssat_t *ssat,
|
||||||
char *msg);
|
char *msg);
|
||||||
|
@ -118,9 +118,9 @@ static const PPCInfo kEmptyPPCInfo;
|
|||||||
PPCInfo GetPPCInfo(void)
|
PPCInfo GetPPCInfo(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* On Power feature flags aren't currently in cpuinfo so we only look at
|
* On Power feature flags aren't currently in cpuinfo so we only look at
|
||||||
* the auxilary vector.
|
* the auxilary vector.
|
||||||
*/
|
*/
|
||||||
PPCInfo info = kEmptyPPCInfo;
|
PPCInfo info = kEmptyPPCInfo;
|
||||||
const HardwareCapabilities hwcaps = CpuFeatures_GetHardwareCapabilities();
|
const HardwareCapabilities hwcaps = CpuFeatures_GetHardwareCapabilities();
|
||||||
for (size_t i = 0; i < PPC_LAST_; ++i)
|
for (size_t i = 0; i < PPC_LAST_; ++i)
|
||||||
|
@ -95,9 +95,9 @@ size_t volk_gnsssdr_load_preferences(volk_gnsssdr_arch_pref_t **prefs_res)
|
|||||||
|
|
||||||
// get the config path
|
// get the config path
|
||||||
volk_gnsssdr_get_config_path(path, true);
|
volk_gnsssdr_get_config_path(path, true);
|
||||||
if (!path[0]) return n_arch_prefs; //no prefs found
|
if (!path[0]) return n_arch_prefs; // no prefs found
|
||||||
config_file = fopen(path, "r");
|
config_file = fopen(path, "r");
|
||||||
if (!config_file) return n_arch_prefs; //no prefs found
|
if (!config_file) return n_arch_prefs; // no prefs found
|
||||||
|
|
||||||
// reset the file pointer and write the prefs into volk_gnsssdr_arch_prefs
|
// reset the file pointer and write the prefs into volk_gnsssdr_arch_prefs
|
||||||
while (fgets(line, sizeof(line), config_file) != NULL)
|
while (fgets(line, sizeof(line), config_file) != NULL)
|
||||||
|
@ -32,7 +32,7 @@ int volk_gnsssdr_get_index(
|
|||||||
// TODO return -1;
|
// TODO return -1;
|
||||||
// something terrible should happen here
|
// something terrible should happen here
|
||||||
fprintf(stderr, "VOLK_GNSSSDR warning: no arch found, returning generic impl\n");
|
fprintf(stderr, "VOLK_GNSSSDR warning: no arch found, returning generic impl\n");
|
||||||
return volk_gnsssdr_get_index(impl_names, n_impls, "generic"); //but we'll fake it for now
|
return volk_gnsssdr_get_index(impl_names, n_impls, "generic"); // but we'll fake it for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ int volk_gnsssdr_rank_archs(
|
|||||||
// now look for the function name in the prefs list
|
// now look for the function name in the prefs list
|
||||||
for (i = 0; i < n_arch_prefs; i++)
|
for (i = 0; i < n_arch_prefs; i++)
|
||||||
{
|
{
|
||||||
if (!strncmp(kern_name, volk_gnsssdr_arch_prefs[i].name, sizeof(volk_gnsssdr_arch_prefs[i].name))) //found it
|
if (!strncmp(kern_name, volk_gnsssdr_arch_prefs[i].name, sizeof(volk_gnsssdr_arch_prefs[i].name))) // found it
|
||||||
{
|
{
|
||||||
const char *impl_name = align ? volk_gnsssdr_arch_prefs[i].impl_a : volk_gnsssdr_arch_prefs[i].impl_u;
|
const char *impl_name = align ? volk_gnsssdr_arch_prefs[i].impl_a : volk_gnsssdr_arch_prefs[i].impl_u;
|
||||||
return volk_gnsssdr_get_index(impl_names, n_impls, impl_name);
|
return volk_gnsssdr_get_index(impl_names, n_impls, impl_name);
|
||||||
|
@ -47,7 +47,7 @@ struct volk_gnsssdr_machine *get_machine(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
machine = max_machine;
|
machine = max_machine;
|
||||||
//printf("Using Volk machine: %s\n", machine->name);
|
// printf("Using Volk machine: %s\n", machine->name);
|
||||||
__alignment = machine->alignment;
|
__alignment = machine->alignment;
|
||||||
__alignment_mask = (intptr_t)(__alignment - 1);
|
__alignment_mask = (intptr_t)(__alignment - 1);
|
||||||
return machine;
|
return machine;
|
||||||
@ -101,7 +101,7 @@ const char *volk_gnsssdr_get_machine(void)
|
|||||||
|
|
||||||
size_t volk_gnsssdr_get_alignment(void)
|
size_t volk_gnsssdr_get_alignment(void)
|
||||||
{
|
{
|
||||||
get_machine(); //ensures alignment is set
|
get_machine(); // ensures alignment is set
|
||||||
return __alignment;
|
return __alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,16 +22,16 @@ struct VOLK_CPU volk_gnsssdr_cpu;
|
|||||||
|
|
||||||
#if defined(VOLK_CPU_x86)
|
#if defined(VOLK_CPU_x86)
|
||||||
|
|
||||||
//implement get cpuid for gcc compilers using a system or local copy of cpuid.h
|
// implement get cpuid for gcc compilers using a system or local copy of cpuid.h
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#define cpuid_x86(op, r) __get_cpuid(op, (unsigned int *)r + 0, (unsigned int *)r + 1, (unsigned int *)r + 2, (unsigned int *)r + 3)
|
#define cpuid_x86(op, r) __get_cpuid(op, (unsigned int *)r + 0, (unsigned int *)r + 1, (unsigned int *)r + 2, (unsigned int *)r + 3)
|
||||||
#define cpuid_x86_count(op, count, regs) __cpuid_count(op, count, *((unsigned int *)regs), *((unsigned int *)regs + 1), *((unsigned int *)regs + 2), *((unsigned int *)regs + 3))
|
#define cpuid_x86_count(op, count, regs) __cpuid_count(op, count, *((unsigned int *)regs), *((unsigned int *)regs + 1), *((unsigned int *)regs + 2), *((unsigned int *)regs + 3))
|
||||||
|
|
||||||
/* Return Intel AVX extended CPU capabilities register.
|
/* Return Intel AVX extended CPU capabilities register.
|
||||||
* This function will bomb on non-AVX-capable machines, so
|
* This function will bomb on non-AVX-capable machines, so
|
||||||
* check for AVX capability before executing.
|
* check for AVX capability before executing.
|
||||||
*/
|
*/
|
||||||
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
||||||
static inline unsigned long long _xgetbv(unsigned int index)
|
static inline unsigned long long _xgetbv(unsigned int index)
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ static inline unsigned long long _xgetbv(unsigned int index)
|
|||||||
#define __xgetbv() 0
|
#define __xgetbv() 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//implement get cpuid for MSVC compilers using __cpuid intrinsic
|
// implement get cpuid for MSVC compilers using __cpuid intrinsic
|
||||||
#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H)
|
#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#define cpuid_x86(op, r) __cpuid(((int *)r), op)
|
#define cpuid_x86(op, r) __cpuid(((int *)r), op)
|
||||||
@ -60,9 +60,9 @@ static inline unsigned long long _xgetbv(unsigned int index)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
#error "A get cpuid for volk_gnsssdr is not available on this compiler..."
|
#error "A get cpuid for volk_gnsssdr is not available on this compiler..."
|
||||||
#endif //defined(__GNUC__)
|
#endif // defined(__GNUC__)
|
||||||
|
|
||||||
#endif //defined(VOLK_CPU_x86)
|
#endif // defined(VOLK_CPU_x86)
|
||||||
|
|
||||||
static inline unsigned int cpuid_count_x86_bit(unsigned int level, unsigned int count, unsigned int reg, unsigned int bit)
|
static inline unsigned int cpuid_count_x86_bit(unsigned int level, unsigned int count, unsigned int reg, unsigned int bit)
|
||||||
{
|
{
|
||||||
@ -120,13 +120,13 @@ static inline unsigned int get_avx2_enabled(void)
|
|||||||
static inline unsigned int get_avx512_enabled(void)
|
static inline unsigned int get_avx512_enabled(void)
|
||||||
{
|
{
|
||||||
#if defined(VOLK_CPU_x86)
|
#if defined(VOLK_CPU_x86)
|
||||||
return __xgetbv() & 0xE6; //check for zmm, xmm and ymm regs
|
return __xgetbv() & 0xE6; // check for zmm, xmm and ymm regs
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//neon detection is linux specific
|
// neon detection is linux specific
|
||||||
#if defined(__arm__) && defined(__linux__)
|
#if defined(__arm__) && defined(__linux__)
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
#include <linux/auxvec.h>
|
#include <linux/auxvec.h>
|
||||||
@ -144,8 +144,8 @@ static int has_neonv7(void)
|
|||||||
if (!auxvec_f) return 0;
|
if (!auxvec_f) return 0;
|
||||||
|
|
||||||
size_t r = 1;
|
size_t r = 1;
|
||||||
//so auxv is basically 32b of ID and 32b of value
|
// so auxv is basically 32b of ID and 32b of value
|
||||||
//so it goes like this
|
// so it goes like this
|
||||||
while (!found_neon && r)
|
while (!found_neon && r)
|
||||||
{
|
{
|
||||||
r = fread(auxvec, sizeof(unsigned long), 2, auxvec_f);
|
r = fread(auxvec, sizeof(unsigned long), 2, auxvec_f);
|
||||||
@ -161,7 +161,7 @@ static int has_neonv7(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//\todo: Fix this to really check for neon on aarch64
|
//\todo: Fix this to really check for neon on aarch64
|
||||||
//neon detection is linux specific
|
// neon detection is linux specific
|
||||||
#if defined(__aarch64__) && defined(__linux__)
|
#if defined(__aarch64__) && defined(__linux__)
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
#include <linux/auxvec.h>
|
#include <linux/auxvec.h>
|
||||||
@ -179,8 +179,8 @@ static int has_neonv8(void)
|
|||||||
if (!auxvec_f) return 0;
|
if (!auxvec_f) return 0;
|
||||||
|
|
||||||
size_t r = 1;
|
size_t r = 1;
|
||||||
//so auxv is basically 32b of ID and 32b of value
|
// so auxv is basically 32b of ID and 32b of value
|
||||||
//so it goes like this
|
// so it goes like this
|
||||||
while (!found_neon && r)
|
while (!found_neon && r)
|
||||||
{
|
{
|
||||||
r = fread(auxvec, sizeof(unsigned long), 2, auxvec_f);
|
r = fread(auxvec, sizeof(unsigned long), 2, auxvec_f);
|
||||||
@ -225,7 +225,7 @@ static int i_can_has_${arch.name} (void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline void set_float_rounding(void){
|
static inline void set_float_rounding(void){
|
||||||
//do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
@ -237,7 +237,7 @@ static int i_can_has_${arch.name} (void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline void set_float_rounding(void){
|
static inline void set_float_rounding(void){
|
||||||
//do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
class ConfigurationInterface;
|
class ConfigurationInterface;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class generates synthesized GNSS signal.
|
* \brief This class generates synthesized GNSS signal.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class SignalGenerator : public GNSSBlockInterface
|
class SignalGenerator : public GNSSBlockInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new instance of signal_generator_c and return
|
* Create a new instance of signal_generator_c and return
|
||||||
* a boost shared_ptr. This is effectively the public constructor.
|
* a boost shared_ptr. This is effectively the public constructor.
|
||||||
*/
|
*/
|
||||||
signal_generator_c_sptr
|
signal_generator_c_sptr
|
||||||
signal_make_generator_c(const std::vector<std::string> &signal1, const std::vector<std::string> &system, const std::vector<unsigned int> &PRN,
|
signal_make_generator_c(const std::vector<std::string> &signal1, const std::vector<std::string> &system, const std::vector<unsigned int> &PRN,
|
||||||
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
|
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
|
||||||
@ -50,8 +50,8 @@ signal_make_generator_c(const std::vector<std::string> &signal1, const std::vect
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The private constructor
|
* The private constructor
|
||||||
*/
|
*/
|
||||||
signal_generator_c::signal_generator_c(std::vector<std::string> signal1,
|
signal_generator_c::signal_generator_c(std::vector<std::string> signal1,
|
||||||
std::vector<std::string> system,
|
std::vector<std::string> system,
|
||||||
const std::vector<unsigned int> &PRN,
|
const std::vector<unsigned int> &PRN,
|
||||||
|
@ -29,12 +29,12 @@ class signal_generator_c;
|
|||||||
using signal_generator_c_sptr = gnss_shared_ptr<signal_generator_c>;
|
using signal_generator_c_sptr = gnss_shared_ptr<signal_generator_c>;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return a shared_ptr to a new instance of gen_source.
|
* \brief Return a shared_ptr to a new instance of gen_source.
|
||||||
*
|
*
|
||||||
* To avoid accidental use of raw pointers, gen_source's
|
* To avoid accidental use of raw pointers, gen_source's
|
||||||
* constructor is private. signal_make_generator_c is the public
|
* constructor is private. signal_make_generator_c is the public
|
||||||
* interface for creating new instances.
|
* interface for creating new instances.
|
||||||
*/
|
*/
|
||||||
signal_generator_c_sptr signal_make_generator_c(
|
signal_generator_c_sptr signal_make_generator_c(
|
||||||
const std::vector<std::string> &signal1,
|
const std::vector<std::string> &signal1,
|
||||||
const std::vector<std::string> &system,
|
const std::vector<std::string> &system,
|
||||||
@ -50,11 +50,11 @@ signal_generator_c_sptr signal_make_generator_c(
|
|||||||
float BW_BB);
|
float BW_BB);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class generates synthesized GNSS signal.
|
* \brief This class generates synthesized GNSS signal.
|
||||||
* \ingroup block
|
* \ingroup block
|
||||||
*
|
*
|
||||||
* \sa gen_source for a version that subclasses gr_block.
|
* \sa gen_source for a version that subclasses gr_block.
|
||||||
*/
|
*/
|
||||||
class signal_generator_c : public gr::block
|
class signal_generator_c : public gr::block
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -50,10 +50,10 @@ glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
|
|||||||
const Tlm_Conf &conf);
|
const Tlm_Conf &conf);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1
|
* \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1
|
||||||
* \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
|
* \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class glonass_l2_ca_telemetry_decoder_gs : public gr::block
|
class glonass_l2_ca_telemetry_decoder_gs : public gr::block
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -63,8 +63,8 @@ public:
|
|||||||
inline void reset(){};
|
inline void reset(){};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override;
|
||||||
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file gps_l1_ca_telemetry_decoder_gs.cc
|
* \file gps_l1_ca_telemetry_decoder_gs.cc
|
||||||
* \brief Implementation of a NAV message demodulator block based on
|
* \brief Implementation of a NAV message demodulator block based on
|
||||||
* Kay Borre book MATLAB-based GPS receiver
|
* Kay Borre book MATLAB-based GPS receiver
|
||||||
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||||
*
|
*
|
||||||
* GNSS-SDR is a software defined Global Navigation
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
* Satellite Systems receiver
|
* Satellite Systems receiver
|
||||||
*
|
*
|
||||||
* This file is part of GNSS-SDR.
|
* This file is part of GNSS-SDR.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gps_l1_ca_telemetry_decoder_gs.h"
|
#include "gps_l1_ca_telemetry_decoder_gs.h"
|
||||||
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
|
#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11
|
||||||
|
@ -76,14 +76,14 @@ typedef struct
|
|||||||
/**< Decode buffer */
|
/**< Decode buffer */
|
||||||
size_t n_decoded; /**< Number of bits in the decode buffer */
|
size_t n_decoded; /**< Number of bits in the decode buffer */
|
||||||
bool preamble_seen; /**< When true, the decode buffer is aligned on
|
bool preamble_seen; /**< When true, the decode buffer is aligned on
|
||||||
* preamble. */
|
* preamble. */
|
||||||
bool invert; /**< When true, indicates the bits are inverted */
|
bool invert; /**< When true, indicates the bits are inverted */
|
||||||
bool message_lock; /**< When true, indicates the message boundary
|
bool message_lock; /**< When true, indicates the message boundary
|
||||||
* is found. */
|
* is found. */
|
||||||
bool crc_ok; /**< Flag that the last message had good CRC */
|
bool crc_ok; /**< Flag that the last message had good CRC */
|
||||||
size_t n_crc_fail; /**< Counter for CRC failures */
|
size_t n_crc_fail; /**< Counter for CRC failures */
|
||||||
bool init; /**< Initial state flag. When true, initial bits
|
bool init; /**< Initial state flag. When true, initial bits
|
||||||
* do not produce output. */
|
* do not produce output. */
|
||||||
} cnav_v27_part_t;
|
} cnav_v27_part_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,18 +37,18 @@ public:
|
|||||||
~Tlm_CRC_Stats();
|
~Tlm_CRC_Stats();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize the telemetry CRC statistics
|
* \brief Initialize the telemetry CRC statistics
|
||||||
*/
|
*/
|
||||||
void initialize(std::string dump_crc_stats_filename_);
|
void initialize(std::string dump_crc_stats_filename_);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize the channel number and output file
|
* \brief Initialize the channel number and output file
|
||||||
*/
|
*/
|
||||||
bool set_channel(int32_t channel_);
|
bool set_channel(int32_t channel_);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Update the CRC statistics
|
* \brief Update the CRC statistics
|
||||||
*/
|
*/
|
||||||
void update_CRC_stats(bool CRC);
|
void update_CRC_stats(bool CRC);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -570,9 +570,9 @@ static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td,
|
|||||||
else if (state == ST_DIGITS)
|
else if (state == ST_DIGITS)
|
||||||
{
|
{
|
||||||
/* The colon here means that we have
|
/* The colon here means that we have
|
||||||
* decoded the first two hexadecimal
|
* decoded the first two hexadecimal
|
||||||
* places as a decimal value.
|
* places as a decimal value.
|
||||||
* Switch decoding mode. */
|
* Switch decoding mode. */
|
||||||
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
||||||
if (INTEGER_st_prealloc(st,
|
if (INTEGER_st_prealloc(st,
|
||||||
(chunk_size / 3) + 1))
|
(chunk_size / 3) + 1))
|
||||||
|
@ -224,8 +224,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* Check tags.
|
* Check tags.
|
||||||
*/
|
*/
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size,
|
||||||
tag_mode, -1, &ctx->left, &tlv_constr);
|
tag_mode, -1, &ctx->left, &tlv_constr);
|
||||||
if (rval.code != RC_OK)
|
if (rval.code != RC_OK)
|
||||||
@ -236,8 +236,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (tlv_constr)
|
if (tlv_constr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Complex operation, requires stack of expectations.
|
* Complex operation, requires stack of expectations.
|
||||||
*/
|
*/
|
||||||
ctx->ptr = new_stack();
|
ctx->ptr = new_stack();
|
||||||
if (ctx->ptr)
|
if (ctx->ptr)
|
||||||
{
|
{
|
||||||
@ -251,8 +251,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Jump into stackless primitive decoding.
|
* Jump into stackless primitive decoding.
|
||||||
*/
|
*/
|
||||||
_CH_PHASE(ctx, 3);
|
_CH_PHASE(ctx, 3);
|
||||||
if (type_variant == ASN_OSUBV_ANY && tag_mode != 1)
|
if (type_variant == ASN_OSUBV_ANY && tag_mode != 1)
|
||||||
{
|
{
|
||||||
@ -267,8 +267,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case 1:
|
case 1:
|
||||||
phase1:
|
phase1:
|
||||||
/*
|
/*
|
||||||
* Fill the stack with expectations.
|
* Fill the stack with expectations.
|
||||||
*/
|
*/
|
||||||
stck = (struct stack *)ctx->ptr;
|
stck = (struct stack *)ctx->ptr;
|
||||||
sel = stck->cur_ptr;
|
sel = stck->cur_ptr;
|
||||||
do
|
do
|
||||||
@ -383,9 +383,9 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up expected tags,
|
* Set up expected tags,
|
||||||
* depending on ASN.1 type being decoded.
|
* depending on ASN.1 type being decoded.
|
||||||
*/
|
*/
|
||||||
switch (type_variant)
|
switch (type_variant)
|
||||||
{
|
{
|
||||||
case ASN_OSUBV_BIT:
|
case ASN_OSUBV_BIT:
|
||||||
@ -444,8 +444,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Append a new expectation.
|
* Append a new expectation.
|
||||||
*/
|
*/
|
||||||
sel = OS__add_stack_el(stck);
|
sel = OS__add_stack_el(stck);
|
||||||
if (!sel)
|
if (!sel)
|
||||||
{
|
{
|
||||||
@ -548,8 +548,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case 3:
|
case 3:
|
||||||
phase3:
|
phase3:
|
||||||
/*
|
/*
|
||||||
* Primitive form, no stack required.
|
* Primitive form, no stack required.
|
||||||
*/
|
*/
|
||||||
assert(ctx->left >= 0);
|
assert(ctx->left >= 0);
|
||||||
|
|
||||||
if (size < (size_t)ctx->left)
|
if (size < (size_t)ctx->left)
|
||||||
@ -1513,8 +1513,8 @@ static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf,
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} /* FATAL: can't have constrained
|
} /* FATAL: can't have constrained
|
||||||
* UniversalString with more than
|
* UniversalString with more than
|
||||||
* 16 million code points */
|
* 16 million code points */
|
||||||
for (; buf < end; buf += bpc)
|
for (; buf < end; buf += bpc)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
@ -289,26 +289,26 @@ asn_dec_rval_t xer_decode_primitive(
|
|||||||
"Primitive body is not recognized, "
|
"Primitive body is not recognized, "
|
||||||
"supplying empty one");
|
"supplying empty one");
|
||||||
/*
|
/*
|
||||||
* Decoding opportunity has come and gone.
|
* Decoding opportunity has come and gone.
|
||||||
* Where's the result?
|
* Where's the result?
|
||||||
* Try to feed with empty body, see if it eats it.
|
* Try to feed with empty body, see if it eats it.
|
||||||
*/
|
*/
|
||||||
if (prim_body_decoder(s_arg.type_descriptor,
|
if (prim_body_decoder(s_arg.type_descriptor,
|
||||||
s_arg.struct_key, &ch,
|
s_arg.struct_key, &ch,
|
||||||
0) != XPBD_BODY_CONSUMED)
|
0) != XPBD_BODY_CONSUMED)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This decoder does not like empty stuff.
|
* This decoder does not like empty stuff.
|
||||||
*/
|
*/
|
||||||
_ASN_DECODE_FAILED;
|
_ASN_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RC_WMORE:
|
case RC_WMORE:
|
||||||
/*
|
/*
|
||||||
* Redo the whole thing later.
|
* Redo the whole thing later.
|
||||||
* We don't have a context to save intermediate parsing state.
|
* We don't have a context to save intermediate parsing state.
|
||||||
*/
|
*/
|
||||||
rc.consumed = 0;
|
rc.consumed = 0;
|
||||||
break;
|
break;
|
||||||
case RC_FAIL:
|
case RC_FAIL:
|
||||||
|
@ -164,10 +164,10 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (tag_mode || td->tags_count)
|
if (tag_mode || td->tags_count)
|
||||||
{
|
{
|
||||||
@ -200,8 +200,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len);
|
ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len);
|
||||||
switch (tag_len)
|
switch (tag_len)
|
||||||
@ -228,8 +228,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (t2m)
|
if (t2m)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found the element corresponding to the tag.
|
* Found the element corresponding to the tag.
|
||||||
*/
|
*/
|
||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
ctx->step = t2m->el_no;
|
ctx->step = t2m->el_no;
|
||||||
break;
|
break;
|
||||||
@ -275,9 +275,9 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
/*
|
/*
|
||||||
* PHASE 2.
|
* PHASE 2.
|
||||||
* Read in the element.
|
* Read in the element.
|
||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
asn_TYPE_member_t *elm; /* CHOICE's element */
|
asn_TYPE_member_t *elm; /* CHOICE's element */
|
||||||
@ -287,10 +287,10 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
elm = &elements[ctx->step];
|
elm = &elements[ctx->step];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the position of the member inside a
|
* Compute the position of the member inside a
|
||||||
* structure, and also a type of containment (it may be
|
* structure, and also a type of containment (it may be
|
||||||
* contained as pointer or using inline inclusion).
|
* contained as pointer or using inline inclusion).
|
||||||
*/
|
*/
|
||||||
if (elm->flags & ATF_POINTER)
|
if (elm->flags & ATF_POINTER)
|
||||||
{
|
{
|
||||||
/* Member is a pointer to another structure */
|
/* Member is a pointer to another structure */
|
||||||
@ -300,20 +300,20 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* A pointer to a pointer
|
* A pointer to a pointer
|
||||||
* holding the start of the structure
|
* holding the start of the structure
|
||||||
*/
|
*/
|
||||||
memb_ptr = (char *)st + elm->memb_offset;
|
memb_ptr = (char *)st + elm->memb_offset;
|
||||||
memb_ptr2 = &memb_ptr;
|
memb_ptr2 = &memb_ptr;
|
||||||
}
|
}
|
||||||
/* Set presence to be able to free it properly at any
|
/* Set presence to be able to free it properly at any
|
||||||
* time */
|
* time */
|
||||||
set_present_idx(st, specs->pres_offset,
|
set_present_idx(st, specs->pres_offset,
|
||||||
specs->pres_size, ctx->step + 1);
|
specs->pres_size, ctx->step + 1);
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
||||||
memb_ptr2, ptr, LEFT,
|
memb_ptr2, ptr, LEFT,
|
||||||
elm->tag_mode);
|
elm->tag_mode);
|
||||||
@ -347,27 +347,27 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (ctx->left > 0)
|
if (ctx->left > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The type must be fully decoded
|
* The type must be fully decoded
|
||||||
* by the CHOICE member-specific decoder.
|
* by the CHOICE member-specific decoder.
|
||||||
*/
|
*/
|
||||||
RETURN(RC_FAIL);
|
RETURN(RC_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->left == -1 && !(tag_mode || td->tags_count))
|
if (ctx->left == -1 && !(tag_mode || td->tags_count))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is an untagged CHOICE.
|
* This is an untagged CHOICE.
|
||||||
* It doesn't contain nothing
|
* It doesn't contain nothing
|
||||||
* except for the member itself, including all its tags.
|
* except for the member itself, including all its tags.
|
||||||
* The decoding is completed.
|
* The decoding is completed.
|
||||||
*/
|
*/
|
||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read in the "end of data chunks"'s.
|
* Read in the "end of data chunks"'s.
|
||||||
*/
|
*/
|
||||||
while (ctx->left < 0)
|
while (ctx->left < 0)
|
||||||
{
|
{
|
||||||
ssize_t tl;
|
ssize_t tl;
|
||||||
@ -386,8 +386,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expected <0><0>...
|
* Expected <0><0>...
|
||||||
*/
|
*/
|
||||||
if (((const uint8_t *)ptr)[0] == 0)
|
if (((const uint8_t *)ptr)[0] == 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -404,8 +404,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Correctly finished with <0><0>.
|
* Correctly finished with <0><0>.
|
||||||
*/
|
*/
|
||||||
ADVANCE(2);
|
ADVANCE(2);
|
||||||
ctx->left++;
|
ctx->left++;
|
||||||
continue;
|
continue;
|
||||||
@ -852,8 +852,8 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search which inner member corresponds to this tag.
|
* Search which inner member corresponds to this tag.
|
||||||
*/
|
*/
|
||||||
for (edx = 0; edx < td->elements_count; edx++)
|
for (edx = 0; edx < td->elements_count; edx++)
|
||||||
{
|
{
|
||||||
elm = &td->elements[edx];
|
elm = &td->elements[edx];
|
||||||
@ -864,8 +864,8 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case XCT_BOTH:
|
case XCT_BOTH:
|
||||||
case XCT_OPENING:
|
case XCT_OPENING:
|
||||||
/*
|
/*
|
||||||
* Process this member.
|
* Process this member.
|
||||||
*/
|
*/
|
||||||
ctx->step = edx;
|
ctx->step = edx;
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
break;
|
break;
|
||||||
@ -888,10 +888,10 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
ASN_DEBUG("Got anticipated extension");
|
ASN_DEBUG("Got anticipated extension");
|
||||||
/*
|
/*
|
||||||
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
||||||
* By using a mask. Only record a pure
|
* By using a mask. Only record a pure
|
||||||
* <opening> tags.
|
* <opening> tags.
|
||||||
*/
|
*/
|
||||||
if (tcv & XCT_CLOSING)
|
if (tcv & XCT_CLOSING)
|
||||||
{
|
{
|
||||||
/* Found </extension> without body */
|
/* Found </extension> without body */
|
||||||
|
@ -178,10 +178,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
||||||
tag_mode, 1, &ctx->left, 0);
|
tag_mode, 1, &ctx->left, 0);
|
||||||
@ -206,15 +206,15 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* PHASE 1.
|
* PHASE 1.
|
||||||
* From the place where we've left it previously,
|
* From the place where we've left it previously,
|
||||||
* try to decode the next member from the list of
|
* try to decode the next member from the list of
|
||||||
* this structure's elements.
|
* this structure's elements.
|
||||||
* (ctx->step) stores the member being processed
|
* (ctx->step) stores the member being processed
|
||||||
* between invocations and the microphase {0,1} of parsing
|
* between invocations and the microphase {0,1} of parsing
|
||||||
* that member:
|
* that member:
|
||||||
* step = (<member_number> * 2 + <microphase>).
|
* step = (<member_number> * 2 + <microphase>).
|
||||||
*/
|
*/
|
||||||
for (edx = (ctx->step >> 1); edx < td->elements_count;
|
for (edx = (ctx->step >> 1); edx < td->elements_count;
|
||||||
edx++, ctx->step = (ctx->step & ~1) + 2)
|
edx++, ctx->step = (ctx->step & ~1) + 2)
|
||||||
{
|
{
|
||||||
@ -231,8 +231,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 1: Synchronize decoding.
|
* MICROPHASE 1: Synchronize decoding.
|
||||||
*/
|
*/
|
||||||
ASN_DEBUG(
|
ASN_DEBUG(
|
||||||
"In %s SEQUENCE left %d, edx=%d flags=%d"
|
"In %s SEQUENCE left %d, edx=%d flags=%d"
|
||||||
" opt=%d ec=%d",
|
" opt=%d ec=%d",
|
||||||
@ -251,15 +251,15 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
ASN_DEBUG("End of SEQUENCE %s", td->name);
|
ASN_DEBUG("End of SEQUENCE %s", td->name);
|
||||||
/*
|
/*
|
||||||
* Found the legitimate end of the structure.
|
* Found the legitimate end of the structure.
|
||||||
*/
|
*/
|
||||||
PHASE_OUT(ctx);
|
PHASE_OUT(ctx);
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
ASN_DEBUG(
|
ASN_DEBUG(
|
||||||
"Current tag in %s SEQUENCE for element %d "
|
"Current tag in %s SEQUENCE for element %d "
|
||||||
@ -304,23 +304,23 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
td->elements_count))
|
td->elements_count))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Yeah, baby! Found the
|
* Yeah, baby! Found the
|
||||||
* terminator of the indefinite
|
* terminator of the indefinite
|
||||||
* length structure.
|
* length structure.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Proceed to the canonical
|
* Proceed to the canonical
|
||||||
* finalization function.
|
* finalization function.
|
||||||
* No advancing is necessary.
|
* No advancing is necessary.
|
||||||
*/
|
*/
|
||||||
goto phase3;
|
goto phase3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the next available type with this tag.
|
* Find the next available type with this tag.
|
||||||
*/
|
*/
|
||||||
use_bsearch = 0;
|
use_bsearch = 0;
|
||||||
opt_edx_end = edx + elements[edx].optional + 1;
|
opt_edx_end = edx + elements[edx].optional + 1;
|
||||||
if (opt_edx_end > td->elements_count)
|
if (opt_edx_end > td->elements_count)
|
||||||
@ -339,10 +339,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag))
|
if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found element corresponding to the
|
* Found element corresponding to the
|
||||||
* tag being looked at. Reposition over
|
* tag being looked at. Reposition over
|
||||||
* the right element.
|
* the right element.
|
||||||
*/
|
*/
|
||||||
edx = n;
|
edx = n;
|
||||||
ctx->step = 1 + 2 * edx; /* Remember! */
|
ctx->step = 1 + 2 * edx; /* Remember! */
|
||||||
goto microphase2;
|
goto microphase2;
|
||||||
@ -350,9 +350,9 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (elements[n].flags & ATF_OPEN_TYPE)
|
else if (elements[n].flags & ATF_OPEN_TYPE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is the ANY type, which may bear
|
* This is the ANY type, which may bear
|
||||||
* any flag whatsoever.
|
* any flag whatsoever.
|
||||||
*/
|
*/
|
||||||
edx = n;
|
edx = n;
|
||||||
ctx->step = 1 + 2 * edx; /* Remember! */
|
ctx->step = 1 + 2 * edx; /* Remember! */
|
||||||
goto microphase2;
|
goto microphase2;
|
||||||
@ -366,9 +366,9 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (use_bsearch)
|
if (use_bsearch)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resort to a binary search over
|
* Resort to a binary search over
|
||||||
* sorted array of tags.
|
* sorted array of tags.
|
||||||
*/
|
*/
|
||||||
asn_TYPE_tag2member_t *t2m;
|
asn_TYPE_tag2member_t *t2m;
|
||||||
asn_TYPE_tag2member_t key;
|
asn_TYPE_tag2member_t key;
|
||||||
key.el_tag = tlv_tag;
|
key.el_tag = tlv_tag;
|
||||||
@ -384,10 +384,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
int edx_max =
|
int edx_max =
|
||||||
edx + elements[edx].optional;
|
edx + elements[edx].optional;
|
||||||
/*
|
/*
|
||||||
* Rewind to the first element with that
|
* Rewind to the first element with that
|
||||||
* tag, `cause bsearch() does not
|
* tag, `cause bsearch() does not
|
||||||
* guarantee order.
|
* guarantee order.
|
||||||
*/
|
*/
|
||||||
t2m_f = t2m + t2m->toff_first;
|
t2m_f = t2m + t2m->toff_first;
|
||||||
t2m_l = t2m + t2m->toff_last;
|
t2m_l = t2m + t2m->toff_last;
|
||||||
for (t2m = t2m_f; t2m <= t2m_l; t2m++)
|
for (t2m = t2m_f; t2m <= t2m_l; t2m++)
|
||||||
@ -414,11 +414,11 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (n == opt_edx_end)
|
if (n == opt_edx_end)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If tag is unknown, it may be either
|
* If tag is unknown, it may be either
|
||||||
* an unknown (thus, incorrect) tag,
|
* an unknown (thus, incorrect) tag,
|
||||||
* or an extension (...),
|
* or an extension (...),
|
||||||
* or an end of the indefinite-length structure.
|
* or an end of the indefinite-length structure.
|
||||||
*/
|
*/
|
||||||
if (!IN_EXTENSION_GROUP(
|
if (!IN_EXTENSION_GROUP(
|
||||||
specs, edx + elements[edx].optional))
|
specs, edx + elements[edx].optional))
|
||||||
{
|
{
|
||||||
@ -466,22 +466,22 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
ctx->step -= 2;
|
ctx->step -= 2;
|
||||||
edx--;
|
edx--;
|
||||||
continue; /* Try again with the next tag
|
continue; /* Try again with the next tag
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 2: Invoke the member-specific decoder.
|
* MICROPHASE 2: Invoke the member-specific decoder.
|
||||||
*/
|
*/
|
||||||
ctx->step |= 1; /* Confirm entering next microphase */
|
ctx->step |= 1; /* Confirm entering next microphase */
|
||||||
microphase2:
|
microphase2:
|
||||||
ASN_DEBUG("Inside SEQUENCE %s MF2", td->name);
|
ASN_DEBUG("Inside SEQUENCE %s MF2", td->name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the position of the member inside a
|
* Compute the position of the member inside a
|
||||||
* structure, and also a type of containment (it may be
|
* structure, and also a type of containment (it may be
|
||||||
* contained as pointer or using inline inclusion).
|
* contained as pointer or using inline inclusion).
|
||||||
*/
|
*/
|
||||||
if (elements[edx].flags & ATF_POINTER)
|
if (elements[edx].flags & ATF_POINTER)
|
||||||
{
|
{
|
||||||
/* Member is a pointer to another structure */
|
/* Member is a pointer to another structure */
|
||||||
@ -492,17 +492,17 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* A pointer to a pointer
|
* A pointer to a pointer
|
||||||
* holding the start of the structure
|
* holding the start of the structure
|
||||||
*/
|
*/
|
||||||
memb_ptr =
|
memb_ptr =
|
||||||
(char *)st + elements[edx].memb_offset;
|
(char *)st + elements[edx].memb_offset;
|
||||||
memb_ptr2 = &memb_ptr;
|
memb_ptr2 = &memb_ptr;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elements[edx].type->ber_decoder(
|
rval = elements[edx].type->ber_decoder(
|
||||||
opt_codec_ctx, elements[edx].type, memb_ptr2, ptr,
|
opt_codec_ctx, elements[edx].type, memb_ptr2, ptr,
|
||||||
LEFT, elements[edx].tag_mode);
|
LEFT, elements[edx].tag_mode);
|
||||||
@ -541,8 +541,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
(long)ctx->left, (long)size);
|
(long)ctx->left, (long)size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip everything until the end of the SEQUENCE.
|
* Skip everything until the end of the SEQUENCE.
|
||||||
*/
|
*/
|
||||||
while (ctx->left)
|
while (ctx->left)
|
||||||
{
|
{
|
||||||
ssize_t tl;
|
ssize_t tl;
|
||||||
@ -562,8 +562,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If expected <0><0>...
|
* If expected <0><0>...
|
||||||
*/
|
*/
|
||||||
if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0)
|
if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -580,8 +580,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Correctly finished with <0><0>.
|
* Correctly finished with <0><0>.
|
||||||
*/
|
*/
|
||||||
ADVANCE(2);
|
ADVANCE(2);
|
||||||
ctx->left++;
|
ctx->left++;
|
||||||
ctx->phase = 4;
|
ctx->phase = 4;
|
||||||
@ -724,8 +724,8 @@ asn_enc_rval_t SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
|
|||||||
if (computed_size != 0)
|
if (computed_size != 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Encoded size is not equal to the computed size.
|
* Encoded size is not equal to the computed size.
|
||||||
*/
|
*/
|
||||||
_ASN_ENCODE_FAILED;
|
_ASN_ENCODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
if (edx >= td->elements_count ||
|
if (edx >= td->elements_count ||
|
||||||
/* Explicit OPTIONAL specs reaches the end
|
/* Explicit OPTIONAL specs reaches the end
|
||||||
*/
|
*/
|
||||||
(edx + elements[edx].optional ==
|
(edx + elements[edx].optional ==
|
||||||
td->elements_count) ||
|
td->elements_count) ||
|
||||||
/* All extensions are optional */
|
/* All extensions are optional */
|
||||||
@ -942,8 +942,8 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (edx < td->elements_count)
|
if (edx < td->elements_count)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Search which member corresponds to this tag.
|
* Search which member corresponds to this tag.
|
||||||
*/
|
*/
|
||||||
edx_end = edx + elements[edx].optional + 1;
|
edx_end = edx + elements[edx].optional + 1;
|
||||||
if (edx_end > td->elements_count)
|
if (edx_end > td->elements_count)
|
||||||
{
|
{
|
||||||
@ -959,8 +959,8 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case XCT_BOTH:
|
case XCT_BOTH:
|
||||||
case XCT_OPENING:
|
case XCT_OPENING:
|
||||||
/*
|
/*
|
||||||
* Process this member.
|
* Process this member.
|
||||||
*/
|
*/
|
||||||
ctx->step = edx = n;
|
ctx->step = edx = n;
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
break;
|
break;
|
||||||
@ -993,10 +993,10 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
ASN_DEBUG("Got anticipated extension at %d",
|
ASN_DEBUG("Got anticipated extension at %d",
|
||||||
edx);
|
edx);
|
||||||
/*
|
/*
|
||||||
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
||||||
* By using a mask. Only record a pure
|
* By using a mask. Only record a pure
|
||||||
* <opening> tags.
|
* <opening> tags.
|
||||||
*/
|
*/
|
||||||
if (tcv & XCT_CLOSING)
|
if (tcv & XCT_CLOSING)
|
||||||
{
|
{
|
||||||
/* Found </extension> without body */
|
/* Found </extension> without body */
|
||||||
|
@ -124,10 +124,10 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
||||||
tag_mode, 1, &ctx->left, 0);
|
tag_mode, 1, &ctx->left, 0);
|
||||||
@ -153,10 +153,10 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* PHASE 1.
|
* PHASE 1.
|
||||||
* From the place where we've left it previously,
|
* From the place where we've left it previously,
|
||||||
* try to decode the next item.
|
* try to decode the next item.
|
||||||
*/
|
*/
|
||||||
for (;; ctx->step = 0)
|
for (;; ctx->step = 0)
|
||||||
{
|
{
|
||||||
ssize_t tag_len; /* Length of TLV's T */
|
ssize_t tag_len; /* Length of TLV's T */
|
||||||
@ -167,23 +167,23 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 1: Synchronize decoding.
|
* MICROPHASE 1: Synchronize decoding.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ctx->left == 0)
|
if (ctx->left == 0)
|
||||||
{
|
{
|
||||||
ASN_DEBUG("End of SET OF %s", td->name);
|
ASN_DEBUG("End of SET OF %s", td->name);
|
||||||
/*
|
/*
|
||||||
* No more things to decode.
|
* No more things to decode.
|
||||||
* Exit out of here.
|
* Exit out of here.
|
||||||
*/
|
*/
|
||||||
PHASE_OUT(ctx);
|
PHASE_OUT(ctx);
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
switch (tag_len)
|
switch (tag_len)
|
||||||
{
|
{
|
||||||
@ -213,23 +213,23 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found the terminator of the
|
* Found the terminator of the
|
||||||
* indefinite length structure.
|
* indefinite length structure.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Outmost tag may be unknown and cannot be
|
/* Outmost tag may be unknown and cannot be
|
||||||
* fetched/compared */
|
* fetched/compared */
|
||||||
if (elm->tag != (ber_tlv_tag_t)-1)
|
if (elm->tag != (ber_tlv_tag_t)-1)
|
||||||
{
|
{
|
||||||
if (BER_TAGS_EQUAL(tlv_tag, elm->tag))
|
if (BER_TAGS_EQUAL(tlv_tag, elm->tag))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The new list member of expected type
|
* The new list member of expected type
|
||||||
* has arrived.
|
* has arrived.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -245,15 +245,15 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 2: Invoke the member-specific decoder.
|
* MICROPHASE 2: Invoke the member-specific decoder.
|
||||||
*/
|
*/
|
||||||
ctx->step |= 1; /* Confirm entering next microphase */
|
ctx->step |= 1; /* Confirm entering next microphase */
|
||||||
microphase2:
|
microphase2:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
||||||
&ctx->ptr, ptr, LEFT, 0);
|
&ctx->ptr, ptr, LEFT, 0);
|
||||||
ASN_DEBUG("In %s SET OF %s code %d consumed %d",
|
ASN_DEBUG("In %s SET OF %s code %d consumed %d",
|
||||||
@ -294,8 +294,8 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
case 2:
|
case 2:
|
||||||
/*
|
/*
|
||||||
* Read in all "end of content" TLVs.
|
* Read in all "end of content" TLVs.
|
||||||
*/
|
*/
|
||||||
while (ctx->left < 0)
|
while (ctx->left < 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -726,8 +726,8 @@ asn_dec_rval_t SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (ctx->phase == 1)
|
if (ctx->phase == 1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Process a single possible member.
|
* Process a single possible member.
|
||||||
*/
|
*/
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -292,12 +292,12 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
if (ctx->phase == 0)
|
if (ctx->phase == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We have to ignore whitespace
|
* We have to ignore whitespace
|
||||||
* here, but in order to be forward
|
* here, but in order to be forward
|
||||||
* compatible with EXTENDED-XER
|
* compatible with EXTENDED-XER
|
||||||
* (EMBED-VALUES, #25) any text is
|
* (EMBED-VALUES, #25) any text is
|
||||||
* just ignored here.
|
* just ignored here.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -351,8 +351,8 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
case XCT_UNKNOWN_BO:
|
case XCT_UNKNOWN_BO:
|
||||||
/*
|
/*
|
||||||
* Certain tags in the body may be expected.
|
* Certain tags in the body may be expected.
|
||||||
*/
|
*/
|
||||||
if (opt_unexpected_tag_decoder &&
|
if (opt_unexpected_tag_decoder &&
|
||||||
opt_unexpected_tag_decoder(struct_key, buf_ptr,
|
opt_unexpected_tag_decoder(struct_key, buf_ptr,
|
||||||
ch_size) >= 0)
|
ch_size) >= 0)
|
||||||
@ -362,7 +362,7 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
if (!ctx->phase)
|
if (!ctx->phase)
|
||||||
{
|
{
|
||||||
/* We are not expecting
|
/* We are not expecting
|
||||||
* the closing tag anymore. */
|
* the closing tag anymore. */
|
||||||
ctx->phase = 2; /* Phase out */
|
ctx->phase = 2; /* Phase out */
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
@ -390,11 +390,11 @@ int xer_is_whitespace(const void *chunk_buf, size_t chunk_size)
|
|||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
/* X.693, #8.1.4
|
/* X.693, #8.1.4
|
||||||
* HORISONTAL TAB (9)
|
* HORISONTAL TAB (9)
|
||||||
* LINE FEED (10)
|
* LINE FEED (10)
|
||||||
* CARRIAGE RETURN (13)
|
* CARRIAGE RETURN (13)
|
||||||
* SPACE (32)
|
* SPACE (32)
|
||||||
*/
|
*/
|
||||||
case 0x09:
|
case 0x09:
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
|
@ -103,9 +103,9 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
{
|
{
|
||||||
case ST_TEXT:
|
case ST_TEXT:
|
||||||
/*
|
/*
|
||||||
* Initial state: we're in the middle of some text,
|
* Initial state: we're in the middle of some text,
|
||||||
* or just have started.
|
* or just have started.
|
||||||
*/
|
*/
|
||||||
if (C == LANGLE)
|
if (C == LANGLE)
|
||||||
{ /* We're now in the tag, probably */
|
{ /* We're now in the tag, probably */
|
||||||
TOKEN_CB(PXML_TEXT, ST_TAG_START, 0);
|
TOKEN_CB(PXML_TEXT, ST_TAG_START, 0);
|
||||||
@ -138,10 +138,10 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case LANGLE:
|
case LANGLE:
|
||||||
/*
|
/*
|
||||||
* The previous tag wasn't completed, but
|
* The previous tag wasn't completed, but
|
||||||
* still recognized as valid.
|
* still recognized as valid.
|
||||||
* (Mozilla-compatible)
|
* (Mozilla-compatible)
|
||||||
*/
|
*/
|
||||||
TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0);
|
TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0);
|
||||||
break;
|
break;
|
||||||
case CEQUAL:
|
case CEQUAL:
|
||||||
@ -151,8 +151,8 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case ST_TAG_QUOTE_WAIT:
|
case ST_TAG_QUOTE_WAIT:
|
||||||
/*
|
/*
|
||||||
* State after the equal sign ("=") in the tag.
|
* State after the equal sign ("=") in the tag.
|
||||||
*/
|
*/
|
||||||
switch (C)
|
switch (C)
|
||||||
{
|
{
|
||||||
case CQUOTE:
|
case CQUOTE:
|
||||||
@ -172,8 +172,8 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case ST_TAG_QUOTED_STRING:
|
case ST_TAG_QUOTED_STRING:
|
||||||
/*
|
/*
|
||||||
* Tag attribute's string value in quotes.
|
* Tag attribute's string value in quotes.
|
||||||
*/
|
*/
|
||||||
if (C == CQUOTE)
|
if (C == CQUOTE)
|
||||||
{
|
{
|
||||||
/* Return back to the tag state */
|
/* Return back to the tag state */
|
||||||
@ -240,7 +240,7 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
else if (C == CDASH)
|
else if (C == CDASH)
|
||||||
{
|
{
|
||||||
/* Maintain current state, still waiting for '>'
|
/* Maintain current state, still waiting for '>'
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -549,8 +549,8 @@ time_t asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value,
|
|||||||
case 0x2C:
|
case 0x2C:
|
||||||
case 0x2E: /* (.|,) */
|
case 0x2E: /* (.|,) */
|
||||||
/*
|
/*
|
||||||
* Process fractions of seconds.
|
* Process fractions of seconds.
|
||||||
*/
|
*/
|
||||||
for (buf++; buf < end; buf++)
|
for (buf++; buf < end; buf++)
|
||||||
{
|
{
|
||||||
int v = *buf;
|
int v = *buf;
|
||||||
|
@ -570,9 +570,9 @@ static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td,
|
|||||||
else if (state == ST_DIGITS)
|
else if (state == ST_DIGITS)
|
||||||
{
|
{
|
||||||
/* The colon here means that we have
|
/* The colon here means that we have
|
||||||
* decoded the first two hexadecimal
|
* decoded the first two hexadecimal
|
||||||
* places as a decimal value.
|
* places as a decimal value.
|
||||||
* Switch decoding mode. */
|
* Switch decoding mode. */
|
||||||
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
||||||
if (INTEGER_st_prealloc(st,
|
if (INTEGER_st_prealloc(st,
|
||||||
(chunk_size / 3) + 1))
|
(chunk_size / 3) + 1))
|
||||||
|
@ -224,8 +224,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* Check tags.
|
* Check tags.
|
||||||
*/
|
*/
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size,
|
||||||
tag_mode, -1, &ctx->left, &tlv_constr);
|
tag_mode, -1, &ctx->left, &tlv_constr);
|
||||||
if (rval.code != RC_OK)
|
if (rval.code != RC_OK)
|
||||||
@ -236,8 +236,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (tlv_constr)
|
if (tlv_constr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Complex operation, requires stack of expectations.
|
* Complex operation, requires stack of expectations.
|
||||||
*/
|
*/
|
||||||
ctx->ptr = new_stack();
|
ctx->ptr = new_stack();
|
||||||
if (ctx->ptr)
|
if (ctx->ptr)
|
||||||
{
|
{
|
||||||
@ -251,8 +251,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Jump into stackless primitive decoding.
|
* Jump into stackless primitive decoding.
|
||||||
*/
|
*/
|
||||||
_CH_PHASE(ctx, 3);
|
_CH_PHASE(ctx, 3);
|
||||||
if (type_variant == ASN_OSUBV_ANY && tag_mode != 1)
|
if (type_variant == ASN_OSUBV_ANY && tag_mode != 1)
|
||||||
{
|
{
|
||||||
@ -267,8 +267,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case 1:
|
case 1:
|
||||||
phase1:
|
phase1:
|
||||||
/*
|
/*
|
||||||
* Fill the stack with expectations.
|
* Fill the stack with expectations.
|
||||||
*/
|
*/
|
||||||
stck = (struct stack *)ctx->ptr;
|
stck = (struct stack *)ctx->ptr;
|
||||||
sel = stck->cur_ptr;
|
sel = stck->cur_ptr;
|
||||||
do
|
do
|
||||||
@ -383,9 +383,9 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up expected tags,
|
* Set up expected tags,
|
||||||
* depending on ASN.1 type being decoded.
|
* depending on ASN.1 type being decoded.
|
||||||
*/
|
*/
|
||||||
switch (type_variant)
|
switch (type_variant)
|
||||||
{
|
{
|
||||||
case ASN_OSUBV_BIT:
|
case ASN_OSUBV_BIT:
|
||||||
@ -444,8 +444,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Append a new expectation.
|
* Append a new expectation.
|
||||||
*/
|
*/
|
||||||
sel = OS__add_stack_el(stck);
|
sel = OS__add_stack_el(stck);
|
||||||
if (!sel)
|
if (!sel)
|
||||||
{
|
{
|
||||||
@ -548,8 +548,8 @@ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case 3:
|
case 3:
|
||||||
phase3:
|
phase3:
|
||||||
/*
|
/*
|
||||||
* Primitive form, no stack required.
|
* Primitive form, no stack required.
|
||||||
*/
|
*/
|
||||||
assert(ctx->left >= 0);
|
assert(ctx->left >= 0);
|
||||||
|
|
||||||
if (size < (size_t)ctx->left)
|
if (size < (size_t)ctx->left)
|
||||||
@ -1513,8 +1513,8 @@ static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf,
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} /* FATAL: can't have constrained
|
} /* FATAL: can't have constrained
|
||||||
* UniversalString with more than
|
* UniversalString with more than
|
||||||
* 16 million code points */
|
* 16 million code points */
|
||||||
for (; buf < end; buf += bpc)
|
for (; buf < end; buf += bpc)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
@ -289,26 +289,26 @@ asn_dec_rval_t xer_decode_primitive(
|
|||||||
"Primitive body is not recognized, "
|
"Primitive body is not recognized, "
|
||||||
"supplying empty one");
|
"supplying empty one");
|
||||||
/*
|
/*
|
||||||
* Decoding opportunity has come and gone.
|
* Decoding opportunity has come and gone.
|
||||||
* Where's the result?
|
* Where's the result?
|
||||||
* Try to feed with empty body, see if it eats it.
|
* Try to feed with empty body, see if it eats it.
|
||||||
*/
|
*/
|
||||||
if (prim_body_decoder(s_arg.type_descriptor,
|
if (prim_body_decoder(s_arg.type_descriptor,
|
||||||
s_arg.struct_key, &ch,
|
s_arg.struct_key, &ch,
|
||||||
0) != XPBD_BODY_CONSUMED)
|
0) != XPBD_BODY_CONSUMED)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This decoder does not like empty stuff.
|
* This decoder does not like empty stuff.
|
||||||
*/
|
*/
|
||||||
_ASN_DECODE_FAILED;
|
_ASN_DECODE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RC_WMORE:
|
case RC_WMORE:
|
||||||
/*
|
/*
|
||||||
* Redo the whole thing later.
|
* Redo the whole thing later.
|
||||||
* We don't have a context to save intermediate parsing state.
|
* We don't have a context to save intermediate parsing state.
|
||||||
*/
|
*/
|
||||||
rc.consumed = 0;
|
rc.consumed = 0;
|
||||||
break;
|
break;
|
||||||
case RC_FAIL:
|
case RC_FAIL:
|
||||||
|
@ -164,10 +164,10 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (tag_mode || td->tags_count)
|
if (tag_mode || td->tags_count)
|
||||||
{
|
{
|
||||||
@ -200,8 +200,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len);
|
ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len);
|
||||||
switch (tag_len)
|
switch (tag_len)
|
||||||
@ -228,8 +228,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (t2m)
|
if (t2m)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found the element corresponding to the tag.
|
* Found the element corresponding to the tag.
|
||||||
*/
|
*/
|
||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
ctx->step = t2m->el_no;
|
ctx->step = t2m->el_no;
|
||||||
break;
|
break;
|
||||||
@ -275,9 +275,9 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
/*
|
/*
|
||||||
* PHASE 2.
|
* PHASE 2.
|
||||||
* Read in the element.
|
* Read in the element.
|
||||||
*/
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
asn_TYPE_member_t *elm; /* CHOICE's element */
|
asn_TYPE_member_t *elm; /* CHOICE's element */
|
||||||
@ -287,10 +287,10 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
elm = &elements[ctx->step];
|
elm = &elements[ctx->step];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the position of the member inside a
|
* Compute the position of the member inside a
|
||||||
* structure, and also a type of containment (it may be
|
* structure, and also a type of containment (it may be
|
||||||
* contained as pointer or using inline inclusion).
|
* contained as pointer or using inline inclusion).
|
||||||
*/
|
*/
|
||||||
if (elm->flags & ATF_POINTER)
|
if (elm->flags & ATF_POINTER)
|
||||||
{
|
{
|
||||||
/* Member is a pointer to another structure */
|
/* Member is a pointer to another structure */
|
||||||
@ -300,20 +300,20 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* A pointer to a pointer
|
* A pointer to a pointer
|
||||||
* holding the start of the structure
|
* holding the start of the structure
|
||||||
*/
|
*/
|
||||||
memb_ptr = (char *)st + elm->memb_offset;
|
memb_ptr = (char *)st + elm->memb_offset;
|
||||||
memb_ptr2 = &memb_ptr;
|
memb_ptr2 = &memb_ptr;
|
||||||
}
|
}
|
||||||
/* Set presence to be able to free it properly at any
|
/* Set presence to be able to free it properly at any
|
||||||
* time */
|
* time */
|
||||||
set_present_idx(st, specs->pres_offset,
|
set_present_idx(st, specs->pres_offset,
|
||||||
specs->pres_size, ctx->step + 1);
|
specs->pres_size, ctx->step + 1);
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
||||||
memb_ptr2, ptr, LEFT,
|
memb_ptr2, ptr, LEFT,
|
||||||
elm->tag_mode);
|
elm->tag_mode);
|
||||||
@ -347,27 +347,27 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (ctx->left > 0)
|
if (ctx->left > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The type must be fully decoded
|
* The type must be fully decoded
|
||||||
* by the CHOICE member-specific decoder.
|
* by the CHOICE member-specific decoder.
|
||||||
*/
|
*/
|
||||||
RETURN(RC_FAIL);
|
RETURN(RC_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->left == -1 && !(tag_mode || td->tags_count))
|
if (ctx->left == -1 && !(tag_mode || td->tags_count))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is an untagged CHOICE.
|
* This is an untagged CHOICE.
|
||||||
* It doesn't contain nothing
|
* It doesn't contain nothing
|
||||||
* except for the member itself, including all its tags.
|
* except for the member itself, including all its tags.
|
||||||
* The decoding is completed.
|
* The decoding is completed.
|
||||||
*/
|
*/
|
||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read in the "end of data chunks"'s.
|
* Read in the "end of data chunks"'s.
|
||||||
*/
|
*/
|
||||||
while (ctx->left < 0)
|
while (ctx->left < 0)
|
||||||
{
|
{
|
||||||
ssize_t tl;
|
ssize_t tl;
|
||||||
@ -386,8 +386,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expected <0><0>...
|
* Expected <0><0>...
|
||||||
*/
|
*/
|
||||||
if (((const uint8_t *)ptr)[0] == 0)
|
if (((const uint8_t *)ptr)[0] == 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -404,8 +404,8 @@ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Correctly finished with <0><0>.
|
* Correctly finished with <0><0>.
|
||||||
*/
|
*/
|
||||||
ADVANCE(2);
|
ADVANCE(2);
|
||||||
ctx->left++;
|
ctx->left++;
|
||||||
continue;
|
continue;
|
||||||
@ -852,8 +852,8 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search which inner member corresponds to this tag.
|
* Search which inner member corresponds to this tag.
|
||||||
*/
|
*/
|
||||||
for (edx = 0; edx < td->elements_count; edx++)
|
for (edx = 0; edx < td->elements_count; edx++)
|
||||||
{
|
{
|
||||||
elm = &td->elements[edx];
|
elm = &td->elements[edx];
|
||||||
@ -864,8 +864,8 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case XCT_BOTH:
|
case XCT_BOTH:
|
||||||
case XCT_OPENING:
|
case XCT_OPENING:
|
||||||
/*
|
/*
|
||||||
* Process this member.
|
* Process this member.
|
||||||
*/
|
*/
|
||||||
ctx->step = edx;
|
ctx->step = edx;
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
break;
|
break;
|
||||||
@ -888,10 +888,10 @@ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
ASN_DEBUG("Got anticipated extension");
|
ASN_DEBUG("Got anticipated extension");
|
||||||
/*
|
/*
|
||||||
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
||||||
* By using a mask. Only record a pure
|
* By using a mask. Only record a pure
|
||||||
* <opening> tags.
|
* <opening> tags.
|
||||||
*/
|
*/
|
||||||
if (tcv & XCT_CLOSING)
|
if (tcv & XCT_CLOSING)
|
||||||
{
|
{
|
||||||
/* Found </extension> without body */
|
/* Found </extension> without body */
|
||||||
|
@ -178,10 +178,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
||||||
tag_mode, 1, &ctx->left, 0);
|
tag_mode, 1, &ctx->left, 0);
|
||||||
@ -206,15 +206,15 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* PHASE 1.
|
* PHASE 1.
|
||||||
* From the place where we've left it previously,
|
* From the place where we've left it previously,
|
||||||
* try to decode the next member from the list of
|
* try to decode the next member from the list of
|
||||||
* this structure's elements.
|
* this structure's elements.
|
||||||
* (ctx->step) stores the member being processed
|
* (ctx->step) stores the member being processed
|
||||||
* between invocations and the microphase {0,1} of parsing
|
* between invocations and the microphase {0,1} of parsing
|
||||||
* that member:
|
* that member:
|
||||||
* step = (<member_number> * 2 + <microphase>).
|
* step = (<member_number> * 2 + <microphase>).
|
||||||
*/
|
*/
|
||||||
for (edx = (ctx->step >> 1); edx < td->elements_count;
|
for (edx = (ctx->step >> 1); edx < td->elements_count;
|
||||||
edx++, ctx->step = (ctx->step & ~1) + 2)
|
edx++, ctx->step = (ctx->step & ~1) + 2)
|
||||||
{
|
{
|
||||||
@ -231,8 +231,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 1: Synchronize decoding.
|
* MICROPHASE 1: Synchronize decoding.
|
||||||
*/
|
*/
|
||||||
ASN_DEBUG(
|
ASN_DEBUG(
|
||||||
"In %s SEQUENCE left %d, edx=%d flags=%d"
|
"In %s SEQUENCE left %d, edx=%d flags=%d"
|
||||||
" opt=%d ec=%d",
|
" opt=%d ec=%d",
|
||||||
@ -251,15 +251,15 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
ASN_DEBUG("End of SEQUENCE %s", td->name);
|
ASN_DEBUG("End of SEQUENCE %s", td->name);
|
||||||
/*
|
/*
|
||||||
* Found the legitimate end of the structure.
|
* Found the legitimate end of the structure.
|
||||||
*/
|
*/
|
||||||
PHASE_OUT(ctx);
|
PHASE_OUT(ctx);
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
ASN_DEBUG(
|
ASN_DEBUG(
|
||||||
"Current tag in %s SEQUENCE for element %d "
|
"Current tag in %s SEQUENCE for element %d "
|
||||||
@ -304,23 +304,23 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
td->elements_count))
|
td->elements_count))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Yeah, baby! Found the
|
* Yeah, baby! Found the
|
||||||
* terminator of the indefinite
|
* terminator of the indefinite
|
||||||
* length structure.
|
* length structure.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Proceed to the canonical
|
* Proceed to the canonical
|
||||||
* finalization function.
|
* finalization function.
|
||||||
* No advancing is necessary.
|
* No advancing is necessary.
|
||||||
*/
|
*/
|
||||||
goto phase3;
|
goto phase3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the next available type with this tag.
|
* Find the next available type with this tag.
|
||||||
*/
|
*/
|
||||||
use_bsearch = 0;
|
use_bsearch = 0;
|
||||||
opt_edx_end = edx + elements[edx].optional + 1;
|
opt_edx_end = edx + elements[edx].optional + 1;
|
||||||
if (opt_edx_end > td->elements_count)
|
if (opt_edx_end > td->elements_count)
|
||||||
@ -339,10 +339,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag))
|
if (BER_TAGS_EQUAL(tlv_tag, elements[n].tag))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found element corresponding to the
|
* Found element corresponding to the
|
||||||
* tag being looked at. Reposition over
|
* tag being looked at. Reposition over
|
||||||
* the right element.
|
* the right element.
|
||||||
*/
|
*/
|
||||||
edx = n;
|
edx = n;
|
||||||
ctx->step = 1 + 2 * edx; /* Remember! */
|
ctx->step = 1 + 2 * edx; /* Remember! */
|
||||||
goto microphase2;
|
goto microphase2;
|
||||||
@ -350,9 +350,9 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (elements[n].flags & ATF_OPEN_TYPE)
|
else if (elements[n].flags & ATF_OPEN_TYPE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is the ANY type, which may bear
|
* This is the ANY type, which may bear
|
||||||
* any flag whatsoever.
|
* any flag whatsoever.
|
||||||
*/
|
*/
|
||||||
edx = n;
|
edx = n;
|
||||||
ctx->step = 1 + 2 * edx; /* Remember! */
|
ctx->step = 1 + 2 * edx; /* Remember! */
|
||||||
goto microphase2;
|
goto microphase2;
|
||||||
@ -366,9 +366,9 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (use_bsearch)
|
if (use_bsearch)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Resort to a binary search over
|
* Resort to a binary search over
|
||||||
* sorted array of tags.
|
* sorted array of tags.
|
||||||
*/
|
*/
|
||||||
asn_TYPE_tag2member_t *t2m;
|
asn_TYPE_tag2member_t *t2m;
|
||||||
asn_TYPE_tag2member_t key;
|
asn_TYPE_tag2member_t key;
|
||||||
key.el_tag = tlv_tag;
|
key.el_tag = tlv_tag;
|
||||||
@ -384,10 +384,10 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
int edx_max =
|
int edx_max =
|
||||||
edx + elements[edx].optional;
|
edx + elements[edx].optional;
|
||||||
/*
|
/*
|
||||||
* Rewind to the first element with that
|
* Rewind to the first element with that
|
||||||
* tag, `cause bsearch() does not
|
* tag, `cause bsearch() does not
|
||||||
* guarantee order.
|
* guarantee order.
|
||||||
*/
|
*/
|
||||||
t2m_f = t2m + t2m->toff_first;
|
t2m_f = t2m + t2m->toff_first;
|
||||||
t2m_l = t2m + t2m->toff_last;
|
t2m_l = t2m + t2m->toff_last;
|
||||||
for (t2m = t2m_f; t2m <= t2m_l; t2m++)
|
for (t2m = t2m_f; t2m <= t2m_l; t2m++)
|
||||||
@ -414,11 +414,11 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (n == opt_edx_end)
|
if (n == opt_edx_end)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If tag is unknown, it may be either
|
* If tag is unknown, it may be either
|
||||||
* an unknown (thus, incorrect) tag,
|
* an unknown (thus, incorrect) tag,
|
||||||
* or an extension (...),
|
* or an extension (...),
|
||||||
* or an end of the indefinite-length structure.
|
* or an end of the indefinite-length structure.
|
||||||
*/
|
*/
|
||||||
if (!IN_EXTENSION_GROUP(
|
if (!IN_EXTENSION_GROUP(
|
||||||
specs, edx + elements[edx].optional))
|
specs, edx + elements[edx].optional))
|
||||||
{
|
{
|
||||||
@ -466,22 +466,22 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
ctx->step -= 2;
|
ctx->step -= 2;
|
||||||
edx--;
|
edx--;
|
||||||
continue; /* Try again with the next tag
|
continue; /* Try again with the next tag
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 2: Invoke the member-specific decoder.
|
* MICROPHASE 2: Invoke the member-specific decoder.
|
||||||
*/
|
*/
|
||||||
ctx->step |= 1; /* Confirm entering next microphase */
|
ctx->step |= 1; /* Confirm entering next microphase */
|
||||||
microphase2:
|
microphase2:
|
||||||
ASN_DEBUG("Inside SEQUENCE %s MF2", td->name);
|
ASN_DEBUG("Inside SEQUENCE %s MF2", td->name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the position of the member inside a
|
* Compute the position of the member inside a
|
||||||
* structure, and also a type of containment (it may be
|
* structure, and also a type of containment (it may be
|
||||||
* contained as pointer or using inline inclusion).
|
* contained as pointer or using inline inclusion).
|
||||||
*/
|
*/
|
||||||
if (elements[edx].flags & ATF_POINTER)
|
if (elements[edx].flags & ATF_POINTER)
|
||||||
{
|
{
|
||||||
/* Member is a pointer to another structure */
|
/* Member is a pointer to another structure */
|
||||||
@ -492,17 +492,17 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* A pointer to a pointer
|
* A pointer to a pointer
|
||||||
* holding the start of the structure
|
* holding the start of the structure
|
||||||
*/
|
*/
|
||||||
memb_ptr =
|
memb_ptr =
|
||||||
(char *)st + elements[edx].memb_offset;
|
(char *)st + elements[edx].memb_offset;
|
||||||
memb_ptr2 = &memb_ptr;
|
memb_ptr2 = &memb_ptr;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elements[edx].type->ber_decoder(
|
rval = elements[edx].type->ber_decoder(
|
||||||
opt_codec_ctx, elements[edx].type, memb_ptr2, ptr,
|
opt_codec_ctx, elements[edx].type, memb_ptr2, ptr,
|
||||||
LEFT, elements[edx].tag_mode);
|
LEFT, elements[edx].tag_mode);
|
||||||
@ -541,8 +541,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
(long)ctx->left, (long)size);
|
(long)ctx->left, (long)size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip everything until the end of the SEQUENCE.
|
* Skip everything until the end of the SEQUENCE.
|
||||||
*/
|
*/
|
||||||
while (ctx->left)
|
while (ctx->left)
|
||||||
{
|
{
|
||||||
ssize_t tl;
|
ssize_t tl;
|
||||||
@ -562,8 +562,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If expected <0><0>...
|
* If expected <0><0>...
|
||||||
*/
|
*/
|
||||||
if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0)
|
if (ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -580,8 +580,8 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Correctly finished with <0><0>.
|
* Correctly finished with <0><0>.
|
||||||
*/
|
*/
|
||||||
ADVANCE(2);
|
ADVANCE(2);
|
||||||
ctx->left++;
|
ctx->left++;
|
||||||
ctx->phase = 4;
|
ctx->phase = 4;
|
||||||
@ -724,8 +724,8 @@ asn_enc_rval_t SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
|
|||||||
if (computed_size != 0)
|
if (computed_size != 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Encoded size is not equal to the computed size.
|
* Encoded size is not equal to the computed size.
|
||||||
*/
|
*/
|
||||||
_ASN_ENCODE_FAILED;
|
_ASN_ENCODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
if (edx >= td->elements_count ||
|
if (edx >= td->elements_count ||
|
||||||
/* Explicit OPTIONAL specs reaches the end
|
/* Explicit OPTIONAL specs reaches the end
|
||||||
*/
|
*/
|
||||||
(edx + elements[edx].optional ==
|
(edx + elements[edx].optional ==
|
||||||
td->elements_count) ||
|
td->elements_count) ||
|
||||||
/* All extensions are optional */
|
/* All extensions are optional */
|
||||||
@ -942,8 +942,8 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (edx < td->elements_count)
|
if (edx < td->elements_count)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Search which member corresponds to this tag.
|
* Search which member corresponds to this tag.
|
||||||
*/
|
*/
|
||||||
edx_end = edx + elements[edx].optional + 1;
|
edx_end = edx + elements[edx].optional + 1;
|
||||||
if (edx_end > td->elements_count)
|
if (edx_end > td->elements_count)
|
||||||
{
|
{
|
||||||
@ -959,8 +959,8 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
case XCT_BOTH:
|
case XCT_BOTH:
|
||||||
case XCT_OPENING:
|
case XCT_OPENING:
|
||||||
/*
|
/*
|
||||||
* Process this member.
|
* Process this member.
|
||||||
*/
|
*/
|
||||||
ctx->step = edx = n;
|
ctx->step = edx = n;
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
break;
|
break;
|
||||||
@ -993,10 +993,10 @@ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
ASN_DEBUG("Got anticipated extension at %d",
|
ASN_DEBUG("Got anticipated extension at %d",
|
||||||
edx);
|
edx);
|
||||||
/*
|
/*
|
||||||
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
|
||||||
* By using a mask. Only record a pure
|
* By using a mask. Only record a pure
|
||||||
* <opening> tags.
|
* <opening> tags.
|
||||||
*/
|
*/
|
||||||
if (tcv & XCT_CLOSING)
|
if (tcv & XCT_CLOSING)
|
||||||
{
|
{
|
||||||
/* Found </extension> without body */
|
/* Found </extension> without body */
|
||||||
|
@ -124,10 +124,10 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* PHASE 0.
|
* PHASE 0.
|
||||||
* Check that the set of tags associated with given structure
|
* Check that the set of tags associated with given structure
|
||||||
* perfectly fits our expectations.
|
* perfectly fits our expectations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size,
|
||||||
tag_mode, 1, &ctx->left, 0);
|
tag_mode, 1, &ctx->left, 0);
|
||||||
@ -153,10 +153,10 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
/*
|
||||||
* PHASE 1.
|
* PHASE 1.
|
||||||
* From the place where we've left it previously,
|
* From the place where we've left it previously,
|
||||||
* try to decode the next item.
|
* try to decode the next item.
|
||||||
*/
|
*/
|
||||||
for (;; ctx->step = 0)
|
for (;; ctx->step = 0)
|
||||||
{
|
{
|
||||||
ssize_t tag_len; /* Length of TLV's T */
|
ssize_t tag_len; /* Length of TLV's T */
|
||||||
@ -167,23 +167,23 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 1: Synchronize decoding.
|
* MICROPHASE 1: Synchronize decoding.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ctx->left == 0)
|
if (ctx->left == 0)
|
||||||
{
|
{
|
||||||
ASN_DEBUG("End of SET OF %s", td->name);
|
ASN_DEBUG("End of SET OF %s", td->name);
|
||||||
/*
|
/*
|
||||||
* No more things to decode.
|
* No more things to decode.
|
||||||
* Exit out of here.
|
* Exit out of here.
|
||||||
*/
|
*/
|
||||||
PHASE_OUT(ctx);
|
PHASE_OUT(ctx);
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch the T from TLV.
|
* Fetch the T from TLV.
|
||||||
*/
|
*/
|
||||||
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag);
|
||||||
switch (tag_len)
|
switch (tag_len)
|
||||||
{
|
{
|
||||||
@ -213,23 +213,23 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
else if (((const uint8_t *)ptr)[1] == 0)
|
else if (((const uint8_t *)ptr)[1] == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Found the terminator of the
|
* Found the terminator of the
|
||||||
* indefinite length structure.
|
* indefinite length structure.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Outmost tag may be unknown and cannot be
|
/* Outmost tag may be unknown and cannot be
|
||||||
* fetched/compared */
|
* fetched/compared */
|
||||||
if (elm->tag != (ber_tlv_tag_t)-1)
|
if (elm->tag != (ber_tlv_tag_t)-1)
|
||||||
{
|
{
|
||||||
if (BER_TAGS_EQUAL(tlv_tag, elm->tag))
|
if (BER_TAGS_EQUAL(tlv_tag, elm->tag))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The new list member of expected type
|
* The new list member of expected type
|
||||||
* has arrived.
|
* has arrived.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -245,15 +245,15 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MICROPHASE 2: Invoke the member-specific decoder.
|
* MICROPHASE 2: Invoke the member-specific decoder.
|
||||||
*/
|
*/
|
||||||
ctx->step |= 1; /* Confirm entering next microphase */
|
ctx->step |= 1; /* Confirm entering next microphase */
|
||||||
microphase2:
|
microphase2:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invoke the member fetch routine according to member's
|
* Invoke the member fetch routine according to member's
|
||||||
* type
|
* type
|
||||||
*/
|
*/
|
||||||
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
rval = elm->type->ber_decoder(opt_codec_ctx, elm->type,
|
||||||
&ctx->ptr, ptr, LEFT, 0);
|
&ctx->ptr, ptr, LEFT, 0);
|
||||||
ASN_DEBUG("In %s SET OF %s code %d consumed %d",
|
ASN_DEBUG("In %s SET OF %s code %d consumed %d",
|
||||||
@ -294,8 +294,8 @@ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
NEXT_PHASE(ctx);
|
NEXT_PHASE(ctx);
|
||||||
case 2:
|
case 2:
|
||||||
/*
|
/*
|
||||||
* Read in all "end of content" TLVs.
|
* Read in all "end of content" TLVs.
|
||||||
*/
|
*/
|
||||||
while (ctx->left < 0)
|
while (ctx->left < 0)
|
||||||
{
|
{
|
||||||
if (LEFT < 2)
|
if (LEFT < 2)
|
||||||
@ -726,8 +726,8 @@ asn_dec_rval_t SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||||||
if (ctx->phase == 1)
|
if (ctx->phase == 1)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Process a single possible member.
|
* Process a single possible member.
|
||||||
*/
|
*/
|
||||||
ctx->phase = 2;
|
ctx->phase = 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -292,12 +292,12 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
if (ctx->phase == 0)
|
if (ctx->phase == 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We have to ignore whitespace
|
* We have to ignore whitespace
|
||||||
* here, but in order to be forward
|
* here, but in order to be forward
|
||||||
* compatible with EXTENDED-XER
|
* compatible with EXTENDED-XER
|
||||||
* (EMBED-VALUES, #25) any text is
|
* (EMBED-VALUES, #25) any text is
|
||||||
* just ignored here.
|
* just ignored here.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -351,8 +351,8 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
case XCT_UNKNOWN_BO:
|
case XCT_UNKNOWN_BO:
|
||||||
/*
|
/*
|
||||||
* Certain tags in the body may be expected.
|
* Certain tags in the body may be expected.
|
||||||
*/
|
*/
|
||||||
if (opt_unexpected_tag_decoder &&
|
if (opt_unexpected_tag_decoder &&
|
||||||
opt_unexpected_tag_decoder(struct_key, buf_ptr,
|
opt_unexpected_tag_decoder(struct_key, buf_ptr,
|
||||||
ch_size) >= 0)
|
ch_size) >= 0)
|
||||||
@ -362,7 +362,7 @@ asn_dec_rval_t xer_decode_general(
|
|||||||
if (!ctx->phase)
|
if (!ctx->phase)
|
||||||
{
|
{
|
||||||
/* We are not expecting
|
/* We are not expecting
|
||||||
* the closing tag anymore. */
|
* the closing tag anymore. */
|
||||||
ctx->phase = 2; /* Phase out */
|
ctx->phase = 2; /* Phase out */
|
||||||
RETURN(RC_OK);
|
RETURN(RC_OK);
|
||||||
}
|
}
|
||||||
@ -390,11 +390,11 @@ int xer_is_whitespace(const void *chunk_buf, size_t chunk_size)
|
|||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
/* X.693, #8.1.4
|
/* X.693, #8.1.4
|
||||||
* HORISONTAL TAB (9)
|
* HORISONTAL TAB (9)
|
||||||
* LINE FEED (10)
|
* LINE FEED (10)
|
||||||
* CARRIAGE RETURN (13)
|
* CARRIAGE RETURN (13)
|
||||||
* SPACE (32)
|
* SPACE (32)
|
||||||
*/
|
*/
|
||||||
case 0x09:
|
case 0x09:
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
|
@ -103,9 +103,9 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
{
|
{
|
||||||
case ST_TEXT:
|
case ST_TEXT:
|
||||||
/*
|
/*
|
||||||
* Initial state: we're in the middle of some text,
|
* Initial state: we're in the middle of some text,
|
||||||
* or just have started.
|
* or just have started.
|
||||||
*/
|
*/
|
||||||
if (C == LANGLE)
|
if (C == LANGLE)
|
||||||
{ /* We're now in the tag, probably */
|
{ /* We're now in the tag, probably */
|
||||||
TOKEN_CB(PXML_TEXT, ST_TAG_START, 0);
|
TOKEN_CB(PXML_TEXT, ST_TAG_START, 0);
|
||||||
@ -138,10 +138,10 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case LANGLE:
|
case LANGLE:
|
||||||
/*
|
/*
|
||||||
* The previous tag wasn't completed, but
|
* The previous tag wasn't completed, but
|
||||||
* still recognized as valid.
|
* still recognized as valid.
|
||||||
* (Mozilla-compatible)
|
* (Mozilla-compatible)
|
||||||
*/
|
*/
|
||||||
TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0);
|
TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0);
|
||||||
break;
|
break;
|
||||||
case CEQUAL:
|
case CEQUAL:
|
||||||
@ -151,8 +151,8 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case ST_TAG_QUOTE_WAIT:
|
case ST_TAG_QUOTE_WAIT:
|
||||||
/*
|
/*
|
||||||
* State after the equal sign ("=") in the tag.
|
* State after the equal sign ("=") in the tag.
|
||||||
*/
|
*/
|
||||||
switch (C)
|
switch (C)
|
||||||
{
|
{
|
||||||
case CQUOTE:
|
case CQUOTE:
|
||||||
@ -172,8 +172,8 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
break;
|
break;
|
||||||
case ST_TAG_QUOTED_STRING:
|
case ST_TAG_QUOTED_STRING:
|
||||||
/*
|
/*
|
||||||
* Tag attribute's string value in quotes.
|
* Tag attribute's string value in quotes.
|
||||||
*/
|
*/
|
||||||
if (C == CQUOTE)
|
if (C == CQUOTE)
|
||||||
{
|
{
|
||||||
/* Return back to the tag state */
|
/* Return back to the tag state */
|
||||||
@ -240,7 +240,7 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size,
|
|||||||
else if (C == CDASH)
|
else if (C == CDASH)
|
||||||
{
|
{
|
||||||
/* Maintain current state, still waiting for '>'
|
/* Maintain current state, still waiting for '>'
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -473,17 +473,17 @@ static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu)
|
|||||||
(void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.sETCapabilities.prefMethod, PrefMethod_agpsSETBasedPreferred);
|
(void)asn_long2INTEGER(&ulp->message.choice.msSUPLPOSINIT.sETCapabilities.prefMethod, PrefMethod_agpsSETBasedPreferred);
|
||||||
ulp->message.choice.msSUPLPOSINIT.sETCapabilities.posProtocol.rrlp = 1;
|
ulp->message.choice.msSUPLPOSINIT.sETCapabilities.posProtocol.rrlp = 1;
|
||||||
|
|
||||||
//GNSS-SDR mod
|
// GNSS-SDR mod
|
||||||
// Use ctx->p.request to switch between a pre-defined set of assistance data request
|
// Use ctx->p.request to switch between a pre-defined set of assistance data request
|
||||||
// reason: Some SUPL servers do not respond to Acquisition assistance depending on the status of other assistance flags
|
// reason: Some SUPL servers do not respond to Acquisition assistance depending on the status of other assistance flags
|
||||||
|
|
||||||
switch (ctx->p.request)
|
switch (ctx->p.request)
|
||||||
{
|
{
|
||||||
case 0: //request almanac, time, and cell positions
|
case 0: // request almanac, time, and cell positions
|
||||||
req_adata->acquisitionAssistanceRequested = 0; // 1
|
req_adata->acquisitionAssistanceRequested = 0; // 1
|
||||||
req_adata->navigationModelRequested = 0; // 1
|
req_adata->navigationModelRequested = 0; // 1
|
||||||
req_adata->referenceTimeRequested = 1;
|
req_adata->referenceTimeRequested = 1;
|
||||||
req_adata->utcModelRequested = 1; //1
|
req_adata->utcModelRequested = 1; // 1
|
||||||
req_adata->ionosphericModelRequested = 1; // 1
|
req_adata->ionosphericModelRequested = 1; // 1
|
||||||
req_adata->referenceLocationRequested = 1;
|
req_adata->referenceLocationRequested = 1;
|
||||||
req_adata->almanacRequested = 1;
|
req_adata->almanacRequested = 1;
|
||||||
@ -493,17 +493,17 @@ static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu)
|
|||||||
req_adata->acquisitionAssistanceRequested = 0; // 1
|
req_adata->acquisitionAssistanceRequested = 0; // 1
|
||||||
req_adata->navigationModelRequested = 1; // 1
|
req_adata->navigationModelRequested = 1; // 1
|
||||||
req_adata->referenceTimeRequested = 1;
|
req_adata->referenceTimeRequested = 1;
|
||||||
req_adata->utcModelRequested = 0; //1
|
req_adata->utcModelRequested = 0; // 1
|
||||||
req_adata->ionosphericModelRequested = 0; // 1
|
req_adata->ionosphericModelRequested = 0; // 1
|
||||||
req_adata->referenceLocationRequested = 0;
|
req_adata->referenceLocationRequested = 0;
|
||||||
req_adata->almanacRequested = 0;
|
req_adata->almanacRequested = 0;
|
||||||
req_adata->realTimeIntegrityRequested = 0; // 1
|
req_adata->realTimeIntegrityRequested = 0; // 1
|
||||||
break;
|
break;
|
||||||
case 2: //request Acquisition assistance (Doppler assistance)
|
case 2: // request Acquisition assistance (Doppler assistance)
|
||||||
req_adata->acquisitionAssistanceRequested = 1; // 1
|
req_adata->acquisitionAssistanceRequested = 1; // 1
|
||||||
req_adata->navigationModelRequested = 0; // 1
|
req_adata->navigationModelRequested = 0; // 1
|
||||||
req_adata->referenceTimeRequested = 1;
|
req_adata->referenceTimeRequested = 1;
|
||||||
req_adata->utcModelRequested = 1; //1
|
req_adata->utcModelRequested = 1; // 1
|
||||||
req_adata->ionosphericModelRequested = 1; // 1
|
req_adata->ionosphericModelRequested = 1; // 1
|
||||||
req_adata->referenceLocationRequested = 1;
|
req_adata->referenceLocationRequested = 1;
|
||||||
req_adata->almanacRequested = 1;
|
req_adata->almanacRequested = 1;
|
||||||
@ -513,7 +513,7 @@ static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu)
|
|||||||
req_adata->acquisitionAssistanceRequested = 0; // 1
|
req_adata->acquisitionAssistanceRequested = 0; // 1
|
||||||
req_adata->navigationModelRequested = 0; // 1
|
req_adata->navigationModelRequested = 0; // 1
|
||||||
req_adata->referenceTimeRequested = 1;
|
req_adata->referenceTimeRequested = 1;
|
||||||
req_adata->utcModelRequested = 1; //1
|
req_adata->utcModelRequested = 1; // 1
|
||||||
req_adata->ionosphericModelRequested = 1; // 1
|
req_adata->ionosphericModelRequested = 1; // 1
|
||||||
req_adata->referenceLocationRequested = 1;
|
req_adata->referenceLocationRequested = 1;
|
||||||
req_adata->almanacRequested = 1;
|
req_adata->almanacRequested = 1;
|
||||||
@ -858,7 +858,7 @@ int EXPORT supl_collect_rrlp(supl_assist_t *assist, PDU_t *rrlp, struct timeval
|
|||||||
assist->iono.a0 = hdr->ionosphericModel->alfa0;
|
assist->iono.a0 = hdr->ionosphericModel->alfa0;
|
||||||
assist->iono.a1 = hdr->ionosphericModel->alfa1;
|
assist->iono.a1 = hdr->ionosphericModel->alfa1;
|
||||||
assist->iono.a2 = hdr->ionosphericModel->alfa2;
|
assist->iono.a2 = hdr->ionosphericModel->alfa2;
|
||||||
assist->iono.a3 = hdr->ionosphericModel->alfa3; //missed in original supl client
|
assist->iono.a3 = hdr->ionosphericModel->alfa3; // missed in original supl client
|
||||||
assist->iono.b0 = hdr->ionosphericModel->beta0;
|
assist->iono.b0 = hdr->ionosphericModel->beta0;
|
||||||
assist->iono.b1 = hdr->ionosphericModel->beta1;
|
assist->iono.b1 = hdr->ionosphericModel->beta1;
|
||||||
assist->iono.b2 = hdr->ionosphericModel->beta2;
|
assist->iono.b2 = hdr->ionosphericModel->beta2;
|
||||||
@ -924,8 +924,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
memcpy(ctx->p.msisdn, "\xFF\xFF\x91\x94\x48\x45\x83\x98", 8);
|
memcpy(ctx->p.msisdn, "\xFF\xFF\x91\x94\x48\x45\x83\x98", 8);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** connect to server
|
** connect to server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (supl_server_connect(ctx, server) < 0)
|
if (supl_server_connect(ctx, server) < 0)
|
||||||
{
|
{
|
||||||
@ -933,8 +933,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** send SUPL_START
|
** send SUPL_START
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pdu_make_ulp_start(ctx, &ulp) < 0)
|
if (pdu_make_ulp_start(ctx, &ulp) < 0)
|
||||||
{
|
{
|
||||||
@ -945,8 +945,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
supl_ulp_free(&ulp);
|
supl_ulp_free(&ulp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** should receive SUPL_RESPONSE back
|
** should receive SUPL_RESPONSE back
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (supl_ulp_recv(ctx, &ulp) < 0)
|
if (supl_ulp_recv(ctx, &ulp) < 0)
|
||||||
{
|
{
|
||||||
@ -965,8 +965,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
supl_ulp_free(&ulp);
|
supl_ulp_free(&ulp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** send SUPL_POS_INIT
|
** send SUPL_POS_INIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pdu_make_ulp_pos_init(ctx, &ulp) < 0)
|
if (pdu_make_ulp_pos_init(ctx, &ulp) < 0)
|
||||||
{
|
{
|
||||||
@ -976,8 +976,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
(void)supl_ulp_send(ctx, &ulp);
|
(void)supl_ulp_send(ctx, &ulp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** should get SUPLPOS back - bounce back and forth until all messages have arrived
|
** should get SUPLPOS back - bounce back and forth until all messages have arrived
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memset(assist, 0, sizeof(supl_assist_t));
|
memset(assist, 0, sizeof(supl_assist_t));
|
||||||
|
|
||||||
@ -1047,8 +1047,8 @@ int EXPORT supl_get_assist(supl_ctx_t *ctx, char *server, supl_assist_t *assist)
|
|||||||
supl_ulp_free(&ulp);
|
supl_ulp_free(&ulp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** send SUPL_END (but who really cares)
|
** send SUPL_END (but who really cares)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
supl_close(ctx);
|
supl_close(ctx);
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ using namespace google;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Concurrent queues that communicates the Telemetry Decoder
|
* Concurrent queues that communicates the Telemetry Decoder
|
||||||
* to the Observables modules
|
* to the Observables modules
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// For GPS NAVIGATION (L1)
|
// For GPS NAVIGATION (L1)
|
||||||
Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||||
|
Loading…
Reference in New Issue
Block a user