Fix warnings

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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