1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Fix warnings

This commit is contained in:
Carles Fernandez 2018-08-15 23:38:47 +02:00
parent edf82644f2
commit 6e3c640b9e
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
15 changed files with 2506 additions and 2231 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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