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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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