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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,93 +8,92 @@
static int static int
memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, memb_sessionID_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_app_constraint_failed_f *ctfailcb, void *app_key)
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; {
size_t size; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) { if (!sptr)
_ASN_CTFAIL(app_key, td, sptr, {
"%s: value not given (%s:%d)", _ASN_CTFAIL(app_key, td, sptr,
td->name, __FILE__, __LINE__); "%s: value not given (%s:%d)",
return -1; td->name, __FILE__, __LINE__);
} return -1;
}
size = st->size; size = st->size;
if((size == 4)) { if (size == 4)
/* Constraint check succeeded */ {
return 0; /* Constraint check succeeded */
} else { return 0;
_ASN_CTFAIL(app_key, td, sptr, }
"%s: constraint failed (%s:%d)", else
td->name, __FILE__, __LINE__); {
return -1; _ASN_CTFAIL(app_key, td, sptr,
} "%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
} }
static asn_per_constraints_t asn_PER_memb_sessionID_constr_2 = { static asn_per_constraints_t asn_PER_memb_sessionID_constr_2 = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 }, {APC_UNCONSTRAINED, -1, -1, 0, 0},
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */, {APC_CONSTRAINED, 0, 0, 4, 4} /* (SIZE(4..4)) */,
0, 0 /* No PER value map */ 0, 0 /* No PER value map */
}; };
static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = { static asn_TYPE_member_t asn_MBR_SlpSessionID_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID), {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, sessionID),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_OCTET_STRING, &asn_DEF_OCTET_STRING,
memb_sessionID_constraint_1, memb_sessionID_constraint_1,
&asn_PER_memb_sessionID_constr_2, &asn_PER_memb_sessionID_constr_2,
0, 0,
"sessionID" "sessionID"},
}, {ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId),
{ ATF_NOFLAGS, 0, offsetof(struct SlpSessionID, slpId), (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */
+1, /* EXPLICIT tag at current level */ &asn_DEF_SLPAddress,
&asn_DEF_SLPAddress, 0, /* Defer constraints checking to the member type */
0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */
0, /* No PER visible constraints */ 0,
0, "slpId"},
"slpId"
},
}; };
static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = { static ber_tlv_tag_t asn_DEF_SlpSessionID_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
};
static asn_TYPE_tag2member_t asn_MAP_SlpSessionID_tag2el_1[] = { static asn_TYPE_tag2member_t asn_MAP_SlpSessionID_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sessionID at 37 */ {(ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0}, /* sessionID at 37 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* slpId at 38 */ {(ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0} /* slpId at 38 */
}; };
static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = { static asn_SEQUENCE_specifics_t asn_SPC_SlpSessionID_specs_1 = {
sizeof(struct SlpSessionID), sizeof(struct SlpSessionID),
offsetof(struct SlpSessionID, _asn_ctx), offsetof(struct SlpSessionID, _asn_ctx),
asn_MAP_SlpSessionID_tag2el_1, asn_MAP_SlpSessionID_tag2el_1,
2, /* Count of tags in the map */ 2, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */ 0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */ -1, /* Start extensions */
-1 /* Stop extensions */ -1 /* Stop extensions */
}; };
asn_TYPE_descriptor_t asn_DEF_SlpSessionID = { asn_TYPE_descriptor_t asn_DEF_SlpSessionID = {
"SlpSessionID", "SlpSessionID",
"SlpSessionID", "SlpSessionID",
SEQUENCE_free, SEQUENCE_free,
SEQUENCE_print, SEQUENCE_print,
SEQUENCE_constraint, SEQUENCE_constraint,
SEQUENCE_decode_ber, SEQUENCE_decode_ber,
SEQUENCE_encode_der, SEQUENCE_encode_der,
SEQUENCE_decode_xer, SEQUENCE_decode_xer,
SEQUENCE_encode_xer, SEQUENCE_encode_xer,
SEQUENCE_decode_uper, SEQUENCE_decode_uper,
SEQUENCE_encode_uper, SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */ 0, /* Use generic outmost tag fetcher */
asn_DEF_SlpSessionID_tags_1, asn_DEF_SlpSessionID_tags_1,
sizeof(asn_DEF_SlpSessionID_tags_1) sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
/sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ asn_DEF_SlpSessionID_tags_1, /* Same as above */
asn_DEF_SlpSessionID_tags_1, /* Same as above */ sizeof(asn_DEF_SlpSessionID_tags_1) / sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */
sizeof(asn_DEF_SlpSessionID_tags_1) 0, /* No PER visible constraints */
/sizeof(asn_DEF_SlpSessionID_tags_1[0]), /* 1 */ asn_MBR_SlpSessionID_1,
0, /* No PER visible constraints */ 2, /* Elements count */
asn_MBR_SlpSessionID_1, &asn_SPC_SlpSessionID_specs_1 /* Additional specs */
2, /* Elements count */
&asn_SPC_SlpSessionID_specs_1 /* Additional specs */
}; };

View File

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

View File

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