Initial commit of KPIMON xAPP for Bronze Release Enhancement.
Signed-off-by: jinweifan <jinwei.fan@samsung.com> Change-Id: I72f3c13b42ef302e4ac66a6c89a8e043367eea8c
This commit is contained in:
656
e2sm/lib/BIT_STRING.c
Normal file
656
e2sm/lib/BIT_STRING.c
Normal file
@@ -0,0 +1,656 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <BIT_STRING.h>
|
||||
#include <asn_internal.h>
|
||||
|
||||
/*
|
||||
* BIT STRING basic type description.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
|
||||
};
|
||||
asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs = {
|
||||
sizeof(BIT_STRING_t),
|
||||
offsetof(BIT_STRING_t, _asn_ctx),
|
||||
ASN_OSUBV_BIT
|
||||
};
|
||||
asn_TYPE_operation_t asn_OP_BIT_STRING = {
|
||||
OCTET_STRING_free, /* Implemented in terms of OCTET STRING */
|
||||
BIT_STRING_print,
|
||||
BIT_STRING_compare,
|
||||
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
|
||||
OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */
|
||||
OCTET_STRING_decode_xer_binary,
|
||||
BIT_STRING_encode_xer,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
BIT_STRING_decode_oer,
|
||||
BIT_STRING_encode_oer,
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
BIT_STRING_decode_uper, /* Unaligned PER decoder */
|
||||
BIT_STRING_encode_uper, /* Unaligned PER encoder */
|
||||
OCTET_STRING_decode_aper, /* Aligned PER decoder */
|
||||
OCTET_STRING_encode_aper, /* Aligned PER encoder */
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
BIT_STRING_random_fill,
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
|
||||
"BIT STRING",
|
||||
"BIT_STRING",
|
||||
&asn_OP_BIT_STRING,
|
||||
asn_DEF_BIT_STRING_tags,
|
||||
sizeof(asn_DEF_BIT_STRING_tags)
|
||||
/ sizeof(asn_DEF_BIT_STRING_tags[0]),
|
||||
asn_DEF_BIT_STRING_tags, /* Same as above */
|
||||
sizeof(asn_DEF_BIT_STRING_tags)
|
||||
/ sizeof(asn_DEF_BIT_STRING_tags[0]),
|
||||
{ 0, 0, BIT_STRING_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_BIT_STRING_specs
|
||||
};
|
||||
|
||||
/*
|
||||
* BIT STRING generic constraint.
|
||||
*/
|
||||
int
|
||||
BIT_STRING_constraint(const 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;
|
||||
|
||||
if(st && st->buf) {
|
||||
if((st->size == 0 && st->bits_unused)
|
||||
|| st->bits_unused < 0 || st->bits_unused > 7) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: invalid padding byte (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *_bit_pattern[16] = {
|
||||
"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
|
||||
"1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"
|
||||
};
|
||||
|
||||
asn_enc_rval_t
|
||||
BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
int ilevel, enum xer_encoder_flags_e flags,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
asn_enc_rval_t er = {0, 0, 0};
|
||||
char scratch[128];
|
||||
char *p = scratch;
|
||||
char *scend = scratch + (sizeof(scratch) - 10);
|
||||
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
|
||||
int xcan = (flags & XER_F_CANONICAL);
|
||||
uint8_t *buf;
|
||||
uint8_t *end;
|
||||
|
||||
if(!st || !st->buf)
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
er.encoded = 0;
|
||||
|
||||
buf = st->buf;
|
||||
end = buf + st->size - 1; /* Last byte is special */
|
||||
|
||||
/*
|
||||
* Binary dump
|
||||
*/
|
||||
for(; buf < end; buf++) {
|
||||
int v = *buf;
|
||||
int nline = xcan?0:(((buf - st->buf) % 8) == 0);
|
||||
if(p >= scend || nline) {
|
||||
ASN__CALLBACK(scratch, p - scratch);
|
||||
p = scratch;
|
||||
if(nline) ASN__TEXT_INDENT(1, ilevel);
|
||||
}
|
||||
memcpy(p + 0, _bit_pattern[v >> 4], 4);
|
||||
memcpy(p + 4, _bit_pattern[v & 0x0f], 4);
|
||||
p += 8;
|
||||
}
|
||||
|
||||
if(!xcan && ((buf - st->buf) % 8) == 0)
|
||||
ASN__TEXT_INDENT(1, ilevel);
|
||||
ASN__CALLBACK(scratch, p - scratch);
|
||||
p = scratch;
|
||||
|
||||
if(buf == end) {
|
||||
int v = *buf;
|
||||
int ubits = st->bits_unused;
|
||||
int i;
|
||||
for(i = 7; i >= ubits; i--)
|
||||
*p++ = (v & (1 << i)) ? 0x31 : 0x30;
|
||||
ASN__CALLBACK(scratch, p - scratch);
|
||||
}
|
||||
|
||||
if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1);
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
cb_failed:
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BIT STRING specific contents printer.
|
||||
*/
|
||||
int
|
||||
BIT_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const char * const h2c = "0123456789ABCDEF";
|
||||
char scratch[64];
|
||||
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
|
||||
uint8_t *buf;
|
||||
uint8_t *end;
|
||||
char *p = scratch;
|
||||
|
||||
(void)td; /* Unused argument */
|
||||
|
||||
if(!st || !st->buf)
|
||||
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
|
||||
|
||||
ilevel++;
|
||||
buf = st->buf;
|
||||
end = buf + st->size;
|
||||
|
||||
/*
|
||||
* Hexadecimal dump.
|
||||
*/
|
||||
for(; buf < end; buf++) {
|
||||
if((buf - st->buf) % 16 == 0 && (st->size > 16)
|
||||
&& buf != st->buf) {
|
||||
_i_INDENT(1);
|
||||
/* Dump the string */
|
||||
if(cb(scratch, p - scratch, app_key) < 0) return -1;
|
||||
p = scratch;
|
||||
}
|
||||
*p++ = h2c[*buf >> 4];
|
||||
*p++ = h2c[*buf & 0x0F];
|
||||
*p++ = 0x20;
|
||||
}
|
||||
|
||||
if(p > scratch) {
|
||||
p--; /* Eat the tailing space */
|
||||
|
||||
if((st->size > 16)) {
|
||||
_i_INDENT(1);
|
||||
}
|
||||
|
||||
/* Dump the incomplete 16-bytes row */
|
||||
if(cb(scratch, p - scratch, app_key) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(st->bits_unused) {
|
||||
int ret = snprintf(scratch, sizeof(scratch), " (%d bit%s unused)",
|
||||
st->bits_unused, st->bits_unused == 1 ? "" : "s");
|
||||
assert(ret > 0 && ret < (ssize_t)sizeof(scratch));
|
||||
if(ret > 0 && ret < (ssize_t)sizeof(scratch)
|
||||
&& cb(scratch, ret, app_key) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Non-destructively remove the trailing 0-bits from the given bit string.
|
||||
*/
|
||||
static const BIT_STRING_t *
|
||||
BIT_STRING__compactify(const BIT_STRING_t *st, BIT_STRING_t *tmp) {
|
||||
const uint8_t *b;
|
||||
union {
|
||||
const uint8_t *c_buf;
|
||||
uint8_t *nc_buf;
|
||||
} unconst;
|
||||
|
||||
if(st->size == 0) {
|
||||
assert(st->bits_unused == 0);
|
||||
return st;
|
||||
} else {
|
||||
for(b = &st->buf[st->size - 1]; b > st->buf && *b == 0; b--) {
|
||||
;
|
||||
}
|
||||
/* b points to the last byte which may contain data */
|
||||
if(*b) {
|
||||
int unused = 7;
|
||||
uint8_t v = *b;
|
||||
v &= -(int8_t)v;
|
||||
if(v & 0x0F) unused -= 4;
|
||||
if(v & 0x33) unused -= 2;
|
||||
if(v & 0x55) unused -= 1;
|
||||
tmp->size = b-st->buf + 1;
|
||||
tmp->bits_unused = unused;
|
||||
} else {
|
||||
tmp->size = b-st->buf;
|
||||
tmp->bits_unused = 0;
|
||||
}
|
||||
|
||||
assert(b >= st->buf);
|
||||
}
|
||||
|
||||
unconst.c_buf = st->buf;
|
||||
tmp->buf = unconst.nc_buf;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lexicographically compare the common prefix of both strings,
|
||||
* and if it is the same return -1 for the smallest string.
|
||||
*/
|
||||
int
|
||||
BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
|
||||
const void *bptr) {
|
||||
/*
|
||||
* Remove information about trailing bits, since
|
||||
* X.680 (08/2015) #22.7 "ensure that different semantics are not"
|
||||
* "associated with [values that differ only in] the trailing 0 bits."
|
||||
*/
|
||||
BIT_STRING_t compact_a, compact_b;
|
||||
const BIT_STRING_t *a = BIT_STRING__compactify(aptr, &compact_a);
|
||||
const BIT_STRING_t *b = BIT_STRING__compactify(bptr, &compact_b);
|
||||
const asn_OCTET_STRING_specifics_t *specs = td->specifics;
|
||||
|
||||
assert(specs && specs->subvariant == ASN_OSUBV_BIT);
|
||||
|
||||
if(a && b) {
|
||||
size_t common_prefix_size = a->size <= b->size ? a->size : b->size;
|
||||
int ret = memcmp(a->buf, b->buf, common_prefix_size);
|
||||
if(ret == 0) {
|
||||
/* Figure out which string with equal prefixes is longer. */
|
||||
if(a->size < b->size) {
|
||||
return -1;
|
||||
} else if(a->size > b->size) {
|
||||
return 1;
|
||||
} else {
|
||||
/* Figure out how many unused bits */
|
||||
if(a->bits_unused > b->bits_unused) {
|
||||
return -1;
|
||||
} else if(a->bits_unused < b->bits_unused) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
} else if(!a && !b) {
|
||||
return 0;
|
||||
} else if(!a) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef ASN_DISABLE_PER_SUPPORT
|
||||
|
||||
#undef RETURN
|
||||
#define RETURN(_code) \
|
||||
do { \
|
||||
asn_dec_rval_t tmprval; \
|
||||
tmprval.code = _code; \
|
||||
tmprval.consumed = consumed_myself; \
|
||||
return tmprval; \
|
||||
} while(0)
|
||||
|
||||
static asn_per_constraint_t asn_DEF_BIT_STRING_constraint_size = {
|
||||
APC_SEMI_CONSTRAINED, -1, -1, 0, 0};
|
||||
|
||||
asn_dec_rval_t
|
||||
BIT_STRING_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints, void **sptr,
|
||||
asn_per_data_t *pd) {
|
||||
const asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_BIT_STRING_specs;
|
||||
const asn_per_constraints_t *pc =
|
||||
constraints ? constraints : td->encoding_constraints.per_constraints;
|
||||
const asn_per_constraint_t *csiz;
|
||||
asn_dec_rval_t rval = { RC_OK, 0 };
|
||||
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
|
||||
ssize_t consumed_myself = 0;
|
||||
int repeat;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
|
||||
if(pc) {
|
||||
csiz = &pc->size;
|
||||
} else {
|
||||
csiz = &asn_DEF_BIT_STRING_constraint_size;
|
||||
}
|
||||
|
||||
if(specs->subvariant != ASN_OSUBV_BIT) {
|
||||
ASN_DEBUG("Subvariant %d is not BIT OSUBV_BIT", specs->subvariant);
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the string.
|
||||
*/
|
||||
if(!st) {
|
||||
st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
|
||||
if(!st) RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d",
|
||||
csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
|
||||
csiz->lower_bound, csiz->upper_bound, csiz->effective_bits);
|
||||
|
||||
if(csiz->flags & APC_EXTENSIBLE) {
|
||||
int inext = per_get_few_bits(pd, 1);
|
||||
if(inext < 0) RETURN(RC_WMORE);
|
||||
if(inext) {
|
||||
csiz = &asn_DEF_BIT_STRING_constraint_size;
|
||||
}
|
||||
}
|
||||
|
||||
if(csiz->effective_bits >= 0) {
|
||||
FREEMEM(st->buf);
|
||||
st->size = (csiz->upper_bound + 7) >> 3;
|
||||
st->buf = (uint8_t *)MALLOC(st->size + 1);
|
||||
if(!st->buf) { st->size = 0; RETURN(RC_FAIL); }
|
||||
}
|
||||
|
||||
/* X.691, #16.5: zero-length encoding */
|
||||
/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
|
||||
/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
|
||||
if(csiz->effective_bits == 0) {
|
||||
int ret;
|
||||
ASN_DEBUG("Encoding BIT STRING size %ld", csiz->upper_bound);
|
||||
ret = per_get_many_bits(pd, st->buf, 0, csiz->upper_bound);
|
||||
if(ret < 0) RETURN(RC_WMORE);
|
||||
consumed_myself += csiz->upper_bound;
|
||||
st->buf[st->size] = 0;
|
||||
st->bits_unused = (8 - (csiz->upper_bound & 0x7)) & 0x7;
|
||||
RETURN(RC_OK);
|
||||
}
|
||||
|
||||
st->size = 0;
|
||||
do {
|
||||
ssize_t raw_len;
|
||||
ssize_t len_bytes;
|
||||
ssize_t len_bits;
|
||||
void *p;
|
||||
int ret;
|
||||
|
||||
/* Get the PER length */
|
||||
raw_len = uper_get_length(pd, csiz->effective_bits, csiz->lower_bound,
|
||||
&repeat);
|
||||
if(raw_len < 0) RETURN(RC_WMORE);
|
||||
if(raw_len == 0 && st->buf) break;
|
||||
|
||||
ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)",
|
||||
(long)csiz->effective_bits, (long)raw_len,
|
||||
repeat ? "repeat" : "once", td->name);
|
||||
len_bits = raw_len;
|
||||
len_bytes = (len_bits + 7) >> 3;
|
||||
if(len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7);
|
||||
/* len_bits be multiple of 16K if repeat is set */
|
||||
p = REALLOC(st->buf, st->size + len_bytes + 1);
|
||||
if(!p) RETURN(RC_FAIL);
|
||||
st->buf = (uint8_t *)p;
|
||||
|
||||
ret = per_get_many_bits(pd, &st->buf[st->size], 0, len_bits);
|
||||
if(ret < 0) RETURN(RC_WMORE);
|
||||
st->size += len_bytes;
|
||||
} while(repeat);
|
||||
st->buf[st->size] = 0; /* nul-terminate */
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
BIT_STRING_encode_uper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const asn_OCTET_STRING_specifics_t *specs =
|
||||
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_BIT_STRING_specs;
|
||||
const asn_per_constraints_t *pc =
|
||||
constraints ? constraints : td->encoding_constraints.per_constraints;
|
||||
const asn_per_constraint_t *csiz;
|
||||
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
|
||||
BIT_STRING_t compact_bstr; /* Do not modify this directly! */
|
||||
asn_enc_rval_t er = { 0, 0, 0 };
|
||||
int inext = 0; /* Lies not within extension root */
|
||||
size_t size_in_bits;
|
||||
const uint8_t *buf;
|
||||
int ret;
|
||||
int ct_extensible;
|
||||
|
||||
if(!st || (!st->buf && st->size))
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
if(specs->subvariant == ASN_OSUBV_BIT) {
|
||||
if((st->size == 0 && st->bits_unused) || (st->bits_unused & ~7))
|
||||
ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(pc) {
|
||||
csiz = &pc->size;
|
||||
} else {
|
||||
csiz = &asn_DEF_BIT_STRING_constraint_size;
|
||||
}
|
||||
ct_extensible = csiz->flags & APC_EXTENSIBLE;
|
||||
|
||||
/* Figure out the size without the trailing bits */
|
||||
st = BIT_STRING__compactify(st, &compact_bstr);
|
||||
size_in_bits = 8 * st->size - st->bits_unused;
|
||||
|
||||
ASN_DEBUG(
|
||||
"Encoding %s into %" ASN_PRI_SIZE " bits"
|
||||
" (%ld..%ld, effective %d)%s",
|
||||
td->name, size_in_bits, csiz->lower_bound, csiz->upper_bound,
|
||||
csiz->effective_bits, ct_extensible ? " EXT" : "");
|
||||
|
||||
/* Figure out whether size lies within PER visible constraint */
|
||||
|
||||
if(csiz->effective_bits >= 0) {
|
||||
if((ssize_t)size_in_bits > csiz->upper_bound) {
|
||||
if(ct_extensible) {
|
||||
csiz = &asn_DEF_BIT_STRING_constraint_size;
|
||||
inext = 1;
|
||||
} else {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
inext = 0;
|
||||
}
|
||||
|
||||
if(ct_extensible) {
|
||||
/* Declare whether length is [not] within extension root */
|
||||
if(per_put_few_bits(po, inext, 1))
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(csiz->effective_bits >= 0 && !inext) {
|
||||
int add_trailer = (ssize_t)size_in_bits < csiz->lower_bound;
|
||||
ASN_DEBUG(
|
||||
"Encoding %" ASN_PRI_SIZE " bytes (%ld), length (in %d bits) trailer %d; actual "
|
||||
"value %" ASN_PRI_SSIZE "",
|
||||
st->size, size_in_bits - csiz->lower_bound, csiz->effective_bits,
|
||||
add_trailer,
|
||||
add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound);
|
||||
ret = per_put_few_bits(
|
||||
po, add_trailer ? 0 : (ssize_t)size_in_bits - csiz->lower_bound,
|
||||
csiz->effective_bits);
|
||||
if(ret) ASN__ENCODE_FAILED;
|
||||
ret = per_put_many_bits(po, st->buf, size_in_bits);
|
||||
if(ret) ASN__ENCODE_FAILED;
|
||||
if(add_trailer) {
|
||||
static const uint8_t zeros[16];
|
||||
size_t trailing_zero_bits = csiz->lower_bound - size_in_bits;
|
||||
while(trailing_zero_bits > 0) {
|
||||
if(trailing_zero_bits > 8 * sizeof(zeros)) {
|
||||
ret = per_put_many_bits(po, zeros, 8 * sizeof(zeros));
|
||||
trailing_zero_bits -= 8 * sizeof(zeros);
|
||||
} else {
|
||||
ret = per_put_many_bits(po, zeros, trailing_zero_bits);
|
||||
trailing_zero_bits = 0;
|
||||
}
|
||||
if(ret) ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
ASN_DEBUG("Encoding %" ASN_PRI_SIZE " bytes", st->size);
|
||||
|
||||
buf = st->buf;
|
||||
do {
|
||||
int need_eom = 0;
|
||||
ssize_t maySave = uper_put_length(po, size_in_bits, &need_eom);
|
||||
if(maySave < 0) ASN__ENCODE_FAILED;
|
||||
|
||||
ASN_DEBUG("Encoding %" ASN_PRI_SSIZE " of %" ASN_PRI_SIZE "", maySave, size_in_bits);
|
||||
|
||||
ret = per_put_many_bits(po, buf, maySave);
|
||||
if(ret) ASN__ENCODE_FAILED;
|
||||
|
||||
buf += maySave >> 3;
|
||||
size_in_bits -= maySave;
|
||||
assert(!(maySave & 0x07) || !size_in_bits);
|
||||
if(need_eom && uper_put_length(po, 0, 0))
|
||||
ASN__ENCODE_FAILED; /* End of Message length */
|
||||
} while(size_in_bits);
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
|
||||
asn_random_fill_result_t
|
||||
BIT_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
|
||||
const asn_encoding_constraints_t *constraints,
|
||||
size_t max_length) {
|
||||
const asn_OCTET_STRING_specifics_t *specs =
|
||||
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_BIT_STRING_specs;
|
||||
asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
|
||||
asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
|
||||
asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
|
||||
static unsigned lengths[] = {0, 1, 2, 3, 4, 8,
|
||||
126, 127, 128, 16383, 16384, 16385,
|
||||
65534, 65535, 65536, 65537};
|
||||
uint8_t *buf;
|
||||
uint8_t *bend;
|
||||
uint8_t *b;
|
||||
size_t rnd_bits, rnd_len;
|
||||
BIT_STRING_t *st;
|
||||
|
||||
if(max_length == 0) return result_skipped;
|
||||
|
||||
switch(specs->subvariant) {
|
||||
case ASN_OSUBV_ANY:
|
||||
return result_failed;
|
||||
case ASN_OSUBV_BIT:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Figure out how far we should go */
|
||||
rnd_bits = lengths[asn_random_between(
|
||||
0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
|
||||
if(!constraints || !constraints->per_constraints)
|
||||
constraints = &td->encoding_constraints;
|
||||
if(constraints->per_constraints) {
|
||||
const asn_per_constraint_t *pc = &constraints->per_constraints->size;
|
||||
if(pc->flags & APC_CONSTRAINED) {
|
||||
long suggested_upper_bound = pc->upper_bound < (ssize_t)max_length
|
||||
? pc->upper_bound
|
||||
: (ssize_t)max_length;
|
||||
if(max_length < (size_t)pc->lower_bound) {
|
||||
return result_skipped;
|
||||
}
|
||||
if(pc->flags & APC_EXTENSIBLE) {
|
||||
switch(asn_random_between(0, 5)) {
|
||||
case 0:
|
||||
if(pc->lower_bound > 0) {
|
||||
rnd_bits = pc->lower_bound - 1;
|
||||
break;
|
||||
}
|
||||
/* Fall through */
|
||||
case 1:
|
||||
rnd_bits = pc->upper_bound + 1;
|
||||
break;
|
||||
case 2:
|
||||
/* Keep rnd_bits from the table */
|
||||
if(rnd_bits < max_length) {
|
||||
break;
|
||||
}
|
||||
/* Fall through */
|
||||
default:
|
||||
rnd_bits = asn_random_between(pc->lower_bound,
|
||||
suggested_upper_bound);
|
||||
}
|
||||
} else {
|
||||
rnd_bits =
|
||||
asn_random_between(pc->lower_bound, suggested_upper_bound);
|
||||
}
|
||||
} else {
|
||||
rnd_bits = asn_random_between(0, max_length - 1);
|
||||
}
|
||||
} else if(rnd_bits >= max_length) {
|
||||
rnd_bits = asn_random_between(0, max_length - 1);
|
||||
}
|
||||
|
||||
rnd_len = (rnd_bits + 7) / 8;
|
||||
buf = CALLOC(1, rnd_len + 1);
|
||||
if(!buf) return result_failed;
|
||||
|
||||
bend = &buf[rnd_len];
|
||||
|
||||
for(b = buf; b < bend; b++) {
|
||||
*(uint8_t *)b = asn_random_between(0, 255);
|
||||
}
|
||||
*b = 0; /* Zero-terminate just in case. */
|
||||
|
||||
if(*sptr) {
|
||||
st = *sptr;
|
||||
FREEMEM(st->buf);
|
||||
} else {
|
||||
st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
|
||||
if(!st) {
|
||||
FREEMEM(buf);
|
||||
return result_failed;
|
||||
}
|
||||
}
|
||||
|
||||
st->buf = buf;
|
||||
st->size = rnd_len;
|
||||
st->bits_unused = (8 - (rnd_bits & 0x7)) & 0x7;
|
||||
if(st->bits_unused) {
|
||||
assert(st->size > 0);
|
||||
st->buf[st->size-1] &= 0xff << st->bits_unused;
|
||||
}
|
||||
|
||||
result_ok.length = st->size;
|
||||
return result_ok;
|
||||
}
|
||||
174
e2sm/lib/BIT_STRING_oer.c
Normal file
174
e2sm/lib/BIT_STRING_oer.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <BIT_STRING.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_dec_rval_t
|
||||
BIT_STRING_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, void **sptr,
|
||||
const void *ptr, size_t size) {
|
||||
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
|
||||
const asn_oer_constraints_t *cts =
|
||||
constraints ? constraints : td->encoding_constraints.oer_constraints;
|
||||
ssize_t ct_size = cts ? cts->size : -1;
|
||||
asn_dec_rval_t rval = {RC_OK, 0};
|
||||
size_t expected_length = 0;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
|
||||
if(!st) {
|
||||
st = (BIT_STRING_t *)(*sptr = CALLOC(1, sizeof(*st)));
|
||||
if(!st) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(ct_size >= 0) {
|
||||
expected_length = (ct_size + 7) >> 3;
|
||||
st->bits_unused = (8 - (ct_size & 7)) & 7;
|
||||
} else {
|
||||
/*
|
||||
* X.696 (08/2015) #13.3.1
|
||||
* Encode length determinant as _number of octets_, but only
|
||||
* if upper bound is not equal to lower bound.
|
||||
*/
|
||||
ssize_t len_len = oer_fetch_length(ptr, size, &expected_length);
|
||||
if(len_len > 0) {
|
||||
ptr = (const char *)ptr + len_len;
|
||||
size -= len_len;
|
||||
} else if(len_len == 0) {
|
||||
ASN__DECODE_STARVED;
|
||||
} else if(len_len < 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(expected_length < 1) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else if(expected_length > size) {
|
||||
ASN__DECODE_STARVED;
|
||||
}
|
||||
|
||||
st->bits_unused = ((const uint8_t *)ptr)[0];
|
||||
if(st->bits_unused & ~7) {
|
||||
ASN_DEBUG("%s: unused bits outside of 0..7 range", td->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
ptr = (const char *)ptr + 1;
|
||||
size--;
|
||||
expected_length--;
|
||||
rval.consumed = len_len + 1;
|
||||
}
|
||||
|
||||
if(size < expected_length) {
|
||||
ASN__DECODE_STARVED;
|
||||
} else {
|
||||
uint8_t *buf = MALLOC(expected_length + 1);
|
||||
if(buf == NULL) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
memcpy(buf, ptr, expected_length);
|
||||
buf[expected_length] = '\0';
|
||||
}
|
||||
FREEMEM(st->buf);
|
||||
st->buf = buf;
|
||||
st->size = expected_length;
|
||||
if(expected_length > 0) {
|
||||
buf[expected_length - 1] &= (0xff << st->bits_unused);
|
||||
}
|
||||
|
||||
rval.consumed += expected_length;
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
BIT_STRING_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
const void *sptr, asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
|
||||
asn_enc_rval_t erval = {0, 0, 0};
|
||||
const asn_oer_constraints_t *cts =
|
||||
constraints ? constraints : td->encoding_constraints.oer_constraints;
|
||||
ssize_t ct_size = cts ? cts->size : -1;
|
||||
size_t trailing_zeros = 0;
|
||||
int fix_last_byte = 0;
|
||||
|
||||
if(!st) ASN__ENCODE_FAILED;
|
||||
|
||||
if(st->bits_unused & ~7) {
|
||||
ASN_DEBUG("BIT STRING unused bits %d out of 0..7 range",
|
||||
st->bits_unused);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
if(st->bits_unused && !(st->size && st->buf)) {
|
||||
ASN_DEBUG("BIT STRING %s size 0 can't support unused bits %d", td->name,
|
||||
st->bits_unused);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(ct_size >= 0) {
|
||||
size_t ct_bytes = (ct_size + 7) >> 3;
|
||||
if(st->size > ct_bytes) {
|
||||
ASN_DEBUG("More bits in BIT STRING %s (%" ASN_PRI_SSIZE ") than constrained %" ASN_PRI_SSIZE "",
|
||||
td->name, 8 * st->size - st->bits_unused, ct_size);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
trailing_zeros = ct_bytes - st->size; /* Allow larger constraint */
|
||||
} else {
|
||||
uint8_t ub = st->bits_unused & 7;
|
||||
ssize_t len_len = oer_serialize_length(1 + st->size, cb, app_key);
|
||||
if(len_len < 0) ASN__ENCODE_FAILED;
|
||||
if(cb(&ub, 1, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
erval.encoded += len_len + 1;
|
||||
}
|
||||
|
||||
if(st->bits_unused) {
|
||||
if(st->buf[st->size - 1] & (0xff << st->bits_unused)) {
|
||||
fix_last_byte = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(cb(st->buf, st->size - fix_last_byte, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(fix_last_byte) {
|
||||
uint8_t b = st->buf[st->size - 1] & (0xff << st->bits_unused);
|
||||
if(cb(&b, 1, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
erval.encoded += st->size;
|
||||
|
||||
if(trailing_zeros) {
|
||||
static uint8_t zeros[16];
|
||||
while(trailing_zeros > 0) {
|
||||
int ret;
|
||||
if(trailing_zeros < sizeof(zeros)) {
|
||||
ret = cb(zeros, trailing_zeros, app_key);
|
||||
erval.encoded += trailing_zeros;
|
||||
} else {
|
||||
ret = cb(zeros, sizeof(zeros), app_key);
|
||||
erval.encoded += sizeof(zeros);
|
||||
}
|
||||
if(ret < 0) ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
return erval;
|
||||
}
|
||||
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
65
e2sm/lib/C-RNTI.c
Normal file
65
e2sm/lib/C-RNTI.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "C-RNTI.h"
|
||||
|
||||
int
|
||||
C_RNTI_constraint(const 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 == 2)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This type is implemented using OCTET_STRING,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_C_RNTI_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
2 /* (SIZE(2..2)) */};
|
||||
asn_per_constraints_t asn_PER_type_C_RNTI_constr_1 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 2, 2 } /* (SIZE(2..2)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_C_RNTI_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_C_RNTI = {
|
||||
"C-RNTI",
|
||||
"C-RNTI",
|
||||
&asn_OP_OCTET_STRING,
|
||||
asn_DEF_C_RNTI_tags_1,
|
||||
sizeof(asn_DEF_C_RNTI_tags_1)
|
||||
/sizeof(asn_DEF_C_RNTI_tags_1[0]), /* 1 */
|
||||
asn_DEF_C_RNTI_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_C_RNTI_tags_1)
|
||||
/sizeof(asn_DEF_C_RNTI_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_C_RNTI_constr_1, &asn_PER_type_C_RNTI_constr_1, C_RNTI_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_OCTET_STRING_specs /* Additional specs */
|
||||
};
|
||||
|
||||
140
e2sm/lib/CU-CP-Usage-Report-CellResourceReportItem.c
Normal file
140
e2sm/lib/CU-CP-Usage-Report-CellResourceReportItem.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-CP-Usage-Report-CellResourceReportItem.h"
|
||||
|
||||
#include "CU-CP-Usage-Report-UeResourceReportItem.h"
|
||||
static int
|
||||
memb_ueResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 32)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_ueResourceReportList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_CU_CP_Usage_Report_UeResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ueResourceReportList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_ueResourceReportList_specs_3 = {
|
||||
sizeof(struct CU_CP_Usage_Report_CellResourceReportItem__ueResourceReportList),
|
||||
offsetof(struct CU_CP_Usage_Report_CellResourceReportItem__ueResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_ueResourceReportList_3 = {
|
||||
"ueResourceReportList",
|
||||
"ueResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_ueResourceReportList_tags_3,
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_ueResourceReportList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_ueResourceReportList_constr_3, &asn_PER_type_ueResourceReportList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_ueResourceReportList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_ueResourceReportList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CU_CP_Usage_Report_CellResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_CP_Usage_Report_CellResourceReportItem, nRCGI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCGI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCGI"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_CP_Usage_Report_CellResourceReportItem, ueResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_ueResourceReportList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_ueResourceReportList_constr_3, &asn_PER_memb_ueResourceReportList_constr_3, memb_ueResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ueResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_CP_Usage_Report_CellResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nRCGI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ueResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_CP_Usage_Report_CellResourceReportItem_specs_1 = {
|
||||
sizeof(struct CU_CP_Usage_Report_CellResourceReportItem),
|
||||
offsetof(struct CU_CP_Usage_Report_CellResourceReportItem, _asn_ctx),
|
||||
asn_MAP_CU_CP_Usage_Report_CellResourceReportItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_CP_Usage_Report_CellResourceReportItem = {
|
||||
"CU-CP-Usage-Report-CellResourceReportItem",
|
||||
"CU-CP-Usage-Report-CellResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_CP_Usage_Report_CellResourceReportItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_CU_CP_Usage_Report_CellResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/CU-CP-Usage-Report-Per-UE.c
Normal file
130
e2sm/lib/CU-CP-Usage-Report-Per-UE.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-CP-Usage-Report-Per-UE.h"
|
||||
|
||||
#include "CU-CP-Usage-Report-CellResourceReportItem.h"
|
||||
static int
|
||||
memb_cellResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 16384)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..16384)) */};
|
||||
static asn_per_constraints_t asn_PER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 14, 14, 1, 16384 } /* (SIZE(1..16384)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..16384)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 14, 14, 1, 16384 } /* (SIZE(1..16384)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_cellResourceReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_CU_CP_Usage_Report_CellResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_cellResourceReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_cellResourceReportList_specs_2 = {
|
||||
sizeof(struct CU_CP_Usage_Report_Per_UE__cellResourceReportList),
|
||||
offsetof(struct CU_CP_Usage_Report_Per_UE__cellResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_cellResourceReportList_2 = {
|
||||
"cellResourceReportList",
|
||||
"cellResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_cellResourceReportList_tags_2,
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_cellResourceReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_cellResourceReportList_constr_2, &asn_PER_type_cellResourceReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_cellResourceReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_cellResourceReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CU_CP_Usage_Report_Per_UE_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_CP_Usage_Report_Per_UE, cellResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_cellResourceReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_cellResourceReportList_constr_2, &asn_PER_memb_cellResourceReportList_constr_2, memb_cellResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"cellResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_CP_Usage_Report_Per_UE_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* cellResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_CP_Usage_Report_Per_UE_specs_1 = {
|
||||
sizeof(struct CU_CP_Usage_Report_Per_UE),
|
||||
offsetof(struct CU_CP_Usage_Report_Per_UE, _asn_ctx),
|
||||
asn_MAP_CU_CP_Usage_Report_Per_UE_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_CP_Usage_Report_Per_UE = {
|
||||
"CU-CP-Usage-Report-Per-UE",
|
||||
"CU-CP-Usage-Report-Per-UE",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1,
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_CP_Usage_Report_Per_UE_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_CU_CP_Usage_Report_Per_UE_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
72
e2sm/lib/CU-CP-Usage-Report-UeResourceReportItem.c
Normal file
72
e2sm/lib/CU-CP-Usage-Report-UeResourceReportItem.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-CP-Usage-Report-UeResourceReportItem.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CU_CP_Usage_Report_UeResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_CP_Usage_Report_UeResourceReportItem, c_RNTI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_C_RNTI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"c-RNTI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct CU_CP_Usage_Report_UeResourceReportItem, serving_Cell_RF_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"serving-Cell-RF-Type"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct CU_CP_Usage_Report_UeResourceReportItem, neighbor_Cell_RF),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"neighbor-Cell-RF"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_CU_CP_Usage_Report_UeResourceReportItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_CP_Usage_Report_UeResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* c-RNTI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* serving-Cell-RF-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* neighbor-Cell-RF */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_CP_Usage_Report_UeResourceReportItem_specs_1 = {
|
||||
sizeof(struct CU_CP_Usage_Report_UeResourceReportItem),
|
||||
offsetof(struct CU_CP_Usage_Report_UeResourceReportItem, _asn_ctx),
|
||||
asn_MAP_CU_CP_Usage_Report_UeResourceReportItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_CU_CP_Usage_Report_UeResourceReportItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_CP_Usage_Report_UeResourceReportItem = {
|
||||
"CU-CP-Usage-Report-UeResourceReportItem",
|
||||
"CU-CP-Usage-Report-UeResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_CP_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_CP_Usage_Report_UeResourceReportItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_CU_CP_Usage_Report_UeResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
140
e2sm/lib/CU-UP-Usage-Report-CellResourceReportItem.c
Normal file
140
e2sm/lib/CU-UP-Usage-Report-CellResourceReportItem.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-UP-Usage-Report-CellResourceReportItem.h"
|
||||
|
||||
#include "CU-UP-Usage-Report-UeResourceReportItem.h"
|
||||
static int
|
||||
memb_ueResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 32)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_ueResourceReportList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_CU_UP_Usage_Report_UeResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ueResourceReportList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_ueResourceReportList_specs_3 = {
|
||||
sizeof(struct CU_UP_Usage_Report_CellResourceReportItem__ueResourceReportList),
|
||||
offsetof(struct CU_UP_Usage_Report_CellResourceReportItem__ueResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_ueResourceReportList_3 = {
|
||||
"ueResourceReportList",
|
||||
"ueResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_ueResourceReportList_tags_3,
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_ueResourceReportList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_ueResourceReportList_constr_3, &asn_PER_type_ueResourceReportList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_ueResourceReportList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_ueResourceReportList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CU_UP_Usage_Report_CellResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_UP_Usage_Report_CellResourceReportItem, nRCGI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCGI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCGI"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_UP_Usage_Report_CellResourceReportItem, ueResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_ueResourceReportList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_ueResourceReportList_constr_3, &asn_PER_memb_ueResourceReportList_constr_3, memb_ueResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ueResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_UP_Usage_Report_CellResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nRCGI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ueResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_UP_Usage_Report_CellResourceReportItem_specs_1 = {
|
||||
sizeof(struct CU_UP_Usage_Report_CellResourceReportItem),
|
||||
offsetof(struct CU_UP_Usage_Report_CellResourceReportItem, _asn_ctx),
|
||||
asn_MAP_CU_UP_Usage_Report_CellResourceReportItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_UP_Usage_Report_CellResourceReportItem = {
|
||||
"CU-UP-Usage-Report-CellResourceReportItem",
|
||||
"CU-UP-Usage-Report-CellResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_UP_Usage_Report_CellResourceReportItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_CU_UP_Usage_Report_CellResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/CU-UP-Usage-Report-Per-UE.c
Normal file
130
e2sm/lib/CU-UP-Usage-Report-Per-UE.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-UP-Usage-Report-Per-UE.h"
|
||||
|
||||
#include "CU-UP-Usage-Report-CellResourceReportItem.h"
|
||||
static int
|
||||
memb_cellResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 512)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_cellResourceReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_CU_UP_Usage_Report_CellResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_cellResourceReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_cellResourceReportList_specs_2 = {
|
||||
sizeof(struct CU_UP_Usage_Report_Per_UE__cellResourceReportList),
|
||||
offsetof(struct CU_UP_Usage_Report_Per_UE__cellResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_cellResourceReportList_2 = {
|
||||
"cellResourceReportList",
|
||||
"cellResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_cellResourceReportList_tags_2,
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_cellResourceReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_cellResourceReportList_constr_2, &asn_PER_type_cellResourceReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_cellResourceReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_cellResourceReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CU_UP_Usage_Report_Per_UE_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_UP_Usage_Report_Per_UE, cellResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_cellResourceReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_cellResourceReportList_constr_2, &asn_PER_memb_cellResourceReportList_constr_2, memb_cellResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"cellResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_UP_Usage_Report_Per_UE_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* cellResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_UP_Usage_Report_Per_UE_specs_1 = {
|
||||
sizeof(struct CU_UP_Usage_Report_Per_UE),
|
||||
offsetof(struct CU_UP_Usage_Report_Per_UE, _asn_ctx),
|
||||
asn_MAP_CU_UP_Usage_Report_Per_UE_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_UP_Usage_Report_Per_UE = {
|
||||
"CU-UP-Usage-Report-Per-UE",
|
||||
"CU-UP-Usage-Report-Per-UE",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1,
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_UP_Usage_Report_Per_UE_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_CU_UP_Usage_Report_Per_UE_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
150
e2sm/lib/CU-UP-Usage-Report-UeResourceReportItem.c
Normal file
150
e2sm/lib/CU-UP-Usage-Report-UeResourceReportItem.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CU-UP-Usage-Report-UeResourceReportItem.h"
|
||||
|
||||
static int
|
||||
memb_pDCPBytesDL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_pDCPBytesUL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_CU_UP_Usage_Report_UeResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CU_UP_Usage_Report_UeResourceReportItem, c_RNTI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_C_RNTI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"c-RNTI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct CU_UP_Usage_Report_UeResourceReportItem, pDCPBytesDL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesDL_constr_3, &asn_PER_memb_pDCPBytesDL_constr_3, memb_pDCPBytesDL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesDL"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct CU_UP_Usage_Report_UeResourceReportItem, pDCPBytesUL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesUL_constr_4, &asn_PER_memb_pDCPBytesUL_constr_4, memb_pDCPBytesUL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesUL"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_CU_UP_Usage_Report_UeResourceReportItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CU_UP_Usage_Report_UeResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* c-RNTI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pDCPBytesDL */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* pDCPBytesUL */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CU_UP_Usage_Report_UeResourceReportItem_specs_1 = {
|
||||
sizeof(struct CU_UP_Usage_Report_UeResourceReportItem),
|
||||
offsetof(struct CU_UP_Usage_Report_UeResourceReportItem, _asn_ctx),
|
||||
asn_MAP_CU_UP_Usage_Report_UeResourceReportItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_CU_UP_Usage_Report_UeResourceReportItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CU_UP_Usage_Report_UeResourceReportItem = {
|
||||
"CU-UP-Usage-Report-UeResourceReportItem",
|
||||
"CU-UP-Usage-Report-UeResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_CU_UP_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CU_UP_Usage_Report_UeResourceReportItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_CU_UP_Usage_Report_UeResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/CUUPMeasurement-Container.c
Normal file
130
e2sm/lib/CUUPMeasurement-Container.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CUUPMeasurement-Container.h"
|
||||
|
||||
#include "PlmnID-List.h"
|
||||
static int
|
||||
memb_plmnList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 12)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_plmnList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..12)) */};
|
||||
static asn_per_constraints_t asn_PER_type_plmnList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_plmnList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..12)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_plmnList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_plmnList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_PlmnID_List,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_plmnList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_plmnList_specs_2 = {
|
||||
sizeof(struct CUUPMeasurement_Container__plmnList),
|
||||
offsetof(struct CUUPMeasurement_Container__plmnList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_plmnList_2 = {
|
||||
"plmnList",
|
||||
"plmnList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_plmnList_tags_2,
|
||||
sizeof(asn_DEF_plmnList_tags_2)
|
||||
/sizeof(asn_DEF_plmnList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_plmnList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_plmnList_tags_2)
|
||||
/sizeof(asn_DEF_plmnList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_plmnList_constr_2, &asn_PER_type_plmnList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_plmnList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_plmnList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CUUPMeasurement_Container_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CUUPMeasurement_Container, plmnList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_plmnList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_plmnList_constr_2, &asn_PER_memb_plmnList_constr_2, memb_plmnList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"plmnList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_CUUPMeasurement_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CUUPMeasurement_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* plmnList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CUUPMeasurement_Container_specs_1 = {
|
||||
sizeof(struct CUUPMeasurement_Container),
|
||||
offsetof(struct CUUPMeasurement_Container, _asn_ctx),
|
||||
asn_MAP_CUUPMeasurement_Container_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CUUPMeasurement_Container = {
|
||||
"CUUPMeasurement-Container",
|
||||
"CUUPMeasurement-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CUUPMeasurement_Container_tags_1,
|
||||
sizeof(asn_DEF_CUUPMeasurement_Container_tags_1)
|
||||
/sizeof(asn_DEF_CUUPMeasurement_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_CUUPMeasurement_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CUUPMeasurement_Container_tags_1)
|
||||
/sizeof(asn_DEF_CUUPMeasurement_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CUUPMeasurement_Container_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_CUUPMeasurement_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
228
e2sm/lib/CellResourceReportListItem.c
Normal file
228
e2sm/lib/CellResourceReportListItem.c
Normal file
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "CellResourceReportListItem.h"
|
||||
|
||||
#include "ServedPlmnPerCellListItem.h"
|
||||
static int
|
||||
memb_dl_TotalofAvailablePRBs_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 273)) {
|
||||
/* 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_ul_TotalofAvailablePRBs_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 273)) {
|
||||
/* 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_servedPlmnPerCellList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 12)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_servedPlmnPerCellList_constr_5 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..12)) */};
|
||||
static asn_per_constraints_t asn_PER_type_servedPlmnPerCellList_constr_5 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_dl_TotalofAvailablePRBs_constr_3 CC_NOTUSED = {
|
||||
{ 2, 1 } /* (0..273) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_dl_TotalofAvailablePRBs_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 9, 9, 0, 273 } /* (0..273) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ul_TotalofAvailablePRBs_constr_4 CC_NOTUSED = {
|
||||
{ 2, 1 } /* (0..273) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_ul_TotalofAvailablePRBs_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 9, 9, 0, 273 } /* (0..273) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_servedPlmnPerCellList_constr_5 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..12)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_servedPlmnPerCellList_constr_5 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 12 } /* (SIZE(1..12)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_servedPlmnPerCellList_5[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_ServedPlmnPerCellListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_servedPlmnPerCellList_tags_5[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_servedPlmnPerCellList_specs_5 = {
|
||||
sizeof(struct CellResourceReportListItem__servedPlmnPerCellList),
|
||||
offsetof(struct CellResourceReportListItem__servedPlmnPerCellList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_servedPlmnPerCellList_5 = {
|
||||
"servedPlmnPerCellList",
|
||||
"servedPlmnPerCellList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_servedPlmnPerCellList_tags_5,
|
||||
sizeof(asn_DEF_servedPlmnPerCellList_tags_5)
|
||||
/sizeof(asn_DEF_servedPlmnPerCellList_tags_5[0]) - 1, /* 1 */
|
||||
asn_DEF_servedPlmnPerCellList_tags_5, /* Same as above */
|
||||
sizeof(asn_DEF_servedPlmnPerCellList_tags_5)
|
||||
/sizeof(asn_DEF_servedPlmnPerCellList_tags_5[0]), /* 2 */
|
||||
{ &asn_OER_type_servedPlmnPerCellList_constr_5, &asn_PER_type_servedPlmnPerCellList_constr_5, SEQUENCE_OF_constraint },
|
||||
asn_MBR_servedPlmnPerCellList_5,
|
||||
1, /* Single element */
|
||||
&asn_SPC_servedPlmnPerCellList_specs_5 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_CellResourceReportListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CellResourceReportListItem, nRCGI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCGI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCGI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct CellResourceReportListItem, dl_TotalofAvailablePRBs),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_dl_TotalofAvailablePRBs_constr_3, &asn_PER_memb_dl_TotalofAvailablePRBs_constr_3, memb_dl_TotalofAvailablePRBs_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"dl-TotalofAvailablePRBs"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct CellResourceReportListItem, ul_TotalofAvailablePRBs),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_ul_TotalofAvailablePRBs_constr_4, &asn_PER_memb_ul_TotalofAvailablePRBs_constr_4, memb_ul_TotalofAvailablePRBs_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ul-TotalofAvailablePRBs"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct CellResourceReportListItem, servedPlmnPerCellList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
0,
|
||||
&asn_DEF_servedPlmnPerCellList_5,
|
||||
0,
|
||||
{ &asn_OER_memb_servedPlmnPerCellList_constr_5, &asn_PER_memb_servedPlmnPerCellList_constr_5, memb_servedPlmnPerCellList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"servedPlmnPerCellList"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_CellResourceReportListItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_CellResourceReportListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_CellResourceReportListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nRCGI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dl-TotalofAvailablePRBs */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ul-TotalofAvailablePRBs */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* servedPlmnPerCellList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_CellResourceReportListItem_specs_1 = {
|
||||
sizeof(struct CellResourceReportListItem),
|
||||
offsetof(struct CellResourceReportListItem, _asn_ctx),
|
||||
asn_MAP_CellResourceReportListItem_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
asn_MAP_CellResourceReportListItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
4, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_CellResourceReportListItem = {
|
||||
"CellResourceReportListItem",
|
||||
"CellResourceReportListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_CellResourceReportListItem_tags_1,
|
||||
sizeof(asn_DEF_CellResourceReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_CellResourceReportListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_CellResourceReportListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_CellResourceReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_CellResourceReportListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_CellResourceReportListItem_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_CellResourceReportListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
140
e2sm/lib/DU-Usage-Report-CellResourceReportItem.c
Normal file
140
e2sm/lib/DU-Usage-Report-CellResourceReportItem.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "DU-Usage-Report-CellResourceReportItem.h"
|
||||
|
||||
#include "DU-Usage-Report-UeResourceReportItem.h"
|
||||
static int
|
||||
memb_ueResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 32)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_type_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..32)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ueResourceReportList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_ueResourceReportList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_DU_Usage_Report_UeResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ueResourceReportList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_ueResourceReportList_specs_3 = {
|
||||
sizeof(struct DU_Usage_Report_CellResourceReportItem__ueResourceReportList),
|
||||
offsetof(struct DU_Usage_Report_CellResourceReportItem__ueResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_ueResourceReportList_3 = {
|
||||
"ueResourceReportList",
|
||||
"ueResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_ueResourceReportList_tags_3,
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_ueResourceReportList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_ueResourceReportList_tags_3)
|
||||
/sizeof(asn_DEF_ueResourceReportList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_ueResourceReportList_constr_3, &asn_PER_type_ueResourceReportList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_ueResourceReportList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_ueResourceReportList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_DU_Usage_Report_CellResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct DU_Usage_Report_CellResourceReportItem, nRCGI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCGI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCGI"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct DU_Usage_Report_CellResourceReportItem, ueResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_ueResourceReportList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_ueResourceReportList_constr_3, &asn_PER_memb_ueResourceReportList_constr_3, memb_ueResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ueResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_DU_Usage_Report_CellResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* nRCGI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ueResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_DU_Usage_Report_CellResourceReportItem_specs_1 = {
|
||||
sizeof(struct DU_Usage_Report_CellResourceReportItem),
|
||||
offsetof(struct DU_Usage_Report_CellResourceReportItem, _asn_ctx),
|
||||
asn_MAP_DU_Usage_Report_CellResourceReportItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_DU_Usage_Report_CellResourceReportItem = {
|
||||
"DU-Usage-Report-CellResourceReportItem",
|
||||
"DU-Usage-Report-CellResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_CellResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_DU_Usage_Report_CellResourceReportItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_DU_Usage_Report_CellResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/DU-Usage-Report-Per-UE.c
Normal file
130
e2sm/lib/DU-Usage-Report-Per-UE.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "DU-Usage-Report-Per-UE.h"
|
||||
|
||||
#include "DU-Usage-Report-CellResourceReportItem.h"
|
||||
static int
|
||||
memb_cellResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 512)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_cellResourceReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_DU_Usage_Report_CellResourceReportItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_cellResourceReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_cellResourceReportList_specs_2 = {
|
||||
sizeof(struct DU_Usage_Report_Per_UE__cellResourceReportList),
|
||||
offsetof(struct DU_Usage_Report_Per_UE__cellResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_cellResourceReportList_2 = {
|
||||
"cellResourceReportList",
|
||||
"cellResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_cellResourceReportList_tags_2,
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_cellResourceReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_cellResourceReportList_constr_2, &asn_PER_type_cellResourceReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_cellResourceReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_cellResourceReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_DU_Usage_Report_Per_UE_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct DU_Usage_Report_Per_UE, cellResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_cellResourceReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_cellResourceReportList_constr_2, &asn_PER_memb_cellResourceReportList_constr_2, memb_cellResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"cellResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_DU_Usage_Report_Per_UE_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_DU_Usage_Report_Per_UE_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* cellResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_DU_Usage_Report_Per_UE_specs_1 = {
|
||||
sizeof(struct DU_Usage_Report_Per_UE),
|
||||
offsetof(struct DU_Usage_Report_Per_UE, _asn_ctx),
|
||||
asn_MAP_DU_Usage_Report_Per_UE_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_DU_Usage_Report_Per_UE = {
|
||||
"DU-Usage-Report-Per-UE",
|
||||
"DU-Usage-Report-Per-UE",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_DU_Usage_Report_Per_UE_tags_1,
|
||||
sizeof(asn_DEF_DU_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
asn_DEF_DU_Usage_Report_Per_UE_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_DU_Usage_Report_Per_UE_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_Per_UE_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_DU_Usage_Report_Per_UE_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_DU_Usage_Report_Per_UE_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
138
e2sm/lib/DU-Usage-Report-UeResourceReportItem.c
Normal file
138
e2sm/lib/DU-Usage-Report-UeResourceReportItem.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "DU-Usage-Report-UeResourceReportItem.h"
|
||||
|
||||
static int
|
||||
memb_dl_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 1000000000)) {
|
||||
/* 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_ul_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 1000000000)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 30, -1, 0, 1000000000 } /* (0..1000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 30, -1, 0, 1000000000 } /* (0..1000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_DU_Usage_Report_UeResourceReportItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct DU_Usage_Report_UeResourceReportItem, c_RNTI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_C_RNTI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"c-RNTI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct DU_Usage_Report_UeResourceReportItem, dl_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_dl_PRBUsage_constr_3, &asn_PER_memb_dl_PRBUsage_constr_3, memb_dl_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"dl-PRBUsage"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct DU_Usage_Report_UeResourceReportItem, ul_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_ul_PRBUsage_constr_4, &asn_PER_memb_ul_PRBUsage_constr_4, memb_ul_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ul-PRBUsage"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_DU_Usage_Report_UeResourceReportItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_DU_Usage_Report_UeResourceReportItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* c-RNTI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dl-PRBUsage */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ul-PRBUsage */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_DU_Usage_Report_UeResourceReportItem_specs_1 = {
|
||||
sizeof(struct DU_Usage_Report_UeResourceReportItem),
|
||||
offsetof(struct DU_Usage_Report_UeResourceReportItem, _asn_ctx),
|
||||
asn_MAP_DU_Usage_Report_UeResourceReportItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_DU_Usage_Report_UeResourceReportItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_DU_Usage_Report_UeResourceReportItem = {
|
||||
"DU-Usage-Report-UeResourceReportItem",
|
||||
"DU-Usage-Report-UeResourceReportItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1,
|
||||
sizeof(asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1)
|
||||
/sizeof(asn_DEF_DU_Usage_Report_UeResourceReportItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_DU_Usage_Report_UeResourceReportItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_DU_Usage_Report_UeResourceReportItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
50
e2sm/lib/E2SM-KPM-ActionDefinition.c
Normal file
50
e2sm/lib/E2SM-KPM-ActionDefinition.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-ActionDefinition.h"
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_E2SM_KPM_ActionDefinition_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_ActionDefinition, ric_Style_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-Style-Type"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_ActionDefinition_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_ActionDefinition_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* ric-Style-Type */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_ActionDefinition_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_ActionDefinition),
|
||||
offsetof(struct E2SM_KPM_ActionDefinition, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_ActionDefinition_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_ActionDefinition = {
|
||||
"E2SM-KPM-ActionDefinition",
|
||||
"E2SM-KPM-ActionDefinition",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_ActionDefinition_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_ActionDefinition_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_ActionDefinition_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_ActionDefinition_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_ActionDefinition_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_ActionDefinition_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_ActionDefinition_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_ActionDefinition_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
132
e2sm/lib/E2SM-KPM-EventTriggerDefinition-Format1.c
Normal file
132
e2sm/lib/E2SM-KPM-EventTriggerDefinition-Format1.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-EventTriggerDefinition-Format1.h"
|
||||
|
||||
#include "Trigger-ConditionIE-Item.h"
|
||||
static int
|
||||
memb_policyTest_List_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 15)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_policyTest_List_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..15)) */};
|
||||
static asn_per_constraints_t asn_PER_type_policyTest_List_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_policyTest_List_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..15)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_policyTest_List_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 1, 15 } /* (SIZE(1..15)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_policyTest_List_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_Trigger_ConditionIE_Item,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_policyTest_List_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_policyTest_List_specs_2 = {
|
||||
sizeof(struct E2SM_KPM_EventTriggerDefinition_Format1__policyTest_List),
|
||||
offsetof(struct E2SM_KPM_EventTriggerDefinition_Format1__policyTest_List, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_policyTest_List_2 = {
|
||||
"policyTest-List",
|
||||
"policyTest-List",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_policyTest_List_tags_2,
|
||||
sizeof(asn_DEF_policyTest_List_tags_2)
|
||||
/sizeof(asn_DEF_policyTest_List_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_policyTest_List_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_policyTest_List_tags_2)
|
||||
/sizeof(asn_DEF_policyTest_List_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_policyTest_List_constr_2, &asn_PER_type_policyTest_List_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_policyTest_List_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_policyTest_List_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_E2SM_KPM_EventTriggerDefinition_Format1_1[] = {
|
||||
{ ATF_POINTER, 1, offsetof(struct E2SM_KPM_EventTriggerDefinition_Format1, policyTest_List),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_policyTest_List_2,
|
||||
0,
|
||||
{ &asn_OER_memb_policyTest_List_constr_2, &asn_PER_memb_policyTest_List_constr_2, memb_policyTest_List_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"policyTest-List"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_E2SM_KPM_EventTriggerDefinition_Format1_oms_1[] = { 0 };
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_EventTriggerDefinition_Format1_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* policyTest-List */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_EventTriggerDefinition_Format1_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_EventTriggerDefinition_Format1),
|
||||
offsetof(struct E2SM_KPM_EventTriggerDefinition_Format1, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_EventTriggerDefinition_Format1_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
asn_MAP_E2SM_KPM_EventTriggerDefinition_Format1_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1 = {
|
||||
"E2SM-KPM-EventTriggerDefinition-Format1",
|
||||
"E2SM-KPM-EventTriggerDefinition-Format1",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_EventTriggerDefinition_Format1_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_EventTriggerDefinition_Format1_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
56
e2sm/lib/E2SM-KPM-EventTriggerDefinition.c
Normal file
56
e2sm/lib/E2SM-KPM-EventTriggerDefinition.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-EventTriggerDefinition.h"
|
||||
|
||||
#include "E2SM-KPM-EventTriggerDefinition-Format1.h"
|
||||
static asn_oer_constraints_t asn_OER_type_E2SM_KPM_EventTriggerDefinition_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_type_E2SM_KPM_EventTriggerDefinition_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_E2SM_KPM_EventTriggerDefinition_1[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct E2SM_KPM_EventTriggerDefinition, choice.eventDefinition_Format1),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_E2SM_KPM_EventTriggerDefinition_Format1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"eventDefinition-Format1"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_EventTriggerDefinition_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* eventDefinition-Format1 */
|
||||
};
|
||||
static asn_CHOICE_specifics_t asn_SPC_E2SM_KPM_EventTriggerDefinition_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_EventTriggerDefinition),
|
||||
offsetof(struct E2SM_KPM_EventTriggerDefinition, _asn_ctx),
|
||||
offsetof(struct E2SM_KPM_EventTriggerDefinition, present),
|
||||
sizeof(((struct E2SM_KPM_EventTriggerDefinition *)0)->present),
|
||||
asn_MAP_E2SM_KPM_EventTriggerDefinition_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0,
|
||||
1 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_EventTriggerDefinition = {
|
||||
"E2SM-KPM-EventTriggerDefinition",
|
||||
"E2SM-KPM-EventTriggerDefinition",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_E2SM_KPM_EventTriggerDefinition_constr_1, &asn_PER_type_E2SM_KPM_EventTriggerDefinition_constr_1, CHOICE_constraint },
|
||||
asn_MBR_E2SM_KPM_EventTriggerDefinition_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_EventTriggerDefinition_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
213
e2sm/lib/E2SM-KPM-IndicationHeader-Format1.c
Normal file
213
e2sm/lib/E2SM-KPM-IndicationHeader-Format1.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-IndicationHeader-Format1.h"
|
||||
|
||||
#include "GlobalKPMnode-ID.h"
|
||||
#include "NRCGI.h"
|
||||
#include "SNSSAI.h"
|
||||
#include "GNB-Name.h"
|
||||
#include "GlobalgNB-ID.h"
|
||||
static int
|
||||
memb_fiveQI_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_qci_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_fiveQI_constr_6 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_fiveQI_constr_6 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_qci_constr_7 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_qci_constr_7 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_E2SM_KPM_IndicationHeader_Format1_1[] = {
|
||||
{ ATF_POINTER, 10, offsetof(struct E2SM_KPM_IndicationHeader_Format1, id_GlobalKPMnode_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_GlobalKPMnode_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"id-GlobalKPMnode-ID"
|
||||
},
|
||||
{ ATF_POINTER, 9, offsetof(struct E2SM_KPM_IndicationHeader_Format1, nRCGI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCGI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCGI"
|
||||
},
|
||||
{ ATF_POINTER, 8, offsetof(struct E2SM_KPM_IndicationHeader_Format1, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_POINTER, 7, offsetof(struct E2SM_KPM_IndicationHeader_Format1, sliceID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_SNSSAI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"sliceID"
|
||||
},
|
||||
{ ATF_POINTER, 6, offsetof(struct E2SM_KPM_IndicationHeader_Format1, fiveQI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_fiveQI_constr_6, &asn_PER_memb_fiveQI_constr_6, memb_fiveQI_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"fiveQI"
|
||||
},
|
||||
{ ATF_POINTER, 5, offsetof(struct E2SM_KPM_IndicationHeader_Format1, qci),
|
||||
(ASN_TAG_CLASS_CONTEXT | (5 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_qci_constr_7, &asn_PER_memb_qci_constr_7, memb_qci_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"qci"
|
||||
},
|
||||
{ ATF_POINTER, 4, offsetof(struct E2SM_KPM_IndicationHeader_Format1, message_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (6 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_UE_Report_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"message-Type"
|
||||
},
|
||||
{ ATF_POINTER, 3, offsetof(struct E2SM_KPM_IndicationHeader_Format1, gNB_DU_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (7 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_DU_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-DU-ID"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct E2SM_KPM_IndicationHeader_Format1, gNB_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (8 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_GNB_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-Name"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct E2SM_KPM_IndicationHeader_Format1, global_GNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (9 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalgNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"global-GNB-ID"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_E2SM_KPM_IndicationHeader_Format1_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_IndicationHeader_Format1_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* id-GlobalKPMnode-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* nRCGI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* sliceID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* fiveQI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* qci */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* message-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* gNB-DU-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* gNB-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* global-GNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_IndicationHeader_Format1_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_IndicationHeader_Format1),
|
||||
offsetof(struct E2SM_KPM_IndicationHeader_Format1, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_IndicationHeader_Format1_tag2el_1,
|
||||
10, /* Count of tags in the map */
|
||||
asn_MAP_E2SM_KPM_IndicationHeader_Format1_oms_1, /* Optional members */
|
||||
10, 0, /* Root/Additions */
|
||||
10, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_IndicationHeader_Format1 = {
|
||||
"E2SM-KPM-IndicationHeader-Format1",
|
||||
"E2SM-KPM-IndicationHeader-Format1",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationHeader_Format1_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_IndicationHeader_Format1_1,
|
||||
10, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_IndicationHeader_Format1_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
56
e2sm/lib/E2SM-KPM-IndicationHeader.c
Normal file
56
e2sm/lib/E2SM-KPM-IndicationHeader.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-IndicationHeader.h"
|
||||
|
||||
#include "E2SM-KPM-IndicationHeader-Format1.h"
|
||||
static asn_oer_constraints_t asn_OER_type_E2SM_KPM_IndicationHeader_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_type_E2SM_KPM_IndicationHeader_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_E2SM_KPM_IndicationHeader_1[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct E2SM_KPM_IndicationHeader, choice.indicationHeader_Format1),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_E2SM_KPM_IndicationHeader_Format1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"indicationHeader-Format1"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_IndicationHeader_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* indicationHeader-Format1 */
|
||||
};
|
||||
static asn_CHOICE_specifics_t asn_SPC_E2SM_KPM_IndicationHeader_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_IndicationHeader),
|
||||
offsetof(struct E2SM_KPM_IndicationHeader, _asn_ctx),
|
||||
offsetof(struct E2SM_KPM_IndicationHeader, present),
|
||||
sizeof(((struct E2SM_KPM_IndicationHeader *)0)->present),
|
||||
asn_MAP_E2SM_KPM_IndicationHeader_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0,
|
||||
1 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_IndicationHeader = {
|
||||
"E2SM-KPM-IndicationHeader",
|
||||
"E2SM-KPM-IndicationHeader",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_E2SM_KPM_IndicationHeader_constr_1, &asn_PER_type_E2SM_KPM_IndicationHeader_constr_1, CHOICE_constraint },
|
||||
asn_MBR_E2SM_KPM_IndicationHeader_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_IndicationHeader_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/E2SM-KPM-IndicationMessage-Format1.c
Normal file
130
e2sm/lib/E2SM-KPM-IndicationMessage-Format1.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-IndicationMessage-Format1.h"
|
||||
|
||||
#include "PM-Containers-List.h"
|
||||
static int
|
||||
memb_pm_Containers_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 8)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_pm_Containers_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..8)) */};
|
||||
static asn_per_constraints_t asn_PER_type_pm_Containers_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pm_Containers_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..8)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_pm_Containers_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 3, 3, 1, 8 } /* (SIZE(1..8)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_pm_Containers_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_PM_Containers_List,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_pm_Containers_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_pm_Containers_specs_2 = {
|
||||
sizeof(struct E2SM_KPM_IndicationMessage_Format1__pm_Containers),
|
||||
offsetof(struct E2SM_KPM_IndicationMessage_Format1__pm_Containers, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_pm_Containers_2 = {
|
||||
"pm-Containers",
|
||||
"pm-Containers",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_pm_Containers_tags_2,
|
||||
sizeof(asn_DEF_pm_Containers_tags_2)
|
||||
/sizeof(asn_DEF_pm_Containers_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_pm_Containers_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_pm_Containers_tags_2)
|
||||
/sizeof(asn_DEF_pm_Containers_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_pm_Containers_constr_2, &asn_PER_type_pm_Containers_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_pm_Containers_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_pm_Containers_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_E2SM_KPM_IndicationMessage_Format1_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_IndicationMessage_Format1, pm_Containers),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_pm_Containers_2,
|
||||
0,
|
||||
{ &asn_OER_memb_pm_Containers_constr_2, &asn_PER_memb_pm_Containers_constr_2, memb_pm_Containers_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pm-Containers"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_IndicationMessage_Format1_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* pm-Containers */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_IndicationMessage_Format1_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_IndicationMessage_Format1),
|
||||
offsetof(struct E2SM_KPM_IndicationMessage_Format1, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_IndicationMessage_Format1_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_IndicationMessage_Format1 = {
|
||||
"E2SM-KPM-IndicationMessage-Format1",
|
||||
"E2SM-KPM-IndicationMessage-Format1",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationMessage_Format1_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_IndicationMessage_Format1_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_IndicationMessage_Format1_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
108
e2sm/lib/E2SM-KPM-IndicationMessage.c
Normal file
108
e2sm/lib/E2SM-KPM-IndicationMessage.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-IndicationMessage.h"
|
||||
|
||||
#include "E2SM-KPM-IndicationMessage-Format1.h"
|
||||
static asn_oer_constraints_t asn_OER_type_indicationMessage_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_type_indicationMessage_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_indicationMessage_3[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct E2SM_KPM_IndicationMessage__indicationMessage, choice.indicationMessage_Format1),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_E2SM_KPM_IndicationMessage_Format1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"indicationMessage-Format1"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_indicationMessage_tag2el_3[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* indicationMessage-Format1 */
|
||||
};
|
||||
static asn_CHOICE_specifics_t asn_SPC_indicationMessage_specs_3 = {
|
||||
sizeof(struct E2SM_KPM_IndicationMessage__indicationMessage),
|
||||
offsetof(struct E2SM_KPM_IndicationMessage__indicationMessage, _asn_ctx),
|
||||
offsetof(struct E2SM_KPM_IndicationMessage__indicationMessage, present),
|
||||
sizeof(((struct E2SM_KPM_IndicationMessage__indicationMessage *)0)->present),
|
||||
asn_MAP_indicationMessage_tag2el_3,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0,
|
||||
1 /* Extensions start */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_indicationMessage_3 = {
|
||||
"indicationMessage",
|
||||
"indicationMessage",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_indicationMessage_constr_3, &asn_PER_type_indicationMessage_constr_3, CHOICE_constraint },
|
||||
asn_MBR_indicationMessage_3,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_indicationMessage_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_E2SM_KPM_IndicationMessage_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_IndicationMessage, ric_Style_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-Style-Type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_IndicationMessage, indicationMessage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_indicationMessage_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"indicationMessage"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_IndicationMessage_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_IndicationMessage_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ric-Style-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* indicationMessage */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_IndicationMessage_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_IndicationMessage),
|
||||
offsetof(struct E2SM_KPM_IndicationMessage, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_IndicationMessage_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_IndicationMessage = {
|
||||
"E2SM-KPM-IndicationMessage",
|
||||
"E2SM-KPM-IndicationMessage",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_IndicationMessage_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationMessage_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationMessage_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_IndicationMessage_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_IndicationMessage_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_IndicationMessage_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_IndicationMessage_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_IndicationMessage_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
275
e2sm/lib/E2SM-KPM-RANfunction-Description.c
Normal file
275
e2sm/lib/E2SM-KPM-RANfunction-Description.c
Normal file
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "E2SM-KPM-RANfunction-Description.h"
|
||||
|
||||
#include "RIC-EventTriggerStyle-List.h"
|
||||
#include "RIC-ReportStyle-List.h"
|
||||
static int
|
||||
memb_ric_EventTriggerStyle_List_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 63)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
memb_ric_ReportStyle_List_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 63)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_ric_EventTriggerStyle_List_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..63)) */};
|
||||
static asn_per_constraints_t asn_PER_type_ric_EventTriggerStyle_List_constr_4 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 63 } /* (SIZE(1..63)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_ric_ReportStyle_List_constr_6 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..63)) */};
|
||||
static asn_per_constraints_t asn_PER_type_ric_ReportStyle_List_constr_6 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 63 } /* (SIZE(1..63)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ric_EventTriggerStyle_List_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..63)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ric_EventTriggerStyle_List_constr_4 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 63 } /* (SIZE(1..63)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ric_ReportStyle_List_constr_6 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..63)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ric_ReportStyle_List_constr_6 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 63 } /* (SIZE(1..63)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_ric_EventTriggerStyle_List_4[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_RIC_EventTriggerStyle_List,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ric_EventTriggerStyle_List_tags_4[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_ric_EventTriggerStyle_List_specs_4 = {
|
||||
sizeof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_EventTriggerStyle_List),
|
||||
offsetof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_EventTriggerStyle_List, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_ric_EventTriggerStyle_List_4 = {
|
||||
"ric-EventTriggerStyle-List",
|
||||
"ric-EventTriggerStyle-List",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_ric_EventTriggerStyle_List_tags_4,
|
||||
sizeof(asn_DEF_ric_EventTriggerStyle_List_tags_4)
|
||||
/sizeof(asn_DEF_ric_EventTriggerStyle_List_tags_4[0]) - 1, /* 1 */
|
||||
asn_DEF_ric_EventTriggerStyle_List_tags_4, /* Same as above */
|
||||
sizeof(asn_DEF_ric_EventTriggerStyle_List_tags_4)
|
||||
/sizeof(asn_DEF_ric_EventTriggerStyle_List_tags_4[0]), /* 2 */
|
||||
{ &asn_OER_type_ric_EventTriggerStyle_List_constr_4, &asn_PER_type_ric_EventTriggerStyle_List_constr_4, SEQUENCE_OF_constraint },
|
||||
asn_MBR_ric_EventTriggerStyle_List_4,
|
||||
1, /* Single element */
|
||||
&asn_SPC_ric_EventTriggerStyle_List_specs_4 /* Additional specs */
|
||||
};
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_ric_ReportStyle_List_6[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_RIC_ReportStyle_List,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ric_ReportStyle_List_tags_6[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_ric_ReportStyle_List_specs_6 = {
|
||||
sizeof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_ReportStyle_List),
|
||||
offsetof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_ReportStyle_List, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_ric_ReportStyle_List_6 = {
|
||||
"ric-ReportStyle-List",
|
||||
"ric-ReportStyle-List",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_ric_ReportStyle_List_tags_6,
|
||||
sizeof(asn_DEF_ric_ReportStyle_List_tags_6)
|
||||
/sizeof(asn_DEF_ric_ReportStyle_List_tags_6[0]) - 1, /* 1 */
|
||||
asn_DEF_ric_ReportStyle_List_tags_6, /* Same as above */
|
||||
sizeof(asn_DEF_ric_ReportStyle_List_tags_6)
|
||||
/sizeof(asn_DEF_ric_ReportStyle_List_tags_6[0]), /* 2 */
|
||||
{ &asn_OER_type_ric_ReportStyle_List_constr_6, &asn_PER_type_ric_ReportStyle_List_constr_6, SEQUENCE_OF_constraint },
|
||||
asn_MBR_ric_ReportStyle_List_6,
|
||||
1, /* Single element */
|
||||
&asn_SPC_ric_ReportStyle_List_specs_6 /* Additional specs */
|
||||
};
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_e2SM_KPM_RANfunction_Item_3[] = {
|
||||
{ ATF_POINTER, 2, offsetof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item, ric_EventTriggerStyle_List),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_ric_EventTriggerStyle_List_4,
|
||||
0,
|
||||
{ &asn_OER_memb_ric_EventTriggerStyle_List_constr_4, &asn_PER_memb_ric_EventTriggerStyle_List_constr_4, memb_ric_EventTriggerStyle_List_constraint_3 },
|
||||
0, 0, /* No default value */
|
||||
"ric-EventTriggerStyle-List"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item, ric_ReportStyle_List),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_ric_ReportStyle_List_6,
|
||||
0,
|
||||
{ &asn_OER_memb_ric_ReportStyle_List_constr_6, &asn_PER_memb_ric_ReportStyle_List_constr_6, memb_ric_ReportStyle_List_constraint_3 },
|
||||
0, 0, /* No default value */
|
||||
"ric-ReportStyle-List"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_e2SM_KPM_RANfunction_Item_oms_3[] = { 0, 1 };
|
||||
static const ber_tlv_tag_t asn_DEF_e2SM_KPM_RANfunction_Item_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_e2SM_KPM_RANfunction_Item_tag2el_3[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ric-EventTriggerStyle-List */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* ric-ReportStyle-List */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_e2SM_KPM_RANfunction_Item_specs_3 = {
|
||||
sizeof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item),
|
||||
offsetof(struct E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item, _asn_ctx),
|
||||
asn_MAP_e2SM_KPM_RANfunction_Item_tag2el_3,
|
||||
2, /* Count of tags in the map */
|
||||
asn_MAP_e2SM_KPM_RANfunction_Item_oms_3, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_e2SM_KPM_RANfunction_Item_3 = {
|
||||
"e2SM-KPM-RANfunction-Item",
|
||||
"e2SM-KPM-RANfunction-Item",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_e2SM_KPM_RANfunction_Item_tags_3,
|
||||
sizeof(asn_DEF_e2SM_KPM_RANfunction_Item_tags_3)
|
||||
/sizeof(asn_DEF_e2SM_KPM_RANfunction_Item_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_e2SM_KPM_RANfunction_Item_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_e2SM_KPM_RANfunction_Item_tags_3)
|
||||
/sizeof(asn_DEF_e2SM_KPM_RANfunction_Item_tags_3[0]), /* 2 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_e2SM_KPM_RANfunction_Item_3,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_e2SM_KPM_RANfunction_Item_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_E2SM_KPM_RANfunction_Description_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_RANfunction_Description, ranFunction_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RANfunction_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ranFunction-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct E2SM_KPM_RANfunction_Description, e2SM_KPM_RANfunction_Item),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_e2SM_KPM_RANfunction_Item_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"e2SM-KPM-RANfunction-Item"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_E2SM_KPM_RANfunction_Description_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_E2SM_KPM_RANfunction_Description_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ranFunction-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* e2SM-KPM-RANfunction-Item */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_E2SM_KPM_RANfunction_Description_specs_1 = {
|
||||
sizeof(struct E2SM_KPM_RANfunction_Description),
|
||||
offsetof(struct E2SM_KPM_RANfunction_Description, _asn_ctx),
|
||||
asn_MAP_E2SM_KPM_RANfunction_Description_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_E2SM_KPM_RANfunction_Description = {
|
||||
"E2SM-KPM-RANfunction-Description",
|
||||
"E2SM-KPM-RANfunction-Description",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_E2SM_KPM_RANfunction_Description_tags_1,
|
||||
sizeof(asn_DEF_E2SM_KPM_RANfunction_Description_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_RANfunction_Description_tags_1[0]), /* 1 */
|
||||
asn_DEF_E2SM_KPM_RANfunction_Description_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_E2SM_KPM_RANfunction_Description_tags_1)
|
||||
/sizeof(asn_DEF_E2SM_KPM_RANfunction_Description_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_E2SM_KPM_RANfunction_Description_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_E2SM_KPM_RANfunction_Description_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
192
e2sm/lib/ENB-ID-Choice.c
Normal file
192
e2sm/lib/ENB-ID-Choice.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "ENB-ID-Choice.h"
|
||||
|
||||
static int
|
||||
memb_enb_ID_macro_constraint_1(const 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 == 20)) {
|
||||
/* 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_enb_ID_shortmacro_constraint_1(const 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 == 18)) {
|
||||
/* 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_enb_ID_longmacro_constraint_1(const 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 == 21)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_enb_ID_macro_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
20 /* (SIZE(20..20)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_enb_ID_macro_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 20, 20 } /* (SIZE(20..20)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_enb_ID_shortmacro_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
18 /* (SIZE(18..18)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_enb_ID_shortmacro_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 18, 18 } /* (SIZE(18..18)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_enb_ID_longmacro_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
21 /* (SIZE(21..21)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_enb_ID_longmacro_constr_4 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 21, 21 } /* (SIZE(21..21)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_ENB_ID_Choice_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_ENB_ID_Choice_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_ENB_ID_Choice_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_macro),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_enb_ID_macro_constr_2, &asn_PER_memb_enb_ID_macro_constr_2, memb_enb_ID_macro_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"enb-ID-macro"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_shortmacro),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_enb_ID_shortmacro_constr_3, &asn_PER_memb_enb_ID_shortmacro_constr_3, memb_enb_ID_shortmacro_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"enb-ID-shortmacro"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID_Choice, choice.enb_ID_longmacro),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_enb_ID_longmacro_constr_4, &asn_PER_memb_enb_ID_longmacro_constr_4, memb_enb_ID_longmacro_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"enb-ID-longmacro"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_ENB_ID_Choice_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* enb-ID-macro */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* enb-ID-shortmacro */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* enb-ID-longmacro */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_ENB_ID_Choice_specs_1 = {
|
||||
sizeof(struct ENB_ID_Choice),
|
||||
offsetof(struct ENB_ID_Choice, _asn_ctx),
|
||||
offsetof(struct ENB_ID_Choice, present),
|
||||
sizeof(((struct ENB_ID_Choice *)0)->present),
|
||||
asn_MAP_ENB_ID_Choice_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0,
|
||||
3 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ENB_ID_Choice = {
|
||||
"ENB-ID-Choice",
|
||||
"ENB-ID-Choice",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_ENB_ID_Choice_constr_1, &asn_PER_type_ENB_ID_Choice_constr_1, CHOICE_constraint },
|
||||
asn_MBR_ENB_ID_Choice_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_ENB_ID_Choice_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
241
e2sm/lib/ENB-ID.c
Normal file
241
e2sm/lib/ENB-ID.c
Normal file
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "ENB-ID.h"
|
||||
|
||||
static int
|
||||
memb_macro_eNB_ID_constraint_1(const 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 == 20)) {
|
||||
/* 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_home_eNB_ID_constraint_1(const 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 == 28)) {
|
||||
/* 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_short_Macro_eNB_ID_constraint_1(const 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 == 18)) {
|
||||
/* 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_long_Macro_eNB_ID_constraint_1(const 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 == 21)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_macro_eNB_ID_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
20 /* (SIZE(20..20)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_macro_eNB_ID_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 20, 20 } /* (SIZE(20..20)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_home_eNB_ID_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
28 /* (SIZE(28..28)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_home_eNB_ID_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 28, 28 } /* (SIZE(28..28)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_short_Macro_eNB_ID_constr_5 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
18 /* (SIZE(18..18)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_short_Macro_eNB_ID_constr_5 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 18, 18 } /* (SIZE(18..18)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_long_Macro_eNB_ID_constr_6 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
21 /* (SIZE(21..21)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_long_Macro_eNB_ID_constr_6 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 21, 21 } /* (SIZE(21..21)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_ENB_ID_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_ENB_ID_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_ENB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID, choice.macro_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_macro_eNB_ID_constr_2, &asn_PER_memb_macro_eNB_ID_constr_2, memb_macro_eNB_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"macro-eNB-ID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID, choice.home_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_home_eNB_ID_constr_3, &asn_PER_memb_home_eNB_ID_constr_3, memb_home_eNB_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"home-eNB-ID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID, choice.short_Macro_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_short_Macro_eNB_ID_constr_5, &asn_PER_memb_short_Macro_eNB_ID_constr_5, memb_short_Macro_eNB_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"short-Macro-eNB-ID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENB_ID, choice.long_Macro_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_long_Macro_eNB_ID_constr_6, &asn_PER_memb_long_Macro_eNB_ID_constr_6, memb_long_Macro_eNB_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"long-Macro-eNB-ID"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_ENB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* macro-eNB-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* home-eNB-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* short-Macro-eNB-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* long-Macro-eNB-ID */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_ENB_ID_specs_1 = {
|
||||
sizeof(struct ENB_ID),
|
||||
offsetof(struct ENB_ID, _asn_ctx),
|
||||
offsetof(struct ENB_ID, present),
|
||||
sizeof(((struct ENB_ID *)0)->present),
|
||||
asn_MAP_ENB_ID_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
0, 0,
|
||||
2 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ENB_ID = {
|
||||
"ENB-ID",
|
||||
"ENB-ID",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_ENB_ID_constr_1, &asn_PER_type_ENB_ID_constr_1, CHOICE_constraint },
|
||||
asn_MBR_ENB_ID_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_ENB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
94
e2sm/lib/ENGNB-ID.c
Normal file
94
e2sm/lib/ENGNB-ID.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "ENGNB-ID.h"
|
||||
|
||||
static int
|
||||
memb_gNB_ID_constraint_1(const 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 >= 22 && size <= 32)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_gNB_ID_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(22..32)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_gNB_ID_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 22, 32 } /* (SIZE(22..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_ENGNB_ID_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_ENGNB_ID_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_ENGNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ENGNB_ID, choice.gNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_gNB_ID_constr_2, &asn_PER_memb_gNB_ID_constr_2, memb_gNB_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-ID"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_ENGNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* gNB-ID */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_ENGNB_ID_specs_1 = {
|
||||
sizeof(struct ENGNB_ID),
|
||||
offsetof(struct ENGNB_ID, _asn_ctx),
|
||||
offsetof(struct ENGNB_ID, present),
|
||||
sizeof(((struct ENGNB_ID *)0)->present),
|
||||
asn_MAP_ENGNB_ID_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0,
|
||||
1 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ENGNB_ID = {
|
||||
"ENGNB-ID",
|
||||
"ENGNB-ID",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_ENGNB_ID_constr_1, &asn_PER_type_ENGNB_ID_constr_1, CHOICE_constraint },
|
||||
asn_MBR_ENGNB_ID_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_ENGNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/EPC-CUUP-PM-Format.c
Normal file
130
e2sm/lib/EPC-CUUP-PM-Format.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "EPC-CUUP-PM-Format.h"
|
||||
|
||||
#include "PerQCIReportListItemFormat.h"
|
||||
static int
|
||||
memb_perQCIReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 256)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..256)) */};
|
||||
static asn_per_constraints_t asn_PER_type_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..256)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_perQCIReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_PerQCIReportListItemFormat,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_perQCIReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_perQCIReportList_specs_2 = {
|
||||
sizeof(struct EPC_CUUP_PM_Format__perQCIReportList),
|
||||
offsetof(struct EPC_CUUP_PM_Format__perQCIReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_perQCIReportList_2 = {
|
||||
"perQCIReportList",
|
||||
"perQCIReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_perQCIReportList_tags_2,
|
||||
sizeof(asn_DEF_perQCIReportList_tags_2)
|
||||
/sizeof(asn_DEF_perQCIReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_perQCIReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_perQCIReportList_tags_2)
|
||||
/sizeof(asn_DEF_perQCIReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_perQCIReportList_constr_2, &asn_PER_type_perQCIReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_perQCIReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_perQCIReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_EPC_CUUP_PM_Format_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct EPC_CUUP_PM_Format, perQCIReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_perQCIReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_perQCIReportList_constr_2, &asn_PER_memb_perQCIReportList_constr_2, memb_perQCIReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"perQCIReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_EPC_CUUP_PM_Format_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_EPC_CUUP_PM_Format_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* perQCIReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_EPC_CUUP_PM_Format_specs_1 = {
|
||||
sizeof(struct EPC_CUUP_PM_Format),
|
||||
offsetof(struct EPC_CUUP_PM_Format, _asn_ctx),
|
||||
asn_MAP_EPC_CUUP_PM_Format_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_EPC_CUUP_PM_Format = {
|
||||
"EPC-CUUP-PM-Format",
|
||||
"EPC-CUUP-PM-Format",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_EPC_CUUP_PM_Format_tags_1,
|
||||
sizeof(asn_DEF_EPC_CUUP_PM_Format_tags_1)
|
||||
/sizeof(asn_DEF_EPC_CUUP_PM_Format_tags_1[0]), /* 1 */
|
||||
asn_DEF_EPC_CUUP_PM_Format_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_EPC_CUUP_PM_Format_tags_1)
|
||||
/sizeof(asn_DEF_EPC_CUUP_PM_Format_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_EPC_CUUP_PM_Format_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_EPC_CUUP_PM_Format_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/EPC-DU-PM-Container.c
Normal file
130
e2sm/lib/EPC-DU-PM-Container.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "EPC-DU-PM-Container.h"
|
||||
|
||||
#include "PerQCIReportListItem.h"
|
||||
static int
|
||||
memb_perQCIReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 256)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..256)) */};
|
||||
static asn_per_constraints_t asn_PER_type_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..256)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_perQCIReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_perQCIReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_PerQCIReportListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_perQCIReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_perQCIReportList_specs_2 = {
|
||||
sizeof(struct EPC_DU_PM_Container__perQCIReportList),
|
||||
offsetof(struct EPC_DU_PM_Container__perQCIReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_perQCIReportList_2 = {
|
||||
"perQCIReportList",
|
||||
"perQCIReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_perQCIReportList_tags_2,
|
||||
sizeof(asn_DEF_perQCIReportList_tags_2)
|
||||
/sizeof(asn_DEF_perQCIReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_perQCIReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_perQCIReportList_tags_2)
|
||||
/sizeof(asn_DEF_perQCIReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_perQCIReportList_constr_2, &asn_PER_type_perQCIReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_perQCIReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_perQCIReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_EPC_DU_PM_Container_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct EPC_DU_PM_Container, perQCIReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_perQCIReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_perQCIReportList_constr_2, &asn_PER_memb_perQCIReportList_constr_2, memb_perQCIReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"perQCIReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_EPC_DU_PM_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_EPC_DU_PM_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* perQCIReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_EPC_DU_PM_Container_specs_1 = {
|
||||
sizeof(struct EPC_DU_PM_Container),
|
||||
offsetof(struct EPC_DU_PM_Container, _asn_ctx),
|
||||
asn_MAP_EPC_DU_PM_Container_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_EPC_DU_PM_Container = {
|
||||
"EPC-DU-PM-Container",
|
||||
"EPC-DU-PM-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_EPC_DU_PM_Container_tags_1,
|
||||
sizeof(asn_DEF_EPC_DU_PM_Container_tags_1)
|
||||
/sizeof(asn_DEF_EPC_DU_PM_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_EPC_DU_PM_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_EPC_DU_PM_Container_tags_1)
|
||||
/sizeof(asn_DEF_EPC_DU_PM_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_EPC_DU_PM_Container_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_EPC_DU_PM_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/FGC-CUUP-PM-Format.c
Normal file
130
e2sm/lib/FGC-CUUP-PM-Format.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "FGC-CUUP-PM-Format.h"
|
||||
|
||||
#include "SliceToReportListItem.h"
|
||||
static int
|
||||
memb_sliceToReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 1024)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_sliceToReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..1024)) */};
|
||||
static asn_per_constraints_t asn_PER_type_sliceToReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_sliceToReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..1024)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_sliceToReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_sliceToReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_SliceToReportListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_sliceToReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_sliceToReportList_specs_2 = {
|
||||
sizeof(struct FGC_CUUP_PM_Format__sliceToReportList),
|
||||
offsetof(struct FGC_CUUP_PM_Format__sliceToReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_sliceToReportList_2 = {
|
||||
"sliceToReportList",
|
||||
"sliceToReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_sliceToReportList_tags_2,
|
||||
sizeof(asn_DEF_sliceToReportList_tags_2)
|
||||
/sizeof(asn_DEF_sliceToReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_sliceToReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_sliceToReportList_tags_2)
|
||||
/sizeof(asn_DEF_sliceToReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_sliceToReportList_constr_2, &asn_PER_type_sliceToReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_sliceToReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_sliceToReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_FGC_CUUP_PM_Format_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct FGC_CUUP_PM_Format, sliceToReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_sliceToReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_sliceToReportList_constr_2, &asn_PER_memb_sliceToReportList_constr_2, memb_sliceToReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"sliceToReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_FGC_CUUP_PM_Format_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_FGC_CUUP_PM_Format_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* sliceToReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_FGC_CUUP_PM_Format_specs_1 = {
|
||||
sizeof(struct FGC_CUUP_PM_Format),
|
||||
offsetof(struct FGC_CUUP_PM_Format, _asn_ctx),
|
||||
asn_MAP_FGC_CUUP_PM_Format_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_FGC_CUUP_PM_Format = {
|
||||
"FGC-CUUP-PM-Format",
|
||||
"FGC-CUUP-PM-Format",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_FGC_CUUP_PM_Format_tags_1,
|
||||
sizeof(asn_DEF_FGC_CUUP_PM_Format_tags_1)
|
||||
/sizeof(asn_DEF_FGC_CUUP_PM_Format_tags_1[0]), /* 1 */
|
||||
asn_DEF_FGC_CUUP_PM_Format_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_FGC_CUUP_PM_Format_tags_1)
|
||||
/sizeof(asn_DEF_FGC_CUUP_PM_Format_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_FGC_CUUP_PM_Format_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_FGC_CUUP_PM_Format_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/FGC-DU-PM-Container.c
Normal file
130
e2sm/lib/FGC-DU-PM-Container.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "FGC-DU-PM-Container.h"
|
||||
|
||||
#include "SlicePerPlmnPerCellListItem.h"
|
||||
static int
|
||||
memb_slicePerPlmnPerCellList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 1024)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_slicePerPlmnPerCellList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..1024)) */};
|
||||
static asn_per_constraints_t asn_PER_type_slicePerPlmnPerCellList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_slicePerPlmnPerCellList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..1024)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_slicePerPlmnPerCellList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 10, 10, 1, 1024 } /* (SIZE(1..1024)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_slicePerPlmnPerCellList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_SlicePerPlmnPerCellListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_slicePerPlmnPerCellList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_slicePerPlmnPerCellList_specs_2 = {
|
||||
sizeof(struct FGC_DU_PM_Container__slicePerPlmnPerCellList),
|
||||
offsetof(struct FGC_DU_PM_Container__slicePerPlmnPerCellList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_slicePerPlmnPerCellList_2 = {
|
||||
"slicePerPlmnPerCellList",
|
||||
"slicePerPlmnPerCellList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_slicePerPlmnPerCellList_tags_2,
|
||||
sizeof(asn_DEF_slicePerPlmnPerCellList_tags_2)
|
||||
/sizeof(asn_DEF_slicePerPlmnPerCellList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_slicePerPlmnPerCellList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_slicePerPlmnPerCellList_tags_2)
|
||||
/sizeof(asn_DEF_slicePerPlmnPerCellList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_slicePerPlmnPerCellList_constr_2, &asn_PER_type_slicePerPlmnPerCellList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_slicePerPlmnPerCellList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_slicePerPlmnPerCellList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_FGC_DU_PM_Container_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct FGC_DU_PM_Container, slicePerPlmnPerCellList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_slicePerPlmnPerCellList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_slicePerPlmnPerCellList_constr_2, &asn_PER_memb_slicePerPlmnPerCellList_constr_2, memb_slicePerPlmnPerCellList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"slicePerPlmnPerCellList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_FGC_DU_PM_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_FGC_DU_PM_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* slicePerPlmnPerCellList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_FGC_DU_PM_Container_specs_1 = {
|
||||
sizeof(struct FGC_DU_PM_Container),
|
||||
offsetof(struct FGC_DU_PM_Container, _asn_ctx),
|
||||
asn_MAP_FGC_DU_PM_Container_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_FGC_DU_PM_Container = {
|
||||
"FGC-DU-PM-Container",
|
||||
"FGC-DU-PM-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_FGC_DU_PM_Container_tags_1,
|
||||
sizeof(asn_DEF_FGC_DU_PM_Container_tags_1)
|
||||
/sizeof(asn_DEF_FGC_DU_PM_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_FGC_DU_PM_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_FGC_DU_PM_Container_tags_1)
|
||||
/sizeof(asn_DEF_FGC_DU_PM_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_FGC_DU_PM_Container_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_FGC_DU_PM_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
183
e2sm/lib/FQIPERSlicesPerPlmnListItem.c
Normal file
183
e2sm/lib/FQIPERSlicesPerPlmnListItem.c
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "FQIPERSlicesPerPlmnListItem.h"
|
||||
|
||||
static int
|
||||
memb_fiveQI_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_pDCPBytesDL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_pDCPBytesUL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_fiveQI_constr_2 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_fiveQI_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_FQIPERSlicesPerPlmnListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct FQIPERSlicesPerPlmnListItem, fiveQI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_fiveQI_constr_2, &asn_PER_memb_fiveQI_constr_2, memb_fiveQI_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"fiveQI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct FQIPERSlicesPerPlmnListItem, pDCPBytesDL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesDL_constr_3, &asn_PER_memb_pDCPBytesDL_constr_3, memb_pDCPBytesDL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesDL"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct FQIPERSlicesPerPlmnListItem, pDCPBytesUL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesUL_constr_4, &asn_PER_memb_pDCPBytesUL_constr_4, memb_pDCPBytesUL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesUL"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_FQIPERSlicesPerPlmnListItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_FQIPERSlicesPerPlmnListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fiveQI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pDCPBytesDL */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* pDCPBytesUL */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_FQIPERSlicesPerPlmnListItem_specs_1 = {
|
||||
sizeof(struct FQIPERSlicesPerPlmnListItem),
|
||||
offsetof(struct FQIPERSlicesPerPlmnListItem, _asn_ctx),
|
||||
asn_MAP_FQIPERSlicesPerPlmnListItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_FQIPERSlicesPerPlmnListItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_FQIPERSlicesPerPlmnListItem = {
|
||||
"FQIPERSlicesPerPlmnListItem",
|
||||
"FQIPERSlicesPerPlmnListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1,
|
||||
sizeof(asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1)
|
||||
/sizeof(asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1)
|
||||
/sizeof(asn_DEF_FQIPERSlicesPerPlmnListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_FQIPERSlicesPerPlmnListItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_FQIPERSlicesPerPlmnListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
171
e2sm/lib/FQIPERSlicesPerPlmnPerCellListItem.c
Normal file
171
e2sm/lib/FQIPERSlicesPerPlmnPerCellListItem.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "FQIPERSlicesPerPlmnPerCellListItem.h"
|
||||
|
||||
static int
|
||||
memb_fiveQI_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_dl_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 273)) {
|
||||
/* 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_ul_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 273)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_fiveQI_constr_2 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_fiveQI_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ 2, 1 } /* (0..273) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 9, 9, 0, 273 } /* (0..273) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ 2, 1 } /* (0..273) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 9, 9, 0, 273 } /* (0..273) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_FQIPERSlicesPerPlmnPerCellListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct FQIPERSlicesPerPlmnPerCellListItem, fiveQI),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_fiveQI_constr_2, &asn_PER_memb_fiveQI_constr_2, memb_fiveQI_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"fiveQI"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct FQIPERSlicesPerPlmnPerCellListItem, dl_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_dl_PRBUsage_constr_3, &asn_PER_memb_dl_PRBUsage_constr_3, memb_dl_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"dl-PRBUsage"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct FQIPERSlicesPerPlmnPerCellListItem, ul_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_ul_PRBUsage_constr_4, &asn_PER_memb_ul_PRBUsage_constr_4, memb_ul_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ul-PRBUsage"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_FQIPERSlicesPerPlmnPerCellListItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_FQIPERSlicesPerPlmnPerCellListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* fiveQI */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dl-PRBUsage */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ul-PRBUsage */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_FQIPERSlicesPerPlmnPerCellListItem_specs_1 = {
|
||||
sizeof(struct FQIPERSlicesPerPlmnPerCellListItem),
|
||||
offsetof(struct FQIPERSlicesPerPlmnPerCellListItem, _asn_ctx),
|
||||
asn_MAP_FQIPERSlicesPerPlmnPerCellListItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_FQIPERSlicesPerPlmnPerCellListItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_FQIPERSlicesPerPlmnPerCellListItem = {
|
||||
"FQIPERSlicesPerPlmnPerCellListItem",
|
||||
"FQIPERSlicesPerPlmnPerCellListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1,
|
||||
sizeof(asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_FQIPERSlicesPerPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_FQIPERSlicesPerPlmnPerCellListItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_FQIPERSlicesPerPlmnPerCellListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
109
e2sm/lib/GNB-CU-CP-Name.c
Normal file
109
e2sm/lib/GNB-CU-CP-Name.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-CU-CP-Name.h"
|
||||
|
||||
static const int permitted_alphabet_table_1[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_1[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_1(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_1;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GNB_CU_CP_Name_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_1(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 int asn_PER_MAP_GNB_CU_CP_Name_1_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_1[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_GNB_CU_CP_Name_1_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_1[code];
|
||||
}
|
||||
/*
|
||||
* This type is implemented using PrintableString,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_CU_CP_Name_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
asn_per_constraints_t asn_PER_type_GNB_CU_CP_Name_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_GNB_CU_CP_Name_1_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_GNB_CU_CP_Name_1_c2v /* PER code to value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GNB_CU_CP_Name_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_CU_CP_Name = {
|
||||
"GNB-CU-CP-Name",
|
||||
"GNB-CU-CP-Name",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_GNB_CU_CP_Name_tags_1,
|
||||
sizeof(asn_DEF_GNB_CU_CP_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_CP_Name_tags_1[0]), /* 1 */
|
||||
asn_DEF_GNB_CU_CP_Name_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GNB_CU_CP_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_CP_Name_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_GNB_CU_CP_Name_constr_1, &asn_PER_type_GNB_CU_CP_Name_constr_1, GNB_CU_CP_Name_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
70
e2sm/lib/GNB-CU-UP-ID.c
Normal file
70
e2sm/lib/GNB-CU-UP-ID.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-CU-UP-ID.h"
|
||||
|
||||
int
|
||||
GNB_CU_UP_ID_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 68719476735)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This type is implemented using INTEGER,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_CU_UP_ID_constr_1 CC_NOTUSED = {
|
||||
{ 8, 1 } /* (0..68719476735) */,
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_GNB_CU_UP_ID_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 36, -1, 0, 68719476735 } /* (0..68719476735) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GNB_CU_UP_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_CU_UP_ID = {
|
||||
"GNB-CU-UP-ID",
|
||||
"GNB-CU-UP-ID",
|
||||
&asn_OP_INTEGER,
|
||||
asn_DEF_GNB_CU_UP_ID_tags_1,
|
||||
sizeof(asn_DEF_GNB_CU_UP_ID_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_UP_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GNB_CU_UP_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GNB_CU_UP_ID_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_UP_ID_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_GNB_CU_UP_ID_constr_1, &asn_PER_type_GNB_CU_UP_ID_constr_1, GNB_CU_UP_ID_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
109
e2sm/lib/GNB-CU-UP-Name.c
Normal file
109
e2sm/lib/GNB-CU-UP-Name.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-CU-UP-Name.h"
|
||||
|
||||
static const int permitted_alphabet_table_1[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_1[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_1(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_1;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GNB_CU_UP_Name_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_1(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 int asn_PER_MAP_GNB_CU_UP_Name_1_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_1[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_GNB_CU_UP_Name_1_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_1[code];
|
||||
}
|
||||
/*
|
||||
* This type is implemented using PrintableString,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_CU_UP_Name_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
asn_per_constraints_t asn_PER_type_GNB_CU_UP_Name_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_GNB_CU_UP_Name_1_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_GNB_CU_UP_Name_1_c2v /* PER code to value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GNB_CU_UP_Name_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_CU_UP_Name = {
|
||||
"GNB-CU-UP-Name",
|
||||
"GNB-CU-UP-Name",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_GNB_CU_UP_Name_tags_1,
|
||||
sizeof(asn_DEF_GNB_CU_UP_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_UP_Name_tags_1[0]), /* 1 */
|
||||
asn_DEF_GNB_CU_UP_Name_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GNB_CU_UP_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_CU_UP_Name_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_GNB_CU_UP_Name_constr_1, &asn_PER_type_GNB_CU_UP_Name_constr_1, GNB_CU_UP_Name_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
70
e2sm/lib/GNB-DU-ID.c
Normal file
70
e2sm/lib/GNB-DU-ID.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-DU-ID.h"
|
||||
|
||||
int
|
||||
GNB_DU_ID_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 68719476735)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This type is implemented using INTEGER,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_DU_ID_constr_1 CC_NOTUSED = {
|
||||
{ 8, 1 } /* (0..68719476735) */,
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_GNB_DU_ID_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 36, -1, 0, 68719476735 } /* (0..68719476735) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GNB_DU_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_DU_ID = {
|
||||
"GNB-DU-ID",
|
||||
"GNB-DU-ID",
|
||||
&asn_OP_INTEGER,
|
||||
asn_DEF_GNB_DU_ID_tags_1,
|
||||
sizeof(asn_DEF_GNB_DU_ID_tags_1)
|
||||
/sizeof(asn_DEF_GNB_DU_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GNB_DU_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GNB_DU_ID_tags_1)
|
||||
/sizeof(asn_DEF_GNB_DU_ID_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_GNB_DU_ID_constr_1, &asn_PER_type_GNB_DU_ID_constr_1, GNB_DU_ID_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
109
e2sm/lib/GNB-DU-Name.c
Normal file
109
e2sm/lib/GNB-DU-Name.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-DU-Name.h"
|
||||
|
||||
static const int permitted_alphabet_table_1[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_1[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_1(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_1;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GNB_DU_Name_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_1(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 int asn_PER_MAP_GNB_DU_Name_1_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_1[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_GNB_DU_Name_1_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_1[code];
|
||||
}
|
||||
/*
|
||||
* This type is implemented using PrintableString,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_DU_Name_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
asn_per_constraints_t asn_PER_type_GNB_DU_Name_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_GNB_DU_Name_1_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_GNB_DU_Name_1_c2v /* PER code to value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GNB_DU_Name_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_DU_Name = {
|
||||
"GNB-DU-Name",
|
||||
"GNB-DU-Name",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_GNB_DU_Name_tags_1,
|
||||
sizeof(asn_DEF_GNB_DU_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_DU_Name_tags_1[0]), /* 1 */
|
||||
asn_DEF_GNB_DU_Name_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GNB_DU_Name_tags_1)
|
||||
/sizeof(asn_DEF_GNB_DU_Name_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_GNB_DU_Name_constr_1, &asn_PER_type_GNB_DU_Name_constr_1, GNB_DU_Name_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
94
e2sm/lib/GNB-ID-Choice.c
Normal file
94
e2sm/lib/GNB-ID-Choice.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-ID-Choice.h"
|
||||
|
||||
static int
|
||||
memb_gnb_ID_constraint_1(const 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 >= 22 && size <= 32)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_gnb_ID_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(22..32)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_gnb_ID_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 4, 4, 22, 32 } /* (SIZE(22..32)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_ID_Choice_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_GNB_ID_Choice_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_GNB_ID_Choice_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GNB_ID_Choice, choice.gnb_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_BIT_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_gnb_ID_constr_2, &asn_PER_memb_gnb_ID_constr_2, memb_gnb_ID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"gnb-ID"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GNB_ID_Choice_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* gnb-ID */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_GNB_ID_Choice_specs_1 = {
|
||||
sizeof(struct GNB_ID_Choice),
|
||||
offsetof(struct GNB_ID_Choice, _asn_ctx),
|
||||
offsetof(struct GNB_ID_Choice, present),
|
||||
sizeof(((struct GNB_ID_Choice *)0)->present),
|
||||
asn_MAP_GNB_ID_Choice_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0,
|
||||
1 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_ID_Choice = {
|
||||
"GNB-ID-Choice",
|
||||
"GNB-ID-Choice",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_GNB_ID_Choice_constr_1, &asn_PER_type_GNB_ID_Choice_constr_1, CHOICE_constraint },
|
||||
asn_MBR_GNB_ID_Choice_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_GNB_ID_Choice_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
75
e2sm/lib/GNB-Name.c
Normal file
75
e2sm/lib/GNB-Name.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GNB-Name.h"
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_GNB_Name_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_GNB_Name_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_GNB_Name_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GNB_Name, choice.gNB_DU_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_DU_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-DU-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GNB_Name, choice.gNB_CU_CP_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_CU_CP_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-CU-CP-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GNB_Name, choice.gNB_CU_UP_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_CU_UP_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-CU-UP-Name"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GNB_Name_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gNB-DU-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gNB-CU-CP-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gNB-CU-UP-Name */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_GNB_Name_specs_1 = {
|
||||
sizeof(struct GNB_Name),
|
||||
offsetof(struct GNB_Name, _asn_ctx),
|
||||
offsetof(struct GNB_Name, present),
|
||||
sizeof(((struct GNB_Name *)0)->present),
|
||||
asn_MAP_GNB_Name_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0,
|
||||
3 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GNB_Name = {
|
||||
"GNB-Name",
|
||||
"GNB-Name",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_GNB_Name_constr_1, &asn_PER_type_GNB_Name_constr_1, CHOICE_constraint },
|
||||
asn_MBR_GNB_Name_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_GNB_Name_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/GlobalENB-ID.c
Normal file
60
e2sm/lib/GlobalENB-ID.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalENB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalENB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalENB_ID, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalENB_ID, eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_ENB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"eNB-ID"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalENB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalENB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* eNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalENB_ID_specs_1 = {
|
||||
sizeof(struct GlobalENB_ID),
|
||||
offsetof(struct GlobalENB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalENB_ID_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalENB_ID = {
|
||||
"GlobalENB-ID",
|
||||
"GlobalENB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalENB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalENB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalENB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalENB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalENB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalENB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalENB_ID_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_GlobalENB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
89
e2sm/lib/GlobalKPMnode-ID.c
Normal file
89
e2sm/lib/GlobalKPMnode-ID.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalKPMnode-ID.h"
|
||||
|
||||
#include "GlobalKPMnode-gNB-ID.h"
|
||||
#include "GlobalKPMnode-en-gNB-ID.h"
|
||||
#include "GlobalKPMnode-ng-eNB-ID.h"
|
||||
#include "GlobalKPMnode-eNB-ID.h"
|
||||
static asn_oer_constraints_t asn_OER_type_GlobalKPMnode_ID_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_GlobalKPMnode_ID_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 3 } /* (0..3,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_GlobalKPMnode_ID_1[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct GlobalKPMnode_ID, choice.gNB),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalKPMnode_gNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct GlobalKPMnode_ID, choice.en_gNB),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalKPMnode_en_gNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"en-gNB"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct GlobalKPMnode_ID, choice.ng_eNB),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalKPMnode_ng_eNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ng-eNB"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct GlobalKPMnode_ID, choice.eNB),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalKPMnode_eNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"eNB"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalKPMnode_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gNB */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* en-gNB */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ng-eNB */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* eNB */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_GlobalKPMnode_ID_specs_1 = {
|
||||
sizeof(struct GlobalKPMnode_ID),
|
||||
offsetof(struct GlobalKPMnode_ID, _asn_ctx),
|
||||
offsetof(struct GlobalKPMnode_ID, present),
|
||||
sizeof(((struct GlobalKPMnode_ID *)0)->present),
|
||||
asn_MAP_GlobalKPMnode_ID_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
0, 0,
|
||||
4 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalKPMnode_ID = {
|
||||
"GlobalKPMnode-ID",
|
||||
"GlobalKPMnode-ID",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_GlobalKPMnode_ID_constr_1, &asn_PER_type_GlobalKPMnode_ID_constr_1, CHOICE_constraint },
|
||||
asn_MBR_GlobalKPMnode_ID_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_GlobalKPMnode_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
50
e2sm/lib/GlobalKPMnode-eNB-ID.c
Normal file
50
e2sm/lib/GlobalKPMnode-eNB-ID.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalKPMnode-eNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalKPMnode_eNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalKPMnode_eNB_ID, global_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalENB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"global-eNB-ID"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalKPMnode_eNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalKPMnode_eNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* global-eNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalKPMnode_eNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalKPMnode_eNB_ID),
|
||||
offsetof(struct GlobalKPMnode_eNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalKPMnode_eNB_ID_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalKPMnode_eNB_ID = {
|
||||
"GlobalKPMnode-eNB-ID",
|
||||
"GlobalKPMnode-eNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalKPMnode_eNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalKPMnode_eNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_eNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalKPMnode_eNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalKPMnode_eNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_eNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalKPMnode_eNB_ID_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_GlobalKPMnode_eNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
50
e2sm/lib/GlobalKPMnode-en-gNB-ID.c
Normal file
50
e2sm/lib/GlobalKPMnode-en-gNB-ID.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalKPMnode-en-gNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalKPMnode_en_gNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalKPMnode_en_gNB_ID, global_gNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalenGNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"global-gNB-ID"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalKPMnode_en_gNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* global-gNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalKPMnode_en_gNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalKPMnode_en_gNB_ID),
|
||||
offsetof(struct GlobalKPMnode_en_gNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalKPMnode_en_gNB_ID_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalKPMnode_en_gNB_ID = {
|
||||
"GlobalKPMnode-en-gNB-ID",
|
||||
"GlobalKPMnode-en-gNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_en_gNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalKPMnode_en_gNB_ID_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_GlobalKPMnode_en_gNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
72
e2sm/lib/GlobalKPMnode-gNB-ID.c
Normal file
72
e2sm/lib/GlobalKPMnode-gNB-ID.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalKPMnode-gNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalKPMnode_gNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalKPMnode_gNB_ID, global_gNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalgNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"global-gNB-ID"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct GlobalKPMnode_gNB_ID, gNB_CU_UP_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_CU_UP_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-CU-UP-ID"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct GlobalKPMnode_gNB_ID, gNB_DU_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_DU_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-DU-ID"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_GlobalKPMnode_gNB_ID_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalKPMnode_gNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalKPMnode_gNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* global-gNB-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* gNB-CU-UP-ID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gNB-DU-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalKPMnode_gNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalKPMnode_gNB_ID),
|
||||
offsetof(struct GlobalKPMnode_gNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalKPMnode_gNB_ID_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_GlobalKPMnode_gNB_ID_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalKPMnode_gNB_ID = {
|
||||
"GlobalKPMnode-gNB-ID",
|
||||
"GlobalKPMnode-gNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalKPMnode_gNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalKPMnode_gNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_gNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalKPMnode_gNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalKPMnode_gNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_gNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalKPMnode_gNB_ID_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_GlobalKPMnode_gNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
50
e2sm/lib/GlobalKPMnode-ng-eNB-ID.c
Normal file
50
e2sm/lib/GlobalKPMnode-ng-eNB-ID.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalKPMnode-ng-eNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalKPMnode_ng_eNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalKPMnode_ng_eNB_ID, global_ng_eNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GlobalngeNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"global-ng-eNB-ID"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalKPMnode_ng_eNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* global-ng-eNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalKPMnode_ng_eNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalKPMnode_ng_eNB_ID),
|
||||
offsetof(struct GlobalKPMnode_ng_eNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalKPMnode_ng_eNB_ID_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalKPMnode_ng_eNB_ID = {
|
||||
"GlobalKPMnode-ng-eNB-ID",
|
||||
"GlobalKPMnode-ng-eNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalKPMnode_ng_eNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalKPMnode_ng_eNB_ID_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_GlobalKPMnode_ng_eNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/GlobalenGNB-ID.c
Normal file
60
e2sm/lib/GlobalenGNB-ID.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalenGNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalenGNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalenGNB_ID, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalenGNB_ID, gNB_ID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_ENGNB_ID,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-ID"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalenGNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalenGNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gNB-ID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalenGNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalenGNB_ID),
|
||||
offsetof(struct GlobalenGNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalenGNB_ID_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalenGNB_ID = {
|
||||
"GlobalenGNB-ID",
|
||||
"GlobalenGNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalenGNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalenGNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalenGNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalenGNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalenGNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalenGNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalenGNB_ID_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_GlobalenGNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/GlobalgNB-ID.c
Normal file
60
e2sm/lib/GlobalgNB-ID.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalgNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalgNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalgNB_ID, plmn_id),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"plmn-id"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalgNB_ID, gnb_id),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_GNB_ID_Choice,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gnb-id"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalgNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalgNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmn-id */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* gnb-id */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalgNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalgNB_ID),
|
||||
offsetof(struct GlobalgNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalgNB_ID_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalgNB_ID = {
|
||||
"GlobalgNB-ID",
|
||||
"GlobalgNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalgNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalgNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalgNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalgNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalgNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalgNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalgNB_ID_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_GlobalgNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/GlobalngeNB-ID.c
Normal file
60
e2sm/lib/GlobalngeNB-ID.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "GlobalngeNB-ID.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_GlobalngeNB_ID_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalngeNB_ID, plmn_id),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"plmn-id"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct GlobalngeNB_ID, enb_id),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_ENB_ID_Choice,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"enb-id"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_GlobalngeNB_ID_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_GlobalngeNB_ID_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* plmn-id */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* enb-id */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_GlobalngeNB_ID_specs_1 = {
|
||||
sizeof(struct GlobalngeNB_ID),
|
||||
offsetof(struct GlobalngeNB_ID, _asn_ctx),
|
||||
asn_MAP_GlobalngeNB_ID_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_GlobalngeNB_ID = {
|
||||
"GlobalngeNB-ID",
|
||||
"GlobalngeNB-ID",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_GlobalngeNB_ID_tags_1,
|
||||
sizeof(asn_DEF_GlobalngeNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalngeNB_ID_tags_1[0]), /* 1 */
|
||||
asn_DEF_GlobalngeNB_ID_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_GlobalngeNB_ID_tags_1)
|
||||
/sizeof(asn_DEF_GlobalngeNB_ID_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_GlobalngeNB_ID_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_GlobalngeNB_ID_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
1735
e2sm/lib/INTEGER.c
Normal file
1735
e2sm/lib/INTEGER.c
Normal file
File diff suppressed because it is too large
Load Diff
179
e2sm/lib/INTEGER_oer.c
Normal file
179
e2sm/lib/INTEGER_oer.c
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <INTEGER.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_dec_rval_t
|
||||
INTEGER_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, void **sptr,
|
||||
const void *ptr, size_t size) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval = {RC_OK, 0};
|
||||
INTEGER_t *st = (INTEGER_t *)*sptr;
|
||||
struct asn_oer_constraint_number_s ct = {0, 0};
|
||||
size_t req_bytes;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
(void)specs;
|
||||
|
||||
if(!st) {
|
||||
st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st)));
|
||||
if(!st) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
FREEMEM(st->buf);
|
||||
st->buf = 0;
|
||||
st->size = 0;
|
||||
|
||||
if(!constraints) constraints = td->encoding_constraints.oer_constraints;
|
||||
if(constraints) ct = constraints->value;
|
||||
|
||||
if(ct.width) {
|
||||
req_bytes = ct.width;
|
||||
} else {
|
||||
/* No lower bound and no upper bound, effectively */
|
||||
|
||||
ssize_t consumed = oer_fetch_length(ptr, size, &req_bytes);
|
||||
if(consumed == 0) {
|
||||
ASN__DECODE_STARVED;
|
||||
} else if(consumed == -1) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
rval.consumed += consumed;
|
||||
ptr = (const char *)ptr + consumed;
|
||||
size -= consumed;
|
||||
}
|
||||
|
||||
if(req_bytes > size) {
|
||||
ASN__DECODE_STARVED;
|
||||
}
|
||||
|
||||
if(ct.positive) {
|
||||
/* X.969 08/2015 10.2(a) */
|
||||
unsigned msb; /* Most significant bit */
|
||||
size_t useful_size;
|
||||
|
||||
/* Check most significant bit */
|
||||
msb = *(const uint8_t *)ptr >> 7; /* yields 0 or 1 */
|
||||
useful_size = msb + req_bytes;
|
||||
st->buf = (uint8_t *)MALLOC(useful_size + 1);
|
||||
if(!st->buf) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Record a large unsigned in a way not to confuse it
|
||||
* with signed value.
|
||||
*/
|
||||
st->buf[0] = '\0';
|
||||
memcpy(st->buf + msb, ptr, req_bytes);
|
||||
st->buf[useful_size] = '\0'; /* Just in case, 0-terminate */
|
||||
st->size = useful_size;
|
||||
|
||||
rval.consumed += req_bytes;
|
||||
return rval;
|
||||
} else {
|
||||
/* X.969 08/2015 10.2(b) */
|
||||
st->buf = (uint8_t *)MALLOC(req_bytes + 1);
|
||||
if(!st->buf) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memcpy(st->buf, ptr, req_bytes);
|
||||
st->buf[req_bytes] = '\0'; /* Just in case, 0-terminate */
|
||||
st->size = req_bytes;
|
||||
|
||||
rval.consumed += req_bytes;
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
INTEGER_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, const void *sptr,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const INTEGER_t *st = sptr;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
struct asn_oer_constraint_number_s ct = {0, 0};
|
||||
const uint8_t *buf;
|
||||
const uint8_t *end;
|
||||
size_t useful_bytes;
|
||||
size_t req_bytes = 0;
|
||||
int sign = 0;
|
||||
|
||||
if(!st || st->size == 0) ASN__ENCODE_FAILED;
|
||||
|
||||
if(!constraints) constraints = td->encoding_constraints.oer_constraints;
|
||||
if(constraints) ct = constraints->value;
|
||||
|
||||
er.encoded = 0;
|
||||
|
||||
buf = st->buf;
|
||||
end = buf + st->size;
|
||||
|
||||
sign = (buf && buf < end) ? buf[0] & 0x80 : 0;
|
||||
|
||||
/* Ignore 9 leading zeroes or ones */
|
||||
if(ct.positive) {
|
||||
if(sign) {
|
||||
/* The value given is a signed value. Can't proceed. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
/* Remove leading zeros. */
|
||||
for(; buf + 1 < end; buf++) {
|
||||
if(buf[0] != 0x0) break;
|
||||
}
|
||||
} else {
|
||||
for(; buf + 1 < end; buf++) {
|
||||
if(buf[0] == 0x0 && (buf[1] & 0x80) == 0) {
|
||||
continue;
|
||||
} else if(buf[0] == 0xff && (buf[1] & 0x80) != 0) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
useful_bytes = end - buf;
|
||||
if(ct.width) {
|
||||
req_bytes = ct.width;
|
||||
} else {
|
||||
ssize_t r = oer_serialize_length(useful_bytes, cb, app_key);
|
||||
if(r < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
er.encoded += r;
|
||||
req_bytes = useful_bytes;
|
||||
}
|
||||
|
||||
if(req_bytes < useful_bytes) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
er.encoded += req_bytes;
|
||||
|
||||
for(; req_bytes > useful_bytes; req_bytes--) {
|
||||
if(cb(sign?"\xff":"\0", 1, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if(cb(buf, useful_bytes, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
60
e2sm/lib/NI-Type.c
Normal file
60
e2sm/lib/NI-Type.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "NI-Type.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using NativeEnumerated,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_NI_Type_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_NI_Type_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const asn_INTEGER_enum_map_t asn_MAP_NI_Type_value2enum_1[] = {
|
||||
{ 0, 4, "x2-u" },
|
||||
{ 1, 4, "xn-u" },
|
||||
{ 2, 4, "f1-u" }
|
||||
/* This list is extensible */
|
||||
};
|
||||
static const unsigned int asn_MAP_NI_Type_enum2value_1[] = {
|
||||
2, /* f1-u(2) */
|
||||
0, /* x2-u(0) */
|
||||
1 /* xn-u(1) */
|
||||
/* This list is extensible */
|
||||
};
|
||||
const asn_INTEGER_specifics_t asn_SPC_NI_Type_specs_1 = {
|
||||
asn_MAP_NI_Type_value2enum_1, /* "tag" => N; sorted by tag */
|
||||
asn_MAP_NI_Type_enum2value_1, /* N => "tag"; sorted by N */
|
||||
3, /* Number of elements in the maps */
|
||||
4, /* Extensions before this member */
|
||||
1, /* Strict enumeration */
|
||||
0, /* Native long size */
|
||||
0
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_NI_Type_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_NI_Type = {
|
||||
"NI-Type",
|
||||
"NI-Type",
|
||||
&asn_OP_NativeEnumerated,
|
||||
asn_DEF_NI_Type_tags_1,
|
||||
sizeof(asn_DEF_NI_Type_tags_1)
|
||||
/sizeof(asn_DEF_NI_Type_tags_1[0]), /* 1 */
|
||||
asn_DEF_NI_Type_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_NI_Type_tags_1)
|
||||
/sizeof(asn_DEF_NI_Type_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_NI_Type_constr_1, &asn_PER_type_NI_Type_constr_1, NativeEnumerated_constraint },
|
||||
0, 0, /* Defined elsewhere */
|
||||
&asn_SPC_NI_Type_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/NRCGI.c
Normal file
60
e2sm/lib/NRCGI.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "NRCGI.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_NRCGI_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct NRCGI, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct NRCGI, nRCellIdentity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NRCellIdentity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"nRCellIdentity"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_NRCGI_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_NRCGI_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* nRCellIdentity */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_NRCGI_specs_1 = {
|
||||
sizeof(struct NRCGI),
|
||||
offsetof(struct NRCGI, _asn_ctx),
|
||||
asn_MAP_NRCGI_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_NRCGI = {
|
||||
"NRCGI",
|
||||
"NRCGI",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_NRCGI_tags_1,
|
||||
sizeof(asn_DEF_NRCGI_tags_1)
|
||||
/sizeof(asn_DEF_NRCGI_tags_1[0]), /* 1 */
|
||||
asn_DEF_NRCGI_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_NRCGI_tags_1)
|
||||
/sizeof(asn_DEF_NRCGI_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_NRCGI_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_NRCGI_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
70
e2sm/lib/NRCellIdentity.c
Normal file
70
e2sm/lib/NRCellIdentity.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "NRCellIdentity.h"
|
||||
|
||||
int
|
||||
NRCellIdentity_constraint(const 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 == 36)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This type is implemented using BIT_STRING,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_NRCellIdentity_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
36 /* (SIZE(36..36)) */};
|
||||
asn_per_constraints_t asn_PER_type_NRCellIdentity_constr_1 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 36, 36 } /* (SIZE(36..36)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_NRCellIdentity_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_NRCellIdentity = {
|
||||
"NRCellIdentity",
|
||||
"NRCellIdentity",
|
||||
&asn_OP_BIT_STRING,
|
||||
asn_DEF_NRCellIdentity_tags_1,
|
||||
sizeof(asn_DEF_NRCellIdentity_tags_1)
|
||||
/sizeof(asn_DEF_NRCellIdentity_tags_1[0]), /* 1 */
|
||||
asn_DEF_NRCellIdentity_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_NRCellIdentity_tags_1)
|
||||
/sizeof(asn_DEF_NRCellIdentity_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_NRCellIdentity_constr_1, &asn_PER_type_NRCellIdentity_constr_1, NRCellIdentity_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_BIT_STRING_specs /* Additional specs */
|
||||
};
|
||||
|
||||
367
e2sm/lib/NativeEnumerated.c
Normal file
367
e2sm/lib/NativeEnumerated.c
Normal file
@@ -0,0 +1,367 @@
|
||||
/*-
|
||||
* Copyright (c) 2004, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
/*
|
||||
* Read the NativeInteger.h for the explanation wrt. differences between
|
||||
* INTEGER and NativeInteger.
|
||||
* Basically, both are decoders and encoders of ASN.1 INTEGER type, but this
|
||||
* implementation deals with the standard (machine-specific) representation
|
||||
* of them instead of using the platform-independent buffer.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <NativeEnumerated.h>
|
||||
|
||||
/*
|
||||
* NativeEnumerated basic type description.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn_TYPE_operation_t asn_OP_NativeEnumerated = {
|
||||
NativeInteger_free,
|
||||
NativeInteger_print,
|
||||
NativeInteger_compare,
|
||||
NativeInteger_decode_ber,
|
||||
NativeInteger_encode_der,
|
||||
NativeInteger_decode_xer,
|
||||
NativeEnumerated_encode_xer,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
NativeEnumerated_decode_oer,
|
||||
NativeEnumerated_encode_oer,
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
NativeEnumerated_decode_uper,
|
||||
NativeEnumerated_encode_uper,
|
||||
NativeEnumerated_decode_aper,
|
||||
NativeEnumerated_encode_aper,
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
NativeEnumerated_random_fill,
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = {
|
||||
"ENUMERATED", /* The ASN.1 type is still ENUMERATED */
|
||||
"ENUMERATED",
|
||||
&asn_OP_NativeEnumerated,
|
||||
asn_DEF_NativeEnumerated_tags,
|
||||
sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
|
||||
asn_DEF_NativeEnumerated_tags, /* Same as above */
|
||||
sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]),
|
||||
{ 0, 0, asn_generic_no_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeEnumerated_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
int ilevel, enum xer_encoder_flags_e flags,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
const long *native = (const long *)sptr;
|
||||
const asn_INTEGER_enum_map_t *el;
|
||||
|
||||
(void)ilevel;
|
||||
(void)flags;
|
||||
|
||||
if(!native) ASN__ENCODE_FAILED;
|
||||
|
||||
el = INTEGER_map_value2enum(specs, *native);
|
||||
if(el) {
|
||||
er.encoded =
|
||||
asn__format_to_callback(cb, app_key, "<%s/>", el->enum_name);
|
||||
if(er.encoded < 0) ASN__ENCODE_FAILED;
|
||||
ASN__ENCODED_OK(er);
|
||||
} else {
|
||||
ASN_DEBUG(
|
||||
"ASN.1 forbids dealing with "
|
||||
"unknown value of ENUMERATED type");
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeEnumerated_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
void **sptr, asn_per_data_t *pd) {
|
||||
const asn_INTEGER_specifics_t *specs = td->specifics;
|
||||
asn_dec_rval_t rval = { RC_OK, 0 };
|
||||
long *native = (long *)*sptr;
|
||||
const asn_per_constraint_t *ct = NULL;
|
||||
long value;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
|
||||
if(constraints) ct = &constraints->value;
|
||||
else if(td->encoding_constraints.per_constraints)
|
||||
ct = &td->encoding_constraints.per_constraints->value;
|
||||
else ASN__DECODE_FAILED; /* Mandatory! */
|
||||
if(!specs) ASN__DECODE_FAILED;
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
ASN_DEBUG("Decoding %s as NativeEnumerated", td->name);
|
||||
|
||||
if(ct && ct->flags & APC_EXTENSIBLE) {
|
||||
int inext = per_get_few_bits(pd, 1);
|
||||
if(inext < 0) ASN__DECODE_STARVED;
|
||||
if(inext) ct = 0;
|
||||
}
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
value = per_get_few_bits(pd, ct->range_bits);
|
||||
if(value < 0) ASN__DECODE_STARVED;
|
||||
if(value >= (specs->extension
|
||||
? specs->extension - 1 : specs->map_count))
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
if(!specs->extension)
|
||||
ASN__DECODE_FAILED;
|
||||
/*
|
||||
* X.691, #10.6: normally small non-negative whole number;
|
||||
*/
|
||||
value = uper_get_nsnnwn(pd);
|
||||
if(value < 0) ASN__DECODE_STARVED;
|
||||
value += specs->extension - 1;
|
||||
if(value >= specs->map_count)
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
*native = specs->value2enum[value].nat_value;
|
||||
ASN_DEBUG("Decoded %s = %ld", td->name, *native);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
static int
|
||||
NativeEnumerated__compar_value2enum(const void *ap, const void *bp) {
|
||||
const asn_INTEGER_enum_map_t *a = ap;
|
||||
const asn_INTEGER_enum_map_t *b = bp;
|
||||
if(a->nat_value == b->nat_value)
|
||||
return 0;
|
||||
if(a->nat_value < b->nat_value)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeEnumerated_encode_uper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
long native, value;
|
||||
const asn_per_constraint_t *ct = NULL;
|
||||
int inext = 0;
|
||||
asn_INTEGER_enum_map_t key;
|
||||
const asn_INTEGER_enum_map_t *kf;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
if(!specs) ASN__ENCODE_FAILED;
|
||||
|
||||
if(constraints) ct = &constraints->value;
|
||||
else if(td->encoding_constraints.per_constraints)
|
||||
ct = &td->encoding_constraints.per_constraints->value;
|
||||
else ASN__ENCODE_FAILED; /* Mandatory! */
|
||||
|
||||
ASN_DEBUG("Encoding %s as NativeEnumerated", td->name);
|
||||
|
||||
er.encoded = 0;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
|
||||
key.nat_value = native;
|
||||
kf = bsearch(&key, specs->value2enum, specs->map_count,
|
||||
sizeof(key), NativeEnumerated__compar_value2enum);
|
||||
if(!kf) {
|
||||
ASN_DEBUG("No element corresponds to %ld", native);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
value = kf - specs->value2enum;
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
int cmpWith = specs->extension
|
||||
? specs->extension - 1 : specs->map_count;
|
||||
if(value >= cmpWith)
|
||||
inext = 1;
|
||||
}
|
||||
if(ct && ct->flags & APC_EXTENSIBLE) {
|
||||
if(per_put_few_bits(po, inext, 1))
|
||||
ASN__ENCODE_FAILED;
|
||||
if(inext) ct = 0;
|
||||
} else if(inext) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
if(per_put_few_bits(po, value, ct->range_bits))
|
||||
ASN__ENCODE_FAILED;
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
if(!specs->extension)
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
/*
|
||||
* X.691, #10.6: normally small non-negative whole number;
|
||||
*/
|
||||
ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld",
|
||||
value, specs->extension, inext,
|
||||
value - (inext ? (specs->extension - 1) : 0));
|
||||
if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0)))
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeEnumerated_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
void **sptr, asn_per_data_t *pd) {
|
||||
const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval = { RC_OK, 0 };
|
||||
long *native = (long *)*sptr;
|
||||
const asn_per_constraint_t *ct = NULL;
|
||||
long value;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
|
||||
if(constraints) ct = &constraints->value;
|
||||
else if(td->encoding_constraints.per_constraints)
|
||||
ct = &td->encoding_constraints.per_constraints->value;
|
||||
else ASN__DECODE_FAILED; /* Mandatory! */
|
||||
if(!specs) ASN__DECODE_FAILED;
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
ASN_DEBUG("Decoding %s as NativeEnumerated", td->name);
|
||||
|
||||
if(ct && ct->flags & APC_EXTENSIBLE) {
|
||||
int inext = per_get_few_bits(pd, 1);
|
||||
if(inext < 0) ASN__DECODE_STARVED;
|
||||
if(inext) ct = 0;
|
||||
}
|
||||
|
||||
/* Deal with APER padding */
|
||||
if(ct && ct->upper_bound >= 255) {
|
||||
int padding = 0;
|
||||
padding = (8 - (pd->moved % 8)) % 8;
|
||||
ASN_DEBUG("For NativeEnumerated %s,offset= %lu Padding bits = %d", td->name, pd->moved, padding);
|
||||
ASN_DEBUG("For NativeEnumerated %s, upper bound = %lu", td->name, ct->upper_bound);
|
||||
if(padding > 0)
|
||||
per_get_few_bits(pd, padding);
|
||||
}
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
value = per_get_few_bits(pd, ct->range_bits);
|
||||
if(value < 0) ASN__DECODE_STARVED;
|
||||
if(value >= (specs->extension
|
||||
? specs->extension - 1 : specs->map_count))
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
if(!specs->extension)
|
||||
ASN__DECODE_FAILED;
|
||||
/*
|
||||
* X.691, #10.6: normally small non-negative whole number;
|
||||
*/
|
||||
value = uper_get_nsnnwn(pd);
|
||||
if(value < 0) ASN__DECODE_STARVED;
|
||||
value += specs->extension - 1;
|
||||
if(value >= specs->map_count)
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
*native = specs->value2enum[value].nat_value;
|
||||
ASN_DEBUG("Decoded %s = %ld", td->name, *native);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeEnumerated_encode_aper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
long native, value;
|
||||
const asn_per_constraint_t *ct = NULL;
|
||||
int inext = 0;
|
||||
asn_INTEGER_enum_map_t key;
|
||||
asn_INTEGER_enum_map_t *kf;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
if(!specs) ASN__ENCODE_FAILED;
|
||||
|
||||
if(constraints) ct = &constraints->value;
|
||||
else if(td->encoding_constraints.per_constraints)
|
||||
ct = &td->encoding_constraints.per_constraints->value;
|
||||
else ASN__ENCODE_FAILED; /* Mandatory! */
|
||||
|
||||
ASN_DEBUG("Encoding %s as NativeEnumerated", td->name);
|
||||
|
||||
er.encoded = 0;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
if(native < 0) ASN__ENCODE_FAILED;
|
||||
|
||||
key.nat_value = native;
|
||||
kf = bsearch(&key, specs->value2enum, specs->map_count,
|
||||
sizeof(key), NativeEnumerated__compar_value2enum);
|
||||
if(!kf) {
|
||||
ASN_DEBUG("No element corresponds to %ld", native);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
value = kf - specs->value2enum;
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
int cmpWith = specs->extension
|
||||
? specs->extension - 1 : specs->map_count;
|
||||
if(value >= cmpWith)
|
||||
inext = 1;
|
||||
}
|
||||
if(ct && ct->flags & APC_EXTENSIBLE) {
|
||||
if(per_put_few_bits(po, inext, 1))
|
||||
ASN__ENCODE_FAILED;
|
||||
if(inext) ct = 0;
|
||||
} else if(inext) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(ct && ct->range_bits >= 0) {
|
||||
if(per_put_few_bits(po, value, ct->range_bits))
|
||||
ASN__ENCODE_FAILED;
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
if(!specs->extension)
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
/*
|
||||
* X.691, #10.6: normally small non-negative whole number;
|
||||
*/
|
||||
ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld",
|
||||
value, specs->extension, inext,
|
||||
value - (inext ? (specs->extension - 1) : 0));
|
||||
if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0)))
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
149
e2sm/lib/NativeEnumerated_oer.c
Normal file
149
e2sm/lib/NativeEnumerated_oer.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <NativeEnumerated.h>
|
||||
#include <errno.h>
|
||||
|
||||
static long
|
||||
asn__nativeenumerated_convert(const uint8_t *b, const uint8_t *end) {
|
||||
unsigned long value;
|
||||
|
||||
/* Perform the sign initialization */
|
||||
/* Actually value = -(*b >> 7); gains nothing, yet unreadable! */
|
||||
if((*b >> 7)) {
|
||||
value = (unsigned long)(-1);
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
/* Conversion engine */
|
||||
for(; b < end; b++) {
|
||||
value = (value << 8) | *b;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeEnumerated_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
void **nint_ptr, const void *ptr, size_t size) {
|
||||
asn_dec_rval_t rval = {RC_OK, 0};
|
||||
long *native = (long *)*nint_ptr;
|
||||
const uint8_t *b = ptr;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
(void)constraints;
|
||||
|
||||
if(size < 1) {
|
||||
ASN__DECODE_STARVED;
|
||||
}
|
||||
|
||||
if((*b & 0x80) == 0) {
|
||||
/*
|
||||
* X.696 (08/2015) #11.2 Short form for Enumerated.
|
||||
*/
|
||||
if(!native) {
|
||||
native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
*native = *b;
|
||||
rval.consumed = 1;
|
||||
} else {
|
||||
/*
|
||||
* X.696 (08/2015) #11.4 Long form for Enumerated.
|
||||
*/
|
||||
size_t length = *b & 0x7f;
|
||||
const uint8_t *bend;
|
||||
long value;
|
||||
|
||||
if(length < 1 || length > sizeof(*native)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
if((1 + length) > size) {
|
||||
ASN__DECODE_STARVED;
|
||||
}
|
||||
b++;
|
||||
bend = b + length;
|
||||
|
||||
value = asn__nativeenumerated_convert(b, bend);
|
||||
if(value < 0) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
if(specs && specs->field_unsigned) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
*native = value;
|
||||
|
||||
rval.consumed = (1 + length);
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
NativeEnumerated_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
const void *sptr, asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
long native;
|
||||
|
||||
(void)constraints;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
|
||||
if(native >= 0 && native <= 127) {
|
||||
/* #11.2 Short form */
|
||||
uint8_t b = native;
|
||||
er.encoded = 1;
|
||||
if(cb(&b, er.encoded, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
ASN__ENCODED_OK(er);
|
||||
} else {
|
||||
/* #11.2 Long form */
|
||||
uint8_t buf[1 + sizeof(native)];
|
||||
uint8_t *b = &buf[sizeof(native)]; /* Last addressable */
|
||||
long final_pattern = -1 * (native < 0);
|
||||
|
||||
for(;;) {
|
||||
*b-- = native;
|
||||
native >>= 8;
|
||||
if(native == final_pattern) {
|
||||
if(final_pattern) {
|
||||
if((b[1] & 0x80)) break;
|
||||
} else {
|
||||
if(!(b[1] & 0x80)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*b = 0x80 | (&buf[sizeof(native)] - b);
|
||||
er.encoded = 1 + (&buf[sizeof(native)] - b);
|
||||
if(cb(b, er.encoded, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
550
e2sm/lib/NativeInteger.c
Normal file
550
e2sm/lib/NativeInteger.c
Normal file
@@ -0,0 +1,550 @@
|
||||
/*-
|
||||
* Copyright (c) 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
/*
|
||||
* Read the NativeInteger.h for the explanation wrt. differences between
|
||||
* INTEGER and NativeInteger.
|
||||
* Basically, both are decoders and encoders of ASN.1 INTEGER type, but this
|
||||
* implementation deals with the standard (machine-specific) representation
|
||||
* of them instead of using the platform-independent buffer.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <NativeInteger.h>
|
||||
|
||||
/*
|
||||
* NativeInteger basic type description.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_operation_t asn_OP_NativeInteger = {
|
||||
NativeInteger_free,
|
||||
NativeInteger_print,
|
||||
NativeInteger_compare,
|
||||
NativeInteger_decode_ber,
|
||||
NativeInteger_encode_der,
|
||||
NativeInteger_decode_xer,
|
||||
NativeInteger_encode_xer,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
NativeInteger_decode_oer, /* OER decoder */
|
||||
NativeInteger_encode_oer, /* Canonical OER encoder */
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
NativeInteger_decode_uper, /* Unaligned PER decoder */
|
||||
NativeInteger_encode_uper, /* Unaligned PER encoder */
|
||||
NativeInteger_decode_aper, /* Aligned PER decoder */
|
||||
NativeInteger_encode_aper, /* Aligned PER encoder */
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
NativeInteger_random_fill,
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
|
||||
"INTEGER", /* The ASN.1 type is still INTEGER */
|
||||
"INTEGER",
|
||||
&asn_OP_NativeInteger,
|
||||
asn_DEF_NativeInteger_tags,
|
||||
sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
|
||||
asn_DEF_NativeInteger_tags, /* Same as above */
|
||||
sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
|
||||
{ 0, 0, asn_generic_no_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
/*
|
||||
* Decode INTEGER type.
|
||||
*/
|
||||
asn_dec_rval_t
|
||||
NativeInteger_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void **nint_ptr,
|
||||
const void *buf_ptr, size_t size, int tag_mode) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
long *native = (long *)*nint_ptr;
|
||||
asn_dec_rval_t rval;
|
||||
ber_tlv_len_t length;
|
||||
|
||||
/*
|
||||
* If the structure is not there, allocate it.
|
||||
*/
|
||||
if(native == NULL) {
|
||||
native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
if(native == NULL) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
ASN_DEBUG("Decoding %s as INTEGER (tm=%d)",
|
||||
td->name, tag_mode);
|
||||
|
||||
/*
|
||||
* Check tags.
|
||||
*/
|
||||
rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size,
|
||||
tag_mode, 0, &length, 0);
|
||||
if(rval.code != RC_OK)
|
||||
return rval;
|
||||
|
||||
ASN_DEBUG("%s length is %d bytes", td->name, (int)length);
|
||||
|
||||
/*
|
||||
* Make sure we have this length.
|
||||
*/
|
||||
buf_ptr = ((const char *)buf_ptr) + rval.consumed;
|
||||
size -= rval.consumed;
|
||||
if(length > (ber_tlv_len_t)size) {
|
||||
rval.code = RC_WMORE;
|
||||
rval.consumed = 0;
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* ASN.1 encoded INTEGER: buf_ptr, length
|
||||
* Fill the native, at the same time checking for overflow.
|
||||
* If overflow occured, return with RC_FAIL.
|
||||
*/
|
||||
{
|
||||
INTEGER_t tmp;
|
||||
union {
|
||||
const void *constbuf;
|
||||
void *nonconstbuf;
|
||||
} unconst_buf;
|
||||
long l;
|
||||
|
||||
unconst_buf.constbuf = buf_ptr;
|
||||
tmp.buf = (uint8_t *)unconst_buf.nonconstbuf;
|
||||
tmp.size = length;
|
||||
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */
|
||||
: asn_INTEGER2long(&tmp, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
return rval;
|
||||
}
|
||||
|
||||
*native = l;
|
||||
}
|
||||
|
||||
rval.code = RC_OK;
|
||||
rval.consumed += length;
|
||||
|
||||
ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)",
|
||||
(long)rval.consumed, (long)length, td->name, (long)*native);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode the NativeInteger using the standard INTEGER type DER encoder.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
NativeInteger_encode_der(const asn_TYPE_descriptor_t *sd, const void *ptr,
|
||||
int tag_mode, ber_tlv_tag_t tag,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
unsigned long native = *(const unsigned long *)ptr; /* Disable sign ext. */
|
||||
asn_enc_rval_t erval = {0,0,0};
|
||||
INTEGER_t tmp;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */
|
||||
|
||||
tmp.buf = (uint8_t *)&native;
|
||||
tmp.size = sizeof(native);
|
||||
|
||||
#else /* Works even if WORDS_BIGENDIAN is not set where should've been */
|
||||
uint8_t buf[sizeof(native)];
|
||||
uint8_t *p;
|
||||
|
||||
/* Prepare a fake INTEGER */
|
||||
for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8)
|
||||
*p = (uint8_t)native;
|
||||
|
||||
tmp.buf = buf;
|
||||
tmp.size = sizeof(buf);
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
/* Encode fake INTEGER */
|
||||
erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key);
|
||||
if(erval.structure_ptr == &tmp) {
|
||||
erval.structure_ptr = ptr;
|
||||
}
|
||||
return erval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode the chunk of XML text encoding INTEGER.
|
||||
*/
|
||||
asn_dec_rval_t
|
||||
NativeInteger_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void **sptr,
|
||||
const char *opt_mname, const void *buf_ptr,
|
||||
size_t size) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval;
|
||||
INTEGER_t st;
|
||||
void *st_ptr = (void *)&st;
|
||||
long *native = (long *)*sptr;
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr,
|
||||
opt_mname, buf_ptr, size);
|
||||
if(rval.code == RC_OK) {
|
||||
long l;
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */
|
||||
: asn_INTEGER2long(&st, &l)) {
|
||||
rval.code = RC_FAIL;
|
||||
rval.consumed = 0;
|
||||
} else {
|
||||
*native = l;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Cannot restart from the middle;
|
||||
* there is no place to save state in the native type.
|
||||
* Request a continuation from the very beginning.
|
||||
*/
|
||||
rval.consumed = 0;
|
||||
}
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st);
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeInteger_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
int ilevel, enum xer_encoder_flags_e flags,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
char scratch[32]; /* Enough for 64-bit int */
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
const long *native = (const long *)sptr;
|
||||
|
||||
(void)ilevel;
|
||||
(void)flags;
|
||||
|
||||
if(!native) ASN__ENCODE_FAILED;
|
||||
|
||||
er.encoded = snprintf(scratch, sizeof(scratch),
|
||||
(specs && specs->field_unsigned)
|
||||
? "%lu" : "%ld", *native);
|
||||
if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch)
|
||||
|| cb(scratch, er.encoded, app_key) < 0)
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
#ifndef ASN_DISABLE_PER_SUPPORT
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeInteger_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints, void **sptr,
|
||||
asn_per_data_t *pd) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval;
|
||||
long *native = (long *)*sptr;
|
||||
INTEGER_t tmpint;
|
||||
void *tmpintptr = &tmpint;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name);
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memset(&tmpint, 0, sizeof tmpint);
|
||||
rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints,
|
||||
&tmpintptr, pd);
|
||||
if(rval.code == RC_OK) {
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmpint, (unsigned long *)native)
|
||||
: asn_INTEGER2long(&tmpint, native))
|
||||
rval.code = RC_FAIL;
|
||||
else
|
||||
ASN_DEBUG("NativeInteger %s got value %ld",
|
||||
td->name, *native);
|
||||
}
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeInteger_encode_uper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
long native;
|
||||
INTEGER_t tmpint;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
|
||||
ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native);
|
||||
|
||||
memset(&tmpint, 0, sizeof(tmpint));
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_ulong2INTEGER(&tmpint, native)
|
||||
: asn_long2INTEGER(&tmpint, native))
|
||||
ASN__ENCODE_FAILED;
|
||||
er = INTEGER_encode_uper(td, constraints, &tmpint, po);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
return er;
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeInteger_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
|
||||
|
||||
const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval;
|
||||
long *native = (long *)*sptr;
|
||||
INTEGER_t tmpint;
|
||||
void *tmpintptr = &tmpint;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name);
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memset(&tmpint, 0, sizeof tmpint);
|
||||
rval = INTEGER_decode_aper(opt_codec_ctx, td, constraints,
|
||||
&tmpintptr, pd);
|
||||
if(rval.code == RC_OK) {
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_INTEGER2ulong(&tmpint, (unsigned long *)native)
|
||||
: asn_INTEGER2long(&tmpint, native))
|
||||
rval.code = RC_FAIL;
|
||||
else
|
||||
ASN_DEBUG("NativeInteger %s got value %ld",
|
||||
td->name, *native);
|
||||
}
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
NativeInteger_encode_aper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
|
||||
const asn_INTEGER_specifics_t *specs = (const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
long native;
|
||||
INTEGER_t tmpint;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
|
||||
ASN_DEBUG("Encoding NativeInteger %s %ld (APER)", td->name, native);
|
||||
|
||||
memset(&tmpint, 0, sizeof(tmpint));
|
||||
if((specs&&specs->field_unsigned)
|
||||
? asn_ulong2INTEGER(&tmpint, (unsigned long)native)
|
||||
: asn_long2INTEGER(&tmpint, native))
|
||||
ASN__ENCODE_FAILED;
|
||||
er = INTEGER_encode_aper(td, constraints, &tmpint, po);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
return er;
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
|
||||
/*
|
||||
* INTEGER specific human-readable output.
|
||||
*/
|
||||
int
|
||||
NativeInteger_print(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
const long *native = (const long *)sptr;
|
||||
char scratch[32]; /* Enough for 64-bit int */
|
||||
int ret;
|
||||
|
||||
(void)td; /* Unused argument */
|
||||
(void)ilevel; /* Unused argument */
|
||||
|
||||
if(native) {
|
||||
long value = *native;
|
||||
ret = snprintf(scratch, sizeof(scratch),
|
||||
(specs && specs->field_unsigned) ? "%lu" : "%ld", value);
|
||||
assert(ret > 0 && (size_t)ret < sizeof(scratch));
|
||||
if(cb(scratch, ret, app_key) < 0) return -1;
|
||||
if(specs && (value >= 0 || !specs->field_unsigned)) {
|
||||
const asn_INTEGER_enum_map_t *el =
|
||||
INTEGER_map_value2enum(specs, value);
|
||||
if(el) {
|
||||
if(cb(" (", 2, app_key) < 0) return -1;
|
||||
if(cb(el->enum_name, el->enum_len, app_key) < 0) return -1;
|
||||
if(cb(")", 1, app_key) < 0) return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NativeInteger_free(const asn_TYPE_descriptor_t *td, void *ptr,
|
||||
enum asn_struct_free_method method) {
|
||||
if(!td || !ptr)
|
||||
return;
|
||||
|
||||
ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)",
|
||||
td->name, method, ptr);
|
||||
|
||||
switch(method) {
|
||||
case ASFM_FREE_EVERYTHING:
|
||||
FREEMEM(ptr);
|
||||
break;
|
||||
case ASFM_FREE_UNDERLYING:
|
||||
break;
|
||||
case ASFM_FREE_UNDERLYING_AND_RESET:
|
||||
memset(ptr, 0, sizeof(long));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
NativeInteger_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bptr) {
|
||||
(void)td;
|
||||
|
||||
if(aptr && bptr) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
if(specs && specs->field_unsigned) {
|
||||
const unsigned long *a = aptr;
|
||||
const unsigned long *b = bptr;
|
||||
if(*a < *b) {
|
||||
return -1;
|
||||
} else if(*a > *b) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
const long *a = aptr;
|
||||
const long *b = bptr;
|
||||
if(*a < *b) {
|
||||
return -1;
|
||||
} else if(*a > *b) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if(!aptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
asn_random_fill_result_t
|
||||
NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
|
||||
const asn_encoding_constraints_t *constraints,
|
||||
size_t max_length) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
|
||||
asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
|
||||
asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
|
||||
long *st = *sptr;
|
||||
const asn_INTEGER_enum_map_t *emap;
|
||||
size_t emap_len;
|
||||
intmax_t value;
|
||||
int find_inside_map;
|
||||
|
||||
if(max_length == 0) return result_skipped;
|
||||
|
||||
if(st == NULL) {
|
||||
st = (long *)CALLOC(1, sizeof(*st));
|
||||
if(st == NULL) {
|
||||
return result_failed;
|
||||
}
|
||||
}
|
||||
|
||||
if(specs) {
|
||||
emap = specs->value2enum;
|
||||
emap_len = specs->map_count;
|
||||
if(specs->strict_enumeration) {
|
||||
find_inside_map = emap_len > 0;
|
||||
} else {
|
||||
find_inside_map = emap_len ? asn_random_between(0, 1) : 0;
|
||||
}
|
||||
} else {
|
||||
emap = 0;
|
||||
emap_len = 0;
|
||||
find_inside_map = 0;
|
||||
}
|
||||
|
||||
if(find_inside_map) {
|
||||
assert(emap_len > 0);
|
||||
value = emap[asn_random_between(0, emap_len - 1)].nat_value;
|
||||
} else {
|
||||
const asn_per_constraints_t *ct;
|
||||
|
||||
static const long variants[] = {
|
||||
-65536, -65535, -65534, -32769, -32768, -32767, -16385, -16384,
|
||||
-16383, -257, -256, -255, -254, -129, -128, -127,
|
||||
-126, -1, 0, 1, 126, 127, 128, 129,
|
||||
254, 255, 256, 257, 16383, 16384, 16385, 32767,
|
||||
32768, 32769, 65534, 65535, 65536, 65537};
|
||||
if(specs && specs->field_unsigned) {
|
||||
assert(variants[18] == 0);
|
||||
value = variants[asn_random_between(
|
||||
18, sizeof(variants) / sizeof(variants[0]) - 1)];
|
||||
} else {
|
||||
value = variants[asn_random_between(
|
||||
0, sizeof(variants) / sizeof(variants[0]) - 1)];
|
||||
}
|
||||
|
||||
if(!constraints) constraints = &td->encoding_constraints;
|
||||
ct = constraints ? constraints->per_constraints : 0;
|
||||
if(ct && (ct->value.flags & APC_CONSTRAINED)) {
|
||||
if(value < ct->value.lower_bound || value > ct->value.upper_bound) {
|
||||
value = asn_random_between(ct->value.lower_bound,
|
||||
ct->value.upper_bound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*sptr = st;
|
||||
*st = value;
|
||||
return result_ok;
|
||||
}
|
||||
99
e2sm/lib/NativeInteger_oer.c
Normal file
99
e2sm/lib/NativeInteger_oer.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <NativeInteger.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_dec_rval_t
|
||||
NativeInteger_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
void **nint_ptr, const void *ptr, size_t size) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
asn_dec_rval_t rval = {RC_OK, 0};
|
||||
long *native = (long *)*nint_ptr;
|
||||
INTEGER_t tmpint;
|
||||
INTEGER_t *tmpintptr = &tmpint;
|
||||
|
||||
memset(&tmpint, 0, sizeof(tmpint));
|
||||
|
||||
if(!native) {
|
||||
native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
|
||||
if(!native) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* OPTIMIZATION: Encode directly rather than passing through INTEGER.
|
||||
* Saves a memory allocation.
|
||||
*/
|
||||
rval = INTEGER_decode_oer(opt_codec_ctx, td, constraints,
|
||||
(void **)&tmpintptr, ptr, size);
|
||||
if(rval.code != RC_OK) {
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
return rval;
|
||||
}
|
||||
|
||||
if(specs && specs->field_unsigned) {
|
||||
unsigned long ul;
|
||||
int ok = asn_INTEGER2ulong(&tmpint, &ul) == 0;
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
if(ok) {
|
||||
*native = ul;
|
||||
} else {
|
||||
rval.code = RC_FAIL;
|
||||
return rval;
|
||||
}
|
||||
} else {
|
||||
long l;
|
||||
int ok = asn_INTEGER2long(&tmpint, &l) == 0;
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
if(ok) {
|
||||
*native = l;
|
||||
} else {
|
||||
rval.code = RC_FAIL;
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
NativeInteger_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
const void *sptr, asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
const asn_INTEGER_specifics_t *specs =
|
||||
(const asn_INTEGER_specifics_t *)td->specifics;
|
||||
INTEGER_t tmpint;
|
||||
long native;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
|
||||
native = *(const long *)sptr;
|
||||
memset(&tmpint, 0, sizeof(tmpint));
|
||||
|
||||
ASN_DEBUG("Encoding %s %ld as NativeInteger", td ? td->name : "", native);
|
||||
|
||||
if((specs && specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native)
|
||||
: asn_long2INTEGER(&tmpint, native)) {
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
asn_enc_rval_t er =
|
||||
INTEGER_encode_oer(td, constraints, &tmpint, cb, app_key);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
|
||||
return er;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
2411
e2sm/lib/OCTET_STRING.c
Normal file
2411
e2sm/lib/OCTET_STRING.c
Normal file
File diff suppressed because it is too large
Load Diff
171
e2sm/lib/OCTET_STRING_oer.c
Normal file
171
e2sm/lib/OCTET_STRING_oer.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <OCTET_STRING.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_dec_rval_t
|
||||
OCTET_STRING_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, void **sptr,
|
||||
const void *ptr, size_t size) {
|
||||
const asn_OCTET_STRING_specifics_t *specs =
|
||||
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
|
||||
const asn_oer_constraints_t *cts =
|
||||
constraints ? constraints : td->encoding_constraints.oer_constraints;
|
||||
ssize_t ct_size = cts ? cts->size : -1;
|
||||
asn_dec_rval_t rval = {RC_OK, 0};
|
||||
size_t expected_length = 0;
|
||||
|
||||
size_t unit_bytes;
|
||||
switch(specs->subvariant) {
|
||||
default:
|
||||
case ASN_OSUBV_BIT:
|
||||
ASN_DEBUG("Invalid use of OCTET STRING to decode BIT STRING");
|
||||
ASN__DECODE_FAILED;
|
||||
case ASN_OSUBV_ANY:
|
||||
/* Fall through */
|
||||
case ASN_OSUBV_STR:
|
||||
unit_bytes = 1;
|
||||
break;
|
||||
case ASN_OSUBV_U16:
|
||||
unit_bytes = 2;
|
||||
break;
|
||||
case ASN_OSUBV_U32:
|
||||
unit_bytes = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
|
||||
if(!st) {
|
||||
st = (OCTET_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
|
||||
if(!st) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(ct_size >= 0) {
|
||||
expected_length = unit_bytes * ct_size;
|
||||
} else {
|
||||
/*
|
||||
* X.696 (08/2015) #27.2
|
||||
* Encode length determinant as _number of octets_, but only
|
||||
* if upper bound is not equal to lower bound.
|
||||
*/
|
||||
ssize_t len_len = oer_fetch_length(ptr, size, &expected_length);
|
||||
if(len_len > 0) {
|
||||
rval.consumed = len_len;
|
||||
ptr = (const char *)ptr + len_len;
|
||||
size -= len_len;
|
||||
} else if(len_len == 0) {
|
||||
ASN__DECODE_STARVED;
|
||||
} else if(len_len < 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(expected_length % unit_bytes != 0) {
|
||||
ASN_DEBUG(
|
||||
"Data size %" ASN_PRI_SIZE " bytes is not consistent with multiplier %" ASN_PRI_SIZE "",
|
||||
expected_length, unit_bytes);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if(size < expected_length) {
|
||||
ASN__DECODE_STARVED;
|
||||
} else {
|
||||
uint8_t *buf = MALLOC(expected_length + 1);
|
||||
if(buf == NULL) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
memcpy(buf, ptr, expected_length);
|
||||
buf[expected_length] = '\0';
|
||||
}
|
||||
FREEMEM(st->buf);
|
||||
st->buf = buf;
|
||||
st->size = expected_length;
|
||||
|
||||
rval.consumed += expected_length;
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
OCTET_STRING_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints,
|
||||
const void *sptr, asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
const asn_OCTET_STRING_specifics_t *specs =
|
||||
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
|
||||
const asn_oer_constraints_t *cts =
|
||||
constraints ? constraints : td->encoding_constraints.oer_constraints;
|
||||
ssize_t ct_size = cts ? cts->size : -1;
|
||||
asn_enc_rval_t er = {0, 0, 0};
|
||||
|
||||
if(!st) ASN__ENCODE_FAILED;
|
||||
|
||||
ASN_DEBUG("Encoding %s %" ASN_PRI_SIZE " as OCTET STRING", td ? td->name : "", st->size);
|
||||
|
||||
if(ct_size >= 0) {
|
||||
/*
|
||||
* Check that available data matches the constraint
|
||||
*/
|
||||
size_t unit_bytes;
|
||||
switch(specs->subvariant) {
|
||||
default:
|
||||
case ASN_OSUBV_BIT:
|
||||
ASN_DEBUG("Invalid use of OCTET STRING to encode BIT STRING");
|
||||
ASN__ENCODE_FAILED;
|
||||
case ASN_OSUBV_ANY:
|
||||
/* Fall through */
|
||||
case ASN_OSUBV_STR:
|
||||
unit_bytes = 1;
|
||||
break;
|
||||
case ASN_OSUBV_U16:
|
||||
unit_bytes = 2;
|
||||
break;
|
||||
case ASN_OSUBV_U32:
|
||||
unit_bytes = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
if(st->size != unit_bytes * (size_t)ct_size) {
|
||||
ASN_DEBUG(
|
||||
"Trying to encode %s (%" ASN_PRI_SIZE " bytes) which doesn't fit SIZE "
|
||||
"constraint (%" ASN_PRI_SIZE ")",
|
||||
td->name, st->size, ct_size);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* X.696 (08/2015) #27.2
|
||||
* Encode length determinant as _number of octets_, but only
|
||||
* if upper bound is not equal to lower bound.
|
||||
*/
|
||||
ssize_t ret = oer_serialize_length(st->size, cb, app_key);
|
||||
if(ret < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
er.encoded += ret;
|
||||
}
|
||||
|
||||
er.encoded += st->size;
|
||||
if(cb(st->buf, st->size, app_key) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
140
e2sm/lib/OCUCP-PF-Container.c
Normal file
140
e2sm/lib/OCUCP-PF-Container.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "OCUCP-PF-Container.h"
|
||||
|
||||
static int
|
||||
memb_numberOfActive_UEs_constraint_3(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 1 && value <= 65536)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_numberOfActive_UEs_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_numberOfActive_UEs_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 16, -1, 1, 65536 } /* (1..65536,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_cu_CP_Resource_Status_3[] = {
|
||||
{ ATF_POINTER, 1, offsetof(struct OCUCP_PF_Container__cu_CP_Resource_Status, numberOfActive_UEs),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_numberOfActive_UEs_constr_4, &asn_PER_memb_numberOfActive_UEs_constr_4, memb_numberOfActive_UEs_constraint_3 },
|
||||
0, 0, /* No default value */
|
||||
"numberOfActive-UEs"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_cu_CP_Resource_Status_oms_3[] = { 0 };
|
||||
static const ber_tlv_tag_t asn_DEF_cu_CP_Resource_Status_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_cu_CP_Resource_Status_tag2el_3[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* numberOfActive-UEs */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_cu_CP_Resource_Status_specs_3 = {
|
||||
sizeof(struct OCUCP_PF_Container__cu_CP_Resource_Status),
|
||||
offsetof(struct OCUCP_PF_Container__cu_CP_Resource_Status, _asn_ctx),
|
||||
asn_MAP_cu_CP_Resource_Status_tag2el_3,
|
||||
1, /* Count of tags in the map */
|
||||
asn_MAP_cu_CP_Resource_Status_oms_3, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_cu_CP_Resource_Status_3 = {
|
||||
"cu-CP-Resource-Status",
|
||||
"cu-CP-Resource-Status",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_cu_CP_Resource_Status_tags_3,
|
||||
sizeof(asn_DEF_cu_CP_Resource_Status_tags_3)
|
||||
/sizeof(asn_DEF_cu_CP_Resource_Status_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_cu_CP_Resource_Status_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_cu_CP_Resource_Status_tags_3)
|
||||
/sizeof(asn_DEF_cu_CP_Resource_Status_tags_3[0]), /* 2 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_cu_CP_Resource_Status_3,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_cu_CP_Resource_Status_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_OCUCP_PF_Container_1[] = {
|
||||
{ ATF_POINTER, 1, offsetof(struct OCUCP_PF_Container, gNB_CU_CP_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_CU_CP_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-CU-CP-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct OCUCP_PF_Container, cu_CP_Resource_Status),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_cu_CP_Resource_Status_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"cu-CP-Resource-Status"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_OCUCP_PF_Container_oms_1[] = { 0 };
|
||||
static const ber_tlv_tag_t asn_DEF_OCUCP_PF_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_OCUCP_PF_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gNB-CU-CP-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cu-CP-Resource-Status */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_OCUCP_PF_Container_specs_1 = {
|
||||
sizeof(struct OCUCP_PF_Container),
|
||||
offsetof(struct OCUCP_PF_Container, _asn_ctx),
|
||||
asn_MAP_OCUCP_PF_Container_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
asn_MAP_OCUCP_PF_Container_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_OCUCP_PF_Container = {
|
||||
"OCUCP-PF-Container",
|
||||
"OCUCP-PF-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_OCUCP_PF_Container_tags_1,
|
||||
sizeof(asn_DEF_OCUCP_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_OCUCP_PF_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_OCUCP_PF_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_OCUCP_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_OCUCP_PF_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_OCUCP_PF_Container_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_OCUCP_PF_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
142
e2sm/lib/OCUUP-PF-Container.c
Normal file
142
e2sm/lib/OCUUP-PF-Container.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "OCUUP-PF-Container.h"
|
||||
|
||||
#include "PF-ContainerListItem.h"
|
||||
static int
|
||||
memb_pf_ContainerList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 3)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_pf_ContainerList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..3)) */};
|
||||
static asn_per_constraints_t asn_PER_type_pf_ContainerList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pf_ContainerList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..3)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_pf_ContainerList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 2, 2, 1, 3 } /* (SIZE(1..3)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_pf_ContainerList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_PF_ContainerListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_pf_ContainerList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_pf_ContainerList_specs_3 = {
|
||||
sizeof(struct OCUUP_PF_Container__pf_ContainerList),
|
||||
offsetof(struct OCUUP_PF_Container__pf_ContainerList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_pf_ContainerList_3 = {
|
||||
"pf-ContainerList",
|
||||
"pf-ContainerList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_pf_ContainerList_tags_3,
|
||||
sizeof(asn_DEF_pf_ContainerList_tags_3)
|
||||
/sizeof(asn_DEF_pf_ContainerList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_pf_ContainerList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_pf_ContainerList_tags_3)
|
||||
/sizeof(asn_DEF_pf_ContainerList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_pf_ContainerList_constr_3, &asn_PER_type_pf_ContainerList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_pf_ContainerList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_pf_ContainerList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_OCUUP_PF_Container_1[] = {
|
||||
{ ATF_POINTER, 1, offsetof(struct OCUUP_PF_Container, gNB_CU_UP_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_GNB_CU_UP_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"gNB-CU-UP-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct OCUUP_PF_Container, pf_ContainerList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_pf_ContainerList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_pf_ContainerList_constr_3, &asn_PER_memb_pf_ContainerList_constr_3, memb_pf_ContainerList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pf-ContainerList"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_OCUUP_PF_Container_oms_1[] = { 0 };
|
||||
static const ber_tlv_tag_t asn_DEF_OCUUP_PF_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_OCUUP_PF_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gNB-CU-UP-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* pf-ContainerList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_OCUUP_PF_Container_specs_1 = {
|
||||
sizeof(struct OCUUP_PF_Container),
|
||||
offsetof(struct OCUUP_PF_Container, _asn_ctx),
|
||||
asn_MAP_OCUUP_PF_Container_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
asn_MAP_OCUUP_PF_Container_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_OCUUP_PF_Container = {
|
||||
"OCUUP-PF-Container",
|
||||
"OCUUP-PF-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_OCUUP_PF_Container_tags_1,
|
||||
sizeof(asn_DEF_OCUUP_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_OCUUP_PF_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_OCUUP_PF_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_OCUUP_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_OCUUP_PF_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_OCUUP_PF_Container_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_OCUUP_PF_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/ODU-PF-Container.c
Normal file
130
e2sm/lib/ODU-PF-Container.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "ODU-PF-Container.h"
|
||||
|
||||
#include "CellResourceReportListItem.h"
|
||||
static int
|
||||
memb_cellResourceReportList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 512)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_type_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..512)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_cellResourceReportList_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 9, 9, 1, 512 } /* (SIZE(1..512)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_cellResourceReportList_2[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_CellResourceReportListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_cellResourceReportList_tags_2[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_cellResourceReportList_specs_2 = {
|
||||
sizeof(struct ODU_PF_Container__cellResourceReportList),
|
||||
offsetof(struct ODU_PF_Container__cellResourceReportList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_cellResourceReportList_2 = {
|
||||
"cellResourceReportList",
|
||||
"cellResourceReportList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_cellResourceReportList_tags_2,
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]) - 1, /* 1 */
|
||||
asn_DEF_cellResourceReportList_tags_2, /* Same as above */
|
||||
sizeof(asn_DEF_cellResourceReportList_tags_2)
|
||||
/sizeof(asn_DEF_cellResourceReportList_tags_2[0]), /* 2 */
|
||||
{ &asn_OER_type_cellResourceReportList_constr_2, &asn_PER_type_cellResourceReportList_constr_2, SEQUENCE_OF_constraint },
|
||||
asn_MBR_cellResourceReportList_2,
|
||||
1, /* Single element */
|
||||
&asn_SPC_cellResourceReportList_specs_2 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_ODU_PF_Container_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ODU_PF_Container, cellResourceReportList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
0,
|
||||
&asn_DEF_cellResourceReportList_2,
|
||||
0,
|
||||
{ &asn_OER_memb_cellResourceReportList_constr_2, &asn_PER_memb_cellResourceReportList_constr_2, memb_cellResourceReportList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"cellResourceReportList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_ODU_PF_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_ODU_PF_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* cellResourceReportList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_ODU_PF_Container_specs_1 = {
|
||||
sizeof(struct ODU_PF_Container),
|
||||
offsetof(struct ODU_PF_Container, _asn_ctx),
|
||||
asn_MAP_ODU_PF_Container_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ODU_PF_Container = {
|
||||
"ODU-PF-Container",
|
||||
"ODU-PF-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_ODU_PF_Container_tags_1,
|
||||
sizeof(asn_DEF_ODU_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_ODU_PF_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_ODU_PF_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_ODU_PF_Container_tags_1)
|
||||
/sizeof(asn_DEF_ODU_PF_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_ODU_PF_Container_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_ODU_PF_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
509
e2sm/lib/OPEN_TYPE.c
Normal file
509
e2sm/lib/OPEN_TYPE.c
Normal file
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <OPEN_TYPE.h>
|
||||
#include <constr_CHOICE.h>
|
||||
#include <per_opentype.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
|
||||
OPEN_TYPE_free,
|
||||
OPEN_TYPE_print,
|
||||
OPEN_TYPE_compare,
|
||||
OPEN_TYPE_decode_ber,
|
||||
OPEN_TYPE_encode_der,
|
||||
OPEN_TYPE_decode_xer,
|
||||
OPEN_TYPE_encode_xer,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0, 0, /* No OER support, use "-gen-OER" to enable */
|
||||
#else
|
||||
OPEN_TYPE_decode_oer,
|
||||
OPEN_TYPE_encode_oer,
|
||||
#endif
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0, 0, 0, 0,
|
||||
#else
|
||||
OPEN_TYPE_decode_uper,
|
||||
OPEN_TYPE_encode_uper,
|
||||
OPEN_TYPE_decode_aper,
|
||||
OPEN_TYPE_encode_aper,
|
||||
#endif
|
||||
0, /* Random fill is not supported for open type */
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
|
||||
#undef ADVANCE
|
||||
#define ADVANCE(num_bytes) \
|
||||
do { \
|
||||
size_t num = num_bytes; \
|
||||
ptr = ((const char *)ptr) + num; \
|
||||
size -= num; \
|
||||
consumed_myself += num; \
|
||||
} while(0)
|
||||
|
||||
asn_dec_rval_t
|
||||
OPEN_TYPE_ber_get(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
const asn_TYPE_member_t *elm, const void *ptr, size_t size) {
|
||||
size_t consumed_myself = 0;
|
||||
asn_type_selector_result_t selected;
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
void *inner_value;
|
||||
asn_dec_rval_t rv;
|
||||
|
||||
if(!(elm->flags & ATF_OPEN_TYPE)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(!elm->type_selector) {
|
||||
ASN_DEBUG("Type selector is not defined for Open Type %s->%s->%s",
|
||||
td->name, elm->name, elm->type->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
selected = elm->type_selector(td, sptr);
|
||||
if(!selected.presence_index) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/* Fetch the pointer to this member */
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
|
||||
} else {
|
||||
memb_ptr = (char *)sptr + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
if(*memb_ptr2 != NULL) {
|
||||
/* Make sure we reset the structure first before encoding */
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2, 0) != 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
inner_value =
|
||||
(char *)*memb_ptr2
|
||||
+ elm->type->elements[selected.presence_index - 1].memb_offset;
|
||||
|
||||
ASN_DEBUG("presence %d\n", selected.presence_index);
|
||||
|
||||
rv = selected.type_descriptor->op->ber_decoder(
|
||||
opt_codec_ctx, selected.type_descriptor, &inner_value, ptr, size,
|
||||
elm->tag_mode);
|
||||
ADVANCE(rv.consumed);
|
||||
rv.consumed = 0;
|
||||
switch(rv.code) {
|
||||
case RC_OK:
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2,
|
||||
selected.presence_index)
|
||||
== 0) {
|
||||
rv.code = RC_OK;
|
||||
rv.consumed = consumed_myself;
|
||||
return rv;
|
||||
} else {
|
||||
/* Oh, now a full-blown failure failure */
|
||||
}
|
||||
/* Fall through */
|
||||
case RC_FAIL:
|
||||
rv.consumed = consumed_myself;
|
||||
/* Fall through */
|
||||
case RC_WMORE:
|
||||
break;
|
||||
}
|
||||
|
||||
if(*memb_ptr2) {
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
ASN_STRUCT_FREE(*selected.type_descriptor, inner_value);
|
||||
*memb_ptr2 = NULL;
|
||||
} else {
|
||||
ASN_STRUCT_RESET(*selected.type_descriptor,
|
||||
inner_value);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
OPEN_TYPE_xer_get(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
const asn_TYPE_member_t *elm, const void *ptr, size_t size) {
|
||||
size_t consumed_myself = 0;
|
||||
asn_type_selector_result_t selected;
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
void *inner_value;
|
||||
asn_dec_rval_t rv;
|
||||
|
||||
int xer_context = 0;
|
||||
ssize_t ch_size;
|
||||
pxer_chunk_type_e ch_type;
|
||||
|
||||
if(!(elm->flags & ATF_OPEN_TYPE)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(!elm->type_selector) {
|
||||
ASN_DEBUG("Type selector is not defined for Open Type %s->%s->%s",
|
||||
td->name, elm->name, elm->type->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
selected = elm->type_selector(td, sptr);
|
||||
if(!selected.presence_index) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/* Fetch the pointer to this member */
|
||||
assert(elm->flags == ATF_OPEN_TYPE);
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
|
||||
} else {
|
||||
memb_ptr = (char *)sptr + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
if(*memb_ptr2 != NULL) {
|
||||
/* Make sure we reset the structure first before encoding */
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2, 0)
|
||||
!= 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirm wrapper.
|
||||
*/
|
||||
for(;;) {
|
||||
ch_size = xer_next_token(&xer_context, ptr, size, &ch_type);
|
||||
if(ch_size < 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
switch(ch_type) {
|
||||
case PXER_WMORE:
|
||||
ASN__DECODE_STARVED;
|
||||
case PXER_COMMENT:
|
||||
case PXER_TEXT:
|
||||
ADVANCE(ch_size);
|
||||
continue;
|
||||
case PXER_TAG:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper value confirmed.
|
||||
*/
|
||||
switch(xer_check_tag(ptr, ch_size, elm->name)) {
|
||||
case XCT_OPENING:
|
||||
ADVANCE(ch_size);
|
||||
break;
|
||||
case XCT_BROKEN:
|
||||
default:
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
inner_value =
|
||||
(char *)*memb_ptr2
|
||||
+ elm->type->elements[selected.presence_index - 1].memb_offset;
|
||||
|
||||
rv = selected.type_descriptor->op->xer_decoder(
|
||||
opt_codec_ctx, selected.type_descriptor, &inner_value, NULL, ptr, size);
|
||||
ADVANCE(rv.consumed);
|
||||
rv.consumed = 0;
|
||||
switch(rv.code) {
|
||||
case RC_OK:
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2,
|
||||
selected.presence_index)
|
||||
== 0) {
|
||||
break;
|
||||
} else {
|
||||
rv.code = RC_FAIL;
|
||||
}
|
||||
/* Fall through */
|
||||
case RC_FAIL:
|
||||
/* Point to a best position where failure occurred */
|
||||
rv.consumed = consumed_myself;
|
||||
/* Fall through */
|
||||
case RC_WMORE:
|
||||
/* Wrt. rv.consumed==0:
|
||||
* In case a genuine RC_WMORE, the whole Open Type decoding
|
||||
* will have to be restarted.
|
||||
*/
|
||||
if(*memb_ptr2) {
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
ASN_STRUCT_FREE(*selected.type_descriptor, inner_value);
|
||||
*memb_ptr2 = NULL;
|
||||
} else {
|
||||
ASN_STRUCT_RESET(*selected.type_descriptor,
|
||||
inner_value);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finalize wrapper.
|
||||
*/
|
||||
for(;;) {
|
||||
ch_size = xer_next_token(&xer_context, ptr, size, &ch_type);
|
||||
if(ch_size < 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
switch(ch_type) {
|
||||
case PXER_WMORE:
|
||||
ASN__DECODE_STARVED;
|
||||
case PXER_COMMENT:
|
||||
case PXER_TEXT:
|
||||
ADVANCE(ch_size);
|
||||
continue;
|
||||
case PXER_TAG:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper value confirmed.
|
||||
*/
|
||||
switch(xer_check_tag(ptr, ch_size, elm->name)) {
|
||||
case XCT_CLOSING:
|
||||
ADVANCE(ch_size);
|
||||
break;
|
||||
case XCT_BROKEN:
|
||||
default:
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
rv.consumed += consumed_myself;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
#ifndef ASN_DISABLE_PER_SUPPORT
|
||||
|
||||
asn_dec_rval_t
|
||||
OPEN_TYPE_uper_get(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
const asn_TYPE_member_t *elm, asn_per_data_t *pd) {
|
||||
asn_type_selector_result_t selected;
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
void *inner_value;
|
||||
asn_dec_rval_t rv;
|
||||
|
||||
if(!(elm->flags & ATF_OPEN_TYPE)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(!elm->type_selector) {
|
||||
ASN_DEBUG("Type selector is not defined for Open Type %s->%s->%s",
|
||||
td->name, elm->name, elm->type->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
selected = elm->type_selector(td, sptr);
|
||||
if(!selected.presence_index) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/* Fetch the pointer to this member */
|
||||
assert(elm->flags == ATF_OPEN_TYPE);
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
|
||||
} else {
|
||||
memb_ptr = (char *)sptr + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
if(*memb_ptr2 != NULL) {
|
||||
/* Make sure we reset the structure first before encoding */
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2, 0)
|
||||
!= 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
inner_value =
|
||||
(char *)*memb_ptr2
|
||||
+ elm->type->elements[selected.presence_index - 1].memb_offset;
|
||||
|
||||
rv = uper_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL,
|
||||
&inner_value, pd);
|
||||
switch(rv.code) {
|
||||
case RC_OK:
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2,
|
||||
selected.presence_index)
|
||||
== 0) {
|
||||
break;
|
||||
} else {
|
||||
rv.code = RC_FAIL;
|
||||
}
|
||||
/* Fall through */
|
||||
case RC_WMORE:
|
||||
case RC_FAIL:
|
||||
if(*memb_ptr2) {
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
ASN_STRUCT_FREE(*selected.type_descriptor, inner_value);
|
||||
*memb_ptr2 = NULL;
|
||||
} else {
|
||||
ASN_STRUCT_RESET(*selected.type_descriptor,
|
||||
inner_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
OPEN_TYPE_encode_uper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const void *memb_ptr; /* Pointer to the member */
|
||||
asn_TYPE_member_t *elm; /* CHOICE's element */
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
unsigned present;
|
||||
|
||||
(void)constraints;
|
||||
|
||||
present = CHOICE_variant_get_presence(td, sptr);
|
||||
if(present == 0 || present > td->elements_count) {
|
||||
ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
present--;
|
||||
}
|
||||
|
||||
ASN_DEBUG("Encoding %s OPEN TYPE element %d", td->name, present);
|
||||
|
||||
elm = &td->elements[present];
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
/* Member is a pointer to another structure */
|
||||
memb_ptr =
|
||||
*(const void *const *)((const char *)sptr + elm->memb_offset);
|
||||
if(!memb_ptr) ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
memb_ptr = (const char *)sptr + elm->memb_offset;
|
||||
}
|
||||
|
||||
if(uper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
er.encoded = 0;
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
OPEN_TYPE_aper_get(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
const asn_TYPE_member_t *elm, asn_per_data_t *pd) {
|
||||
asn_type_selector_result_t selected;
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
void *inner_value;
|
||||
asn_dec_rval_t rv;
|
||||
|
||||
if(!(elm->flags & ATF_OPEN_TYPE)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(!elm->type_selector) {
|
||||
ASN_DEBUG("Type selector is not defined for Open Type %s->%s->%s",
|
||||
td->name, elm->name, elm->type->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
selected = elm->type_selector(td, sptr);
|
||||
if(!selected.presence_index) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/* Fetch the pointer to this member */
|
||||
assert(elm->flags == ATF_OPEN_TYPE);
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
|
||||
} else {
|
||||
memb_ptr = (char *)sptr + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
if(*memb_ptr2 != NULL) {
|
||||
/* Make sure we reset the structure first before encoding */
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2, 0)
|
||||
!= 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
inner_value =
|
||||
(char *)*memb_ptr2
|
||||
+ elm->type->elements[selected.presence_index - 1].memb_offset;
|
||||
|
||||
rv = aper_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL,
|
||||
&inner_value, pd);
|
||||
switch(rv.code) {
|
||||
case RC_OK:
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2,
|
||||
selected.presence_index)
|
||||
== 0) {
|
||||
break;
|
||||
} else {
|
||||
rv.code = RC_FAIL;
|
||||
}
|
||||
/* Fall through */
|
||||
case RC_WMORE:
|
||||
case RC_FAIL:
|
||||
if(*memb_ptr2) {
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
ASN_STRUCT_FREE(*selected.type_descriptor, inner_value);
|
||||
*memb_ptr2 = NULL;
|
||||
} else {
|
||||
ASN_STRUCT_RESET(*selected.type_descriptor,
|
||||
inner_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
OPEN_TYPE_encode_aper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints,
|
||||
const void *sptr, asn_per_outp_t *po) {
|
||||
const void *memb_ptr; /* Pointer to the member */
|
||||
asn_TYPE_member_t *elm; /* CHOICE's element */
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
unsigned present;
|
||||
|
||||
(void)constraints;
|
||||
|
||||
present = CHOICE_variant_get_presence(td, sptr);
|
||||
if(present == 0 || present > td->elements_count) {
|
||||
ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
present--;
|
||||
}
|
||||
|
||||
ASN_DEBUG("Encoding %s OPEN TYPE element %d", td->name, present);
|
||||
|
||||
elm = &td->elements[present];
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
/* Member is a pointer to another structure */
|
||||
memb_ptr =
|
||||
*(const void *const *)((const char *)sptr + elm->memb_offset);
|
||||
if(!memb_ptr) ASN__ENCODE_FAILED;
|
||||
} else {
|
||||
memb_ptr = (const char *)sptr + elm->memb_offset;
|
||||
}
|
||||
|
||||
if(aper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
er.encoded = 0;
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
92
e2sm/lib/OPEN_TYPE_oer.c
Normal file
92
e2sm/lib/OPEN_TYPE_oer.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <OPEN_TYPE.h>
|
||||
#include <constr_CHOICE.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn_dec_rval_t
|
||||
OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
asn_TYPE_member_t *elm, const void *ptr, size_t size) {
|
||||
asn_type_selector_result_t selected;
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
void *inner_value;
|
||||
asn_dec_rval_t rv;
|
||||
size_t ot_ret;
|
||||
|
||||
|
||||
if(!(elm->flags & ATF_OPEN_TYPE)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
if(!elm->type_selector) {
|
||||
ASN_DEBUG("Type selector is not defined for Open Type %s->%s->%s",
|
||||
td->name, elm->name, elm->type->name);
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
selected = elm->type_selector(td, sptr);
|
||||
if(!selected.presence_index) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
/* Fetch the pointer to this member */
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
|
||||
} else {
|
||||
memb_ptr = (char *)sptr + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
if(*memb_ptr2 != NULL) {
|
||||
/* Make sure we reset the structure first before encoding */
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2, 0) != 0) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
inner_value =
|
||||
(char *)*memb_ptr2
|
||||
+ elm->type->elements[selected.presence_index - 1].memb_offset;
|
||||
|
||||
ot_ret = oer_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL,
|
||||
&inner_value, ptr, size);
|
||||
switch(ot_ret) {
|
||||
default:
|
||||
if(CHOICE_variant_set_presence(elm->type, *memb_ptr2,
|
||||
selected.presence_index)
|
||||
== 0) {
|
||||
rv.code = RC_OK;
|
||||
rv.consumed = ot_ret;
|
||||
return rv;
|
||||
} else {
|
||||
/* Oh, now a full-blown failure failure */
|
||||
}
|
||||
/* Fall through */
|
||||
case -1:
|
||||
rv.code = RC_FAIL;
|
||||
rv.consumed = ot_ret;
|
||||
break;
|
||||
case 0:
|
||||
rv.code = RC_WMORE;
|
||||
rv.consumed = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(*memb_ptr2) {
|
||||
const asn_CHOICE_specifics_t *specs =
|
||||
selected.type_descriptor->specifics;
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
ASN_STRUCT_FREE(*selected.type_descriptor, inner_value);
|
||||
*memb_ptr2 = NULL;
|
||||
} else {
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(*selected.type_descriptor,
|
||||
inner_value);
|
||||
memset(*memb_ptr2, 0, specs->struct_size);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
78
e2sm/lib/PF-Container.c
Normal file
78
e2sm/lib/PF-Container.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PF-Container.h"
|
||||
|
||||
#include "ODU-PF-Container.h"
|
||||
#include "OCUCP-PF-Container.h"
|
||||
#include "OCUUP-PF-Container.h"
|
||||
static asn_oer_constraints_t asn_OER_type_PF_Container_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_PF_Container_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_PF_Container_1[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct PF_Container, choice.oDU),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_ODU_PF_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oDU"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct PF_Container, choice.oCU_CP),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCUCP_PF_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oCU-CP"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct PF_Container, choice.oCU_UP),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCUUP_PF_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oCU-UP"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PF_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* oDU */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* oCU-CP */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* oCU-UP */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_PF_Container_specs_1 = {
|
||||
sizeof(struct PF_Container),
|
||||
offsetof(struct PF_Container, _asn_ctx),
|
||||
offsetof(struct PF_Container, present),
|
||||
sizeof(((struct PF_Container *)0)->present),
|
||||
asn_MAP_PF_Container_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0,
|
||||
3 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PF_Container = {
|
||||
"PF-Container",
|
||||
"PF-Container",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_PF_Container_constr_1, &asn_PER_type_PF_Container_constr_1, CHOICE_constraint },
|
||||
asn_MBR_PF_Container_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_PF_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/PF-ContainerListItem.c
Normal file
60
e2sm/lib/PF-ContainerListItem.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PF-ContainerListItem.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_PF_ContainerListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct PF_ContainerListItem, interface_type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NI_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"interface-type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct PF_ContainerListItem, o_CU_UP_PM_Container),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_CUUPMeasurement_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"o-CU-UP-PM-Container"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_PF_ContainerListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PF_ContainerListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* interface-type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* o-CU-UP-PM-Container */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_PF_ContainerListItem_specs_1 = {
|
||||
sizeof(struct PF_ContainerListItem),
|
||||
offsetof(struct PF_ContainerListItem, _asn_ctx),
|
||||
asn_MAP_PF_ContainerListItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PF_ContainerListItem = {
|
||||
"PF-ContainerListItem",
|
||||
"PF-ContainerListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_PF_ContainerListItem_tags_1,
|
||||
sizeof(asn_DEF_PF_ContainerListItem_tags_1)
|
||||
/sizeof(asn_DEF_PF_ContainerListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_PF_ContainerListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PF_ContainerListItem_tags_1)
|
||||
/sizeof(asn_DEF_PF_ContainerListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_PF_ContainerListItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_PF_ContainerListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
65
e2sm/lib/PLMN-Identity.c
Normal file
65
e2sm/lib/PLMN-Identity.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PLMN-Identity.h"
|
||||
|
||||
int
|
||||
PLMN_Identity_constraint(const 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 == 3)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This type is implemented using OCTET_STRING,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_PLMN_Identity_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
3 /* (SIZE(3..3)) */};
|
||||
asn_per_constraints_t asn_PER_type_PLMN_Identity_constr_1 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 3, 3 } /* (SIZE(3..3)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_PLMN_Identity_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PLMN_Identity = {
|
||||
"PLMN-Identity",
|
||||
"PLMN-Identity",
|
||||
&asn_OP_OCTET_STRING,
|
||||
asn_DEF_PLMN_Identity_tags_1,
|
||||
sizeof(asn_DEF_PLMN_Identity_tags_1)
|
||||
/sizeof(asn_DEF_PLMN_Identity_tags_1[0]), /* 1 */
|
||||
asn_DEF_PLMN_Identity_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PLMN_Identity_tags_1)
|
||||
/sizeof(asn_DEF_PLMN_Identity_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_PLMN_Identity_constr_1, &asn_PER_type_PLMN_Identity_constr_1, PLMN_Identity_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_OCTET_STRING_specs /* Additional specs */
|
||||
};
|
||||
|
||||
64
e2sm/lib/PM-Containers-List.c
Normal file
64
e2sm/lib/PM-Containers-List.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PM-Containers-List.h"
|
||||
|
||||
#include "PF-Container.h"
|
||||
#include "RAN-Container.h"
|
||||
asn_TYPE_member_t asn_MBR_PM_Containers_List_1[] = {
|
||||
{ ATF_POINTER, 2, offsetof(struct PM_Containers_List, performanceContainer),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_PF_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"performanceContainer"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct PM_Containers_List, theRANContainer),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RAN_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"theRANContainer"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_PM_Containers_List_oms_1[] = { 0, 1 };
|
||||
static const ber_tlv_tag_t asn_DEF_PM_Containers_List_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PM_Containers_List_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* performanceContainer */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* theRANContainer */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_PM_Containers_List_specs_1 = {
|
||||
sizeof(struct PM_Containers_List),
|
||||
offsetof(struct PM_Containers_List, _asn_ctx),
|
||||
asn_MAP_PM_Containers_List_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
asn_MAP_PM_Containers_List_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PM_Containers_List = {
|
||||
"PM-Containers-List",
|
||||
"PM-Containers-List",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_PM_Containers_List_tags_1,
|
||||
sizeof(asn_DEF_PM_Containers_List_tags_1)
|
||||
/sizeof(asn_DEF_PM_Containers_List_tags_1[0]), /* 1 */
|
||||
asn_DEF_PM_Containers_List_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PM_Containers_List_tags_1)
|
||||
/sizeof(asn_DEF_PM_Containers_List_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_PM_Containers_List_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_PM_Containers_List_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
171
e2sm/lib/PerQCIReportListItem.c
Normal file
171
e2sm/lib/PerQCIReportListItem.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PerQCIReportListItem.h"
|
||||
|
||||
static int
|
||||
memb_qci_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_dl_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 100)) {
|
||||
/* 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_ul_PRBUsage_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 100)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_qci_constr_2 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_qci_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..100) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_dl_PRBUsage_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 0, 100 } /* (0..100) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..100) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_ul_PRBUsage_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 0, 100 } /* (0..100) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_PerQCIReportListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct PerQCIReportListItem, qci),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_qci_constr_2, &asn_PER_memb_qci_constr_2, memb_qci_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"qci"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct PerQCIReportListItem, dl_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_dl_PRBUsage_constr_3, &asn_PER_memb_dl_PRBUsage_constr_3, memb_dl_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"dl-PRBUsage"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct PerQCIReportListItem, ul_PRBUsage),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_ul_PRBUsage_constr_4, &asn_PER_memb_ul_PRBUsage_constr_4, memb_ul_PRBUsage_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ul-PRBUsage"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_PerQCIReportListItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_PerQCIReportListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PerQCIReportListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* qci */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* dl-PRBUsage */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ul-PRBUsage */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_PerQCIReportListItem_specs_1 = {
|
||||
sizeof(struct PerQCIReportListItem),
|
||||
offsetof(struct PerQCIReportListItem, _asn_ctx),
|
||||
asn_MAP_PerQCIReportListItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_PerQCIReportListItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PerQCIReportListItem = {
|
||||
"PerQCIReportListItem",
|
||||
"PerQCIReportListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_PerQCIReportListItem_tags_1,
|
||||
sizeof(asn_DEF_PerQCIReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_PerQCIReportListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_PerQCIReportListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PerQCIReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_PerQCIReportListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_PerQCIReportListItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_PerQCIReportListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
183
e2sm/lib/PerQCIReportListItemFormat.c
Normal file
183
e2sm/lib/PerQCIReportListItemFormat.c
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PerQCIReportListItemFormat.h"
|
||||
|
||||
static int
|
||||
memb_qci_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
value = *(const long *)sptr;
|
||||
|
||||
if((value >= 0 && value <= 255)) {
|
||||
/* 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_pDCPBytesDL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_pDCPBytesUL_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const INTEGER_t *st = (const INTEGER_t *)sptr;
|
||||
long value;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(asn_INTEGER2long(st, &value)) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value too large (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((value >= 0 && value <= 10000000000)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_qci_constr_2 CC_NOTUSED = {
|
||||
{ 1, 1 } /* (0..255) */,
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_qci_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 } /* (0..255) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesDL_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_memb_pDCPBytesUL_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 34, -1, 0, 10000000000 } /* (0..10000000000,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_PerQCIReportListItemFormat_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct PerQCIReportListItemFormat, qci),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ &asn_OER_memb_qci_constr_2, &asn_PER_memb_qci_constr_2, memb_qci_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"qci"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct PerQCIReportListItemFormat, pDCPBytesDL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesDL_constr_3, &asn_PER_memb_pDCPBytesDL_constr_3, memb_pDCPBytesDL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesDL"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct PerQCIReportListItemFormat, pDCPBytesUL),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ &asn_OER_memb_pDCPBytesUL_constr_4, &asn_PER_memb_pDCPBytesUL_constr_4, memb_pDCPBytesUL_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"pDCPBytesUL"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_PerQCIReportListItemFormat_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_PerQCIReportListItemFormat_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PerQCIReportListItemFormat_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* qci */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pDCPBytesDL */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* pDCPBytesUL */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_PerQCIReportListItemFormat_specs_1 = {
|
||||
sizeof(struct PerQCIReportListItemFormat),
|
||||
offsetof(struct PerQCIReportListItemFormat, _asn_ctx),
|
||||
asn_MAP_PerQCIReportListItemFormat_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_PerQCIReportListItemFormat_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PerQCIReportListItemFormat = {
|
||||
"PerQCIReportListItemFormat",
|
||||
"PerQCIReportListItemFormat",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_PerQCIReportListItemFormat_tags_1,
|
||||
sizeof(asn_DEF_PerQCIReportListItemFormat_tags_1)
|
||||
/sizeof(asn_DEF_PerQCIReportListItemFormat_tags_1[0]), /* 1 */
|
||||
asn_DEF_PerQCIReportListItemFormat_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PerQCIReportListItemFormat_tags_1)
|
||||
/sizeof(asn_DEF_PerQCIReportListItemFormat_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_PerQCIReportListItemFormat_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_PerQCIReportListItemFormat_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
74
e2sm/lib/PlmnID-List.c
Normal file
74
e2sm/lib/PlmnID-List.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "PlmnID-List.h"
|
||||
|
||||
#include "FGC-CUUP-PM-Format.h"
|
||||
#include "EPC-CUUP-PM-Format.h"
|
||||
asn_TYPE_member_t asn_MBR_PlmnID_List_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct PlmnID_List, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct PlmnID_List, cu_UP_PM_5GC),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_FGC_CUUP_PM_Format,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"cu-UP-PM-5GC"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct PlmnID_List, cu_UP_PM_EPC),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_EPC_CUUP_PM_Format,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"cu-UP-PM-EPC"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_PlmnID_List_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_PlmnID_List_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_PlmnID_List_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cu-UP-PM-5GC */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* cu-UP-PM-EPC */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_PlmnID_List_specs_1 = {
|
||||
sizeof(struct PlmnID_List),
|
||||
offsetof(struct PlmnID_List, _asn_ctx),
|
||||
asn_MAP_PlmnID_List_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_PlmnID_List_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PlmnID_List = {
|
||||
"PlmnID-List",
|
||||
"PlmnID-List",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_PlmnID_List_tags_1,
|
||||
sizeof(asn_DEF_PlmnID_List_tags_1)
|
||||
/sizeof(asn_DEF_PlmnID_List_tags_1[0]), /* 1 */
|
||||
asn_DEF_PlmnID_List_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_PlmnID_List_tags_1)
|
||||
/sizeof(asn_DEF_PlmnID_List_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_PlmnID_List_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_PlmnID_List_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/PrintableString.c
Normal file
130
e2sm/lib/PrintableString.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004, 2006 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <PrintableString.h>
|
||||
|
||||
/*
|
||||
* ASN.1:1984 (X.409)
|
||||
*/
|
||||
static const int _PrintableString_alphabet[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int _PrintableString_code2value[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122};
|
||||
|
||||
/*
|
||||
* PrintableString basic type description.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_PrintableString_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2)), /* [UNIVERSAL 19] IMPLICIT ...*/
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
|
||||
};
|
||||
static int asn_DEF_PrintableString_v2c(unsigned int value) {
|
||||
return _PrintableString_alphabet[value > 255 ? 0 : value] - 1;
|
||||
}
|
||||
static int asn_DEF_PrintableString_c2v(unsigned int code) {
|
||||
if(code < 74)
|
||||
return _PrintableString_code2value[code];
|
||||
return -1;
|
||||
}
|
||||
static asn_per_constraints_t asn_DEF_PrintableString_per_constraints = {
|
||||
{ APC_CONSTRAINED, 4, 4, 0x20, 0x39 }, /* Value */
|
||||
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */
|
||||
asn_DEF_PrintableString_v2c,
|
||||
asn_DEF_PrintableString_c2v
|
||||
};
|
||||
asn_TYPE_operation_t asn_OP_PrintableString = {
|
||||
OCTET_STRING_free,
|
||||
OCTET_STRING_print_utf8, /* ASCII subset */
|
||||
OCTET_STRING_compare,
|
||||
OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
|
||||
OCTET_STRING_encode_der,
|
||||
OCTET_STRING_decode_xer_utf8,
|
||||
OCTET_STRING_encode_xer_utf8,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
OCTET_STRING_decode_oer,
|
||||
OCTET_STRING_encode_oer,
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
OCTET_STRING_decode_uper,
|
||||
OCTET_STRING_encode_uper,
|
||||
OCTET_STRING_decode_aper,
|
||||
OCTET_STRING_encode_aper,
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
OCTET_STRING_random_fill,
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_PrintableString = {
|
||||
"PrintableString",
|
||||
"PrintableString",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_PrintableString_tags,
|
||||
sizeof(asn_DEF_PrintableString_tags)
|
||||
/ sizeof(asn_DEF_PrintableString_tags[0]) - 1,
|
||||
asn_DEF_PrintableString_tags,
|
||||
sizeof(asn_DEF_PrintableString_tags)
|
||||
/ sizeof(asn_DEF_PrintableString_tags[0]),
|
||||
{ 0, &asn_DEF_PrintableString_per_constraints, PrintableString_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
PrintableString_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb,
|
||||
void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
|
||||
if(st && st->buf) {
|
||||
uint8_t *buf = st->buf;
|
||||
uint8_t *end = buf + st->size;
|
||||
|
||||
/*
|
||||
* Check the alphabet of the PrintableString.
|
||||
* ASN.1:1984 (X.409)
|
||||
*/
|
||||
for(; buf < end; buf++) {
|
||||
if(!_PrintableString_alphabet[*buf]) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value byte %ld (%d) "
|
||||
"not in PrintableString alphabet "
|
||||
"(%s:%d)",
|
||||
td->name,
|
||||
(long)((buf - st->buf) + 1),
|
||||
*buf,
|
||||
__FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
130
e2sm/lib/RAN-Container.c
Normal file
130
e2sm/lib/RAN-Container.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RAN-Container.h"
|
||||
|
||||
#include "DU-Usage-Report-Per-UE.h"
|
||||
#include "CU-CP-Usage-Report-Per-UE.h"
|
||||
#include "CU-UP-Usage-Report-Per-UE.h"
|
||||
static asn_oer_constraints_t asn_OER_type_reportContainer_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
static asn_per_constraints_t asn_PER_type_reportContainer_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_reportContainer_3[] = {
|
||||
{ ATF_POINTER, 0, offsetof(struct RAN_Container__reportContainer, choice.oDU_UE),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_DU_Usage_Report_Per_UE,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oDU-UE"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct RAN_Container__reportContainer, choice.oCU_CP_UE),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_CU_CP_Usage_Report_Per_UE,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oCU-CP-UE"
|
||||
},
|
||||
{ ATF_POINTER, 0, offsetof(struct RAN_Container__reportContainer, choice.oCU_UP_UE),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_CU_UP_Usage_Report_Per_UE,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"oCU-UP-UE"
|
||||
},
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_reportContainer_tag2el_3[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* oDU-UE */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* oCU-CP-UE */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* oCU-UP-UE */
|
||||
};
|
||||
static asn_CHOICE_specifics_t asn_SPC_reportContainer_specs_3 = {
|
||||
sizeof(struct RAN_Container__reportContainer),
|
||||
offsetof(struct RAN_Container__reportContainer, _asn_ctx),
|
||||
offsetof(struct RAN_Container__reportContainer, present),
|
||||
sizeof(((struct RAN_Container__reportContainer *)0)->present),
|
||||
asn_MAP_reportContainer_tag2el_3,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0,
|
||||
3 /* Extensions start */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_reportContainer_3 = {
|
||||
"reportContainer",
|
||||
"reportContainer",
|
||||
&asn_OP_CHOICE,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ &asn_OER_type_reportContainer_constr_3, &asn_PER_type_reportContainer_constr_3, CHOICE_constraint },
|
||||
asn_MBR_reportContainer_3,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_reportContainer_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_RAN_Container_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RAN_Container, timestamp),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_Timestamp,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"timestamp"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RAN_Container, reportContainer),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_reportContainer_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"reportContainer"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RAN_Container_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_RAN_Container_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* timestamp */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* reportContainer */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_RAN_Container_specs_1 = {
|
||||
sizeof(struct RAN_Container),
|
||||
offsetof(struct RAN_Container, _asn_ctx),
|
||||
asn_MAP_RAN_Container_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RAN_Container = {
|
||||
"RAN-Container",
|
||||
"RAN-Container",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_RAN_Container_tags_1,
|
||||
sizeof(asn_DEF_RAN_Container_tags_1)
|
||||
/sizeof(asn_DEF_RAN_Container_tags_1[0]), /* 1 */
|
||||
asn_DEF_RAN_Container_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RAN_Container_tags_1)
|
||||
/sizeof(asn_DEF_RAN_Container_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_RAN_Container_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_RAN_Container_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
109
e2sm/lib/RANcallProcess-ID-string.c
Normal file
109
e2sm/lib/RANcallProcess-ID-string.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RANcallProcess-ID-string.h"
|
||||
|
||||
static const int permitted_alphabet_table_1[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_1[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_1(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_1;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
RANcallProcess_ID_string_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_1(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 int asn_PER_MAP_RANcallProcess_ID_string_1_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_1[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_RANcallProcess_ID_string_1_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_1[code];
|
||||
}
|
||||
/*
|
||||
* This type is implemented using PrintableString,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_RANcallProcess_ID_string_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
static asn_per_constraints_t asn_PER_type_RANcallProcess_ID_string_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_RANcallProcess_ID_string_1_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_RANcallProcess_ID_string_1_c2v /* PER code to value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RANcallProcess_ID_string_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RANcallProcess_ID_string = {
|
||||
"RANcallProcess-ID-string",
|
||||
"RANcallProcess-ID-string",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_RANcallProcess_ID_string_tags_1,
|
||||
sizeof(asn_DEF_RANcallProcess_ID_string_tags_1)
|
||||
/sizeof(asn_DEF_RANcallProcess_ID_string_tags_1[0]), /* 1 */
|
||||
asn_DEF_RANcallProcess_ID_string_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RANcallProcess_ID_string_tags_1)
|
||||
/sizeof(asn_DEF_RANcallProcess_ID_string_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_RANcallProcess_ID_string_constr_1, &asn_PER_type_RANcallProcess_ID_string_constr_1, RANcallProcess_ID_string_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
316
e2sm/lib/RANfunction-Name.c
Normal file
316
e2sm/lib/RANfunction-Name.c
Normal file
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RANfunction-Name.h"
|
||||
|
||||
static const int permitted_alphabet_table_2[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_2[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_2(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_2;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const int permitted_alphabet_table_3[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_3[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_3(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_3;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const int permitted_alphabet_table_4[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_4[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_4(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_4;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
memb_ranFunction_ShortName_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_2(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 int asn_PER_MAP_ranFunction_ShortName_2_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_2)/sizeof(permitted_alphabet_table_2[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_2[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_ranFunction_ShortName_2_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_2)/sizeof(permitted_alphabet_code2value_2[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_2[code];
|
||||
}
|
||||
static int
|
||||
memb_ranFunction_E2SM_OID_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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_3(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 int asn_PER_MAP_ranFunction_E2SM_OID_3_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_3)/sizeof(permitted_alphabet_table_3[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_3[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_ranFunction_E2SM_OID_3_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_3)/sizeof(permitted_alphabet_code2value_3[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_3[code];
|
||||
}
|
||||
static int
|
||||
memb_ranFunction_Description_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_4(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 int asn_PER_MAP_ranFunction_Description_4_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_4)/sizeof(permitted_alphabet_table_4[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_4[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_ranFunction_Description_4_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_4)/sizeof(permitted_alphabet_code2value_4[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_4[code];
|
||||
}
|
||||
static asn_oer_constraints_t asn_OER_memb_ranFunction_ShortName_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ranFunction_ShortName_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_ranFunction_ShortName_2_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_ranFunction_ShortName_2_c2v /* PER code to value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ranFunction_E2SM_OID_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ranFunction_E2SM_OID_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 10, 10, 1, 1000 } /* (SIZE(1..1000,...)) */,
|
||||
asn_PER_MAP_ranFunction_E2SM_OID_3_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_ranFunction_E2SM_OID_3_c2v /* PER code to value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_ranFunction_Description_constr_4 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_ranFunction_Description_constr_4 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_ranFunction_Description_4_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_ranFunction_Description_4_c2v /* PER code to value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_RANfunction_Name_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RANfunction_Name, ranFunction_ShortName),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PrintableString,
|
||||
0,
|
||||
{ &asn_OER_memb_ranFunction_ShortName_constr_2, &asn_PER_memb_ranFunction_ShortName_constr_2, memb_ranFunction_ShortName_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ranFunction-ShortName"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RANfunction_Name, ranFunction_E2SM_OID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PrintableString,
|
||||
0,
|
||||
{ &asn_OER_memb_ranFunction_E2SM_OID_constr_3, &asn_PER_memb_ranFunction_E2SM_OID_constr_3, memb_ranFunction_E2SM_OID_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ranFunction-E2SM-OID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RANfunction_Name, ranFunction_Description),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PrintableString,
|
||||
0,
|
||||
{ &asn_OER_memb_ranFunction_Description_constr_4, &asn_PER_memb_ranFunction_Description_constr_4, memb_ranFunction_Description_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"ranFunction-Description"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct RANfunction_Name, ranFunction_Instance),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_NativeInteger,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ranFunction-Instance"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_RANfunction_Name_oms_1[] = { 3 };
|
||||
static const ber_tlv_tag_t asn_DEF_RANfunction_Name_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_RANfunction_Name_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ranFunction-ShortName */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ranFunction-E2SM-OID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ranFunction-Description */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ranFunction-Instance */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_RANfunction_Name_specs_1 = {
|
||||
sizeof(struct RANfunction_Name),
|
||||
offsetof(struct RANfunction_Name, _asn_ctx),
|
||||
asn_MAP_RANfunction_Name_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
asn_MAP_RANfunction_Name_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
4, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RANfunction_Name = {
|
||||
"RANfunction-Name",
|
||||
"RANfunction-Name",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_RANfunction_Name_tags_1,
|
||||
sizeof(asn_DEF_RANfunction_Name_tags_1)
|
||||
/sizeof(asn_DEF_RANfunction_Name_tags_1[0]), /* 1 */
|
||||
asn_DEF_RANfunction_Name_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RANfunction_Name_tags_1)
|
||||
/sizeof(asn_DEF_RANfunction_Name_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_RANfunction_Name_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_RANfunction_Name_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
70
e2sm/lib/RIC-EventTriggerStyle-List.c
Normal file
70
e2sm/lib/RIC-EventTriggerStyle-List.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RIC-EventTriggerStyle-List.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_RIC_EventTriggerStyle_List_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_EventTriggerStyle_List, ric_EventTriggerStyle_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-EventTriggerStyle-Type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_EventTriggerStyle_List, ric_EventTriggerStyle_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-EventTriggerStyle-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_EventTriggerStyle_List, ric_EventTriggerFormat_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Format_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-EventTriggerFormat-Type"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RIC_EventTriggerStyle_List_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_RIC_EventTriggerStyle_List_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ric-EventTriggerStyle-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ric-EventTriggerStyle-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ric-EventTriggerFormat-Type */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_RIC_EventTriggerStyle_List_specs_1 = {
|
||||
sizeof(struct RIC_EventTriggerStyle_List),
|
||||
offsetof(struct RIC_EventTriggerStyle_List, _asn_ctx),
|
||||
asn_MAP_RIC_EventTriggerStyle_List_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RIC_EventTriggerStyle_List = {
|
||||
"RIC-EventTriggerStyle-List",
|
||||
"RIC-EventTriggerStyle-List",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_RIC_EventTriggerStyle_List_tags_1,
|
||||
sizeof(asn_DEF_RIC_EventTriggerStyle_List_tags_1)
|
||||
/sizeof(asn_DEF_RIC_EventTriggerStyle_List_tags_1[0]), /* 1 */
|
||||
asn_DEF_RIC_EventTriggerStyle_List_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RIC_EventTriggerStyle_List_tags_1)
|
||||
/sizeof(asn_DEF_RIC_EventTriggerStyle_List_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_RIC_EventTriggerStyle_List_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_RIC_EventTriggerStyle_List_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
31
e2sm/lib/RIC-Format-Type.c
Normal file
31
e2sm/lib/RIC-Format-Type.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RIC-Format-Type.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using NativeInteger,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_RIC_Format_Type_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RIC_Format_Type = {
|
||||
"RIC-Format-Type",
|
||||
"RIC-Format-Type",
|
||||
&asn_OP_NativeInteger,
|
||||
asn_DEF_RIC_Format_Type_tags_1,
|
||||
sizeof(asn_DEF_RIC_Format_Type_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Format_Type_tags_1[0]), /* 1 */
|
||||
asn_DEF_RIC_Format_Type_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RIC_Format_Type_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Format_Type_tags_1[0]), /* 1 */
|
||||
{ 0, 0, NativeInteger_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
80
e2sm/lib/RIC-ReportStyle-List.c
Normal file
80
e2sm/lib/RIC-ReportStyle-List.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RIC-ReportStyle-List.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_RIC_ReportStyle_List_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_ReportStyle_List, ric_ReportStyle_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-ReportStyle-Type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_ReportStyle_List, ric_ReportStyle_Name),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Style_Name,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-ReportStyle-Name"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_ReportStyle_List, ric_IndicationHeaderFormat_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Format_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-IndicationHeaderFormat-Type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct RIC_ReportStyle_List, ric_IndicationMessageFormat_Type),
|
||||
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RIC_Format_Type,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ric-IndicationMessageFormat-Type"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RIC_ReportStyle_List_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_RIC_ReportStyle_List_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ric-ReportStyle-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ric-ReportStyle-Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ric-IndicationHeaderFormat-Type */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* ric-IndicationMessageFormat-Type */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_RIC_ReportStyle_List_specs_1 = {
|
||||
sizeof(struct RIC_ReportStyle_List),
|
||||
offsetof(struct RIC_ReportStyle_List, _asn_ctx),
|
||||
asn_MAP_RIC_ReportStyle_List_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
4, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RIC_ReportStyle_List = {
|
||||
"RIC-ReportStyle-List",
|
||||
"RIC-ReportStyle-List",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_RIC_ReportStyle_List_tags_1,
|
||||
sizeof(asn_DEF_RIC_ReportStyle_List_tags_1)
|
||||
/sizeof(asn_DEF_RIC_ReportStyle_List_tags_1[0]), /* 1 */
|
||||
asn_DEF_RIC_ReportStyle_List_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RIC_ReportStyle_List_tags_1)
|
||||
/sizeof(asn_DEF_RIC_ReportStyle_List_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_RIC_ReportStyle_List_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_RIC_ReportStyle_List_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
109
e2sm/lib/RIC-Style-Name.c
Normal file
109
e2sm/lib/RIC-Style-Name.c
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RIC-Style-Name.h"
|
||||
|
||||
static const int permitted_alphabet_table_1[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_1[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_1(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_1;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
RIC_Style_Name_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_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 <= 150)
|
||||
&& !check_permitted_alphabet_1(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 int asn_PER_MAP_RIC_Style_Name_1_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_1[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_RIC_Style_Name_1_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_1[code];
|
||||
}
|
||||
/*
|
||||
* This type is implemented using PrintableString,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_RIC_Style_Name_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..MAX)) */};
|
||||
asn_per_constraints_t asn_PER_type_RIC_Style_Name_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
|
||||
asn_PER_MAP_RIC_Style_Name_1_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_RIC_Style_Name_1_c2v /* PER code to value map */
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RIC_Style_Name_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RIC_Style_Name = {
|
||||
"RIC-Style-Name",
|
||||
"RIC-Style-Name",
|
||||
&asn_OP_PrintableString,
|
||||
asn_DEF_RIC_Style_Name_tags_1,
|
||||
sizeof(asn_DEF_RIC_Style_Name_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Style_Name_tags_1[0]), /* 1 */
|
||||
asn_DEF_RIC_Style_Name_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RIC_Style_Name_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Style_Name_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_RIC_Style_Name_constr_1, &asn_PER_type_RIC_Style_Name_constr_1, RIC_Style_Name_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
31
e2sm/lib/RIC-Style-Type.c
Normal file
31
e2sm/lib/RIC-Style-Type.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RIC-Style-Type.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using NativeInteger,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_RIC_Style_Type_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RIC_Style_Type = {
|
||||
"RIC-Style-Type",
|
||||
"RIC-Style-Type",
|
||||
&asn_OP_NativeInteger,
|
||||
asn_DEF_RIC_Style_Type_tags_1,
|
||||
sizeof(asn_DEF_RIC_Style_Type_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Style_Type_tags_1[0]), /* 1 */
|
||||
asn_DEF_RIC_Style_Type_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RIC_Style_Type_tags_1)
|
||||
/sizeof(asn_DEF_RIC_Style_Type_tags_1[0]), /* 1 */
|
||||
{ 0, 0, NativeInteger_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
||||
94
e2sm/lib/RT-Period-IE.c
Normal file
94
e2sm/lib/RT-Period-IE.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "RT-Period-IE.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using NativeEnumerated,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_RT_Period_IE_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_RT_Period_IE_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 5, 5, 0, 19 } /* (0..19,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const asn_INTEGER_enum_map_t asn_MAP_RT_Period_IE_value2enum_1[] = {
|
||||
{ 0, 4, "ms10" },
|
||||
{ 1, 4, "ms20" },
|
||||
{ 2, 4, "ms32" },
|
||||
{ 3, 4, "ms40" },
|
||||
{ 4, 4, "ms60" },
|
||||
{ 5, 4, "ms64" },
|
||||
{ 6, 4, "ms70" },
|
||||
{ 7, 4, "ms80" },
|
||||
{ 8, 5, "ms128" },
|
||||
{ 9, 5, "ms160" },
|
||||
{ 10, 5, "ms256" },
|
||||
{ 11, 5, "ms320" },
|
||||
{ 12, 5, "ms512" },
|
||||
{ 13, 5, "ms640" },
|
||||
{ 14, 6, "ms1024" },
|
||||
{ 15, 6, "ms1280" },
|
||||
{ 16, 6, "ms2048" },
|
||||
{ 17, 6, "ms2560" },
|
||||
{ 18, 6, "ms5120" },
|
||||
{ 19, 7, "ms10240" }
|
||||
/* This list is extensible */
|
||||
};
|
||||
static const unsigned int asn_MAP_RT_Period_IE_enum2value_1[] = {
|
||||
0, /* ms10(0) */
|
||||
14, /* ms1024(14) */
|
||||
19, /* ms10240(19) */
|
||||
8, /* ms128(8) */
|
||||
15, /* ms1280(15) */
|
||||
9, /* ms160(9) */
|
||||
1, /* ms20(1) */
|
||||
16, /* ms2048(16) */
|
||||
10, /* ms256(10) */
|
||||
17, /* ms2560(17) */
|
||||
2, /* ms32(2) */
|
||||
11, /* ms320(11) */
|
||||
3, /* ms40(3) */
|
||||
12, /* ms512(12) */
|
||||
18, /* ms5120(18) */
|
||||
4, /* ms60(4) */
|
||||
5, /* ms64(5) */
|
||||
13, /* ms640(13) */
|
||||
6, /* ms70(6) */
|
||||
7 /* ms80(7) */
|
||||
/* This list is extensible */
|
||||
};
|
||||
const asn_INTEGER_specifics_t asn_SPC_RT_Period_IE_specs_1 = {
|
||||
asn_MAP_RT_Period_IE_value2enum_1, /* "tag" => N; sorted by tag */
|
||||
asn_MAP_RT_Period_IE_enum2value_1, /* N => "tag"; sorted by N */
|
||||
20, /* Number of elements in the maps */
|
||||
21, /* Extensions before this member */
|
||||
1, /* Strict enumeration */
|
||||
0, /* Native long size */
|
||||
0
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_RT_Period_IE_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_RT_Period_IE = {
|
||||
"RT-Period-IE",
|
||||
"RT-Period-IE",
|
||||
&asn_OP_NativeEnumerated,
|
||||
asn_DEF_RT_Period_IE_tags_1,
|
||||
sizeof(asn_DEF_RT_Period_IE_tags_1)
|
||||
/sizeof(asn_DEF_RT_Period_IE_tags_1[0]), /* 1 */
|
||||
asn_DEF_RT_Period_IE_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_RT_Period_IE_tags_1)
|
||||
/sizeof(asn_DEF_RT_Period_IE_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_RT_Period_IE_constr_1, &asn_PER_type_RT_Period_IE_constr_1, NativeEnumerated_constraint },
|
||||
0, 0, /* Defined elsewhere */
|
||||
&asn_SPC_RT_Period_IE_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
130
e2sm/lib/SNSSAI.c
Normal file
130
e2sm/lib/SNSSAI.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "SNSSAI.h"
|
||||
|
||||
static int
|
||||
memb_sST_constraint_1(const 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 == 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_sD_constraint_1(const 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 == 3)) {
|
||||
/* 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_oer_constraints_t asn_OER_memb_sST_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
1 /* (SIZE(1..1)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_sST_constr_2 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 1, 1 } /* (SIZE(1..1)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_sD_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
3 /* (SIZE(3..3)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_sD_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 0, 0, 3, 3 } /* (SIZE(3..3)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_SNSSAI_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct SNSSAI, sST),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_sST_constr_2, &asn_PER_memb_sST_constr_2, memb_sST_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"sST"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct SNSSAI, sD),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ &asn_OER_memb_sD_constr_3, &asn_PER_memb_sD_constr_3, memb_sD_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"sD"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_SNSSAI_oms_1[] = { 1 };
|
||||
static const ber_tlv_tag_t asn_DEF_SNSSAI_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_SNSSAI_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sST */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* sD */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_SNSSAI_specs_1 = {
|
||||
sizeof(struct SNSSAI),
|
||||
offsetof(struct SNSSAI, _asn_ctx),
|
||||
asn_MAP_SNSSAI_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
asn_MAP_SNSSAI_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_SNSSAI = {
|
||||
"SNSSAI",
|
||||
"SNSSAI",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_SNSSAI_tags_1,
|
||||
sizeof(asn_DEF_SNSSAI_tags_1)
|
||||
/sizeof(asn_DEF_SNSSAI_tags_1[0]), /* 1 */
|
||||
asn_DEF_SNSSAI_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_SNSSAI_tags_1)
|
||||
/sizeof(asn_DEF_SNSSAI_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_SNSSAI_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_SNSSAI_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
74
e2sm/lib/ServedPlmnPerCellListItem.c
Normal file
74
e2sm/lib/ServedPlmnPerCellListItem.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "ServedPlmnPerCellListItem.h"
|
||||
|
||||
#include "FGC-DU-PM-Container.h"
|
||||
#include "EPC-DU-PM-Container.h"
|
||||
asn_TYPE_member_t asn_MBR_ServedPlmnPerCellListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ServedPlmnPerCellListItem, pLMN_Identity),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PLMN_Identity,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"pLMN-Identity"
|
||||
},
|
||||
{ ATF_POINTER, 2, offsetof(struct ServedPlmnPerCellListItem, du_PM_5GC),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_FGC_DU_PM_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"du-PM-5GC"
|
||||
},
|
||||
{ ATF_POINTER, 1, offsetof(struct ServedPlmnPerCellListItem, du_PM_EPC),
|
||||
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_EPC_DU_PM_Container,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"du-PM-EPC"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_ServedPlmnPerCellListItem_oms_1[] = { 1, 2 };
|
||||
static const ber_tlv_tag_t asn_DEF_ServedPlmnPerCellListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_ServedPlmnPerCellListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMN-Identity */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* du-PM-5GC */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* du-PM-EPC */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_ServedPlmnPerCellListItem_specs_1 = {
|
||||
sizeof(struct ServedPlmnPerCellListItem),
|
||||
offsetof(struct ServedPlmnPerCellListItem, _asn_ctx),
|
||||
asn_MAP_ServedPlmnPerCellListItem_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
asn_MAP_ServedPlmnPerCellListItem_oms_1, /* Optional members */
|
||||
2, 0, /* Root/Additions */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ServedPlmnPerCellListItem = {
|
||||
"ServedPlmnPerCellListItem",
|
||||
"ServedPlmnPerCellListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_ServedPlmnPerCellListItem_tags_1,
|
||||
sizeof(asn_DEF_ServedPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_ServedPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_ServedPlmnPerCellListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_ServedPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_ServedPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_ServedPlmnPerCellListItem_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_ServedPlmnPerCellListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
140
e2sm/lib/SlicePerPlmnPerCellListItem.c
Normal file
140
e2sm/lib/SlicePerPlmnPerCellListItem.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "SlicePerPlmnPerCellListItem.h"
|
||||
|
||||
#include "FQIPERSlicesPerPlmnPerCellListItem.h"
|
||||
static int
|
||||
memb_fQIPERSlicesPerPlmnPerCellList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_fQIPERSlicesPerPlmnPerCellList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..64)) */};
|
||||
static asn_per_constraints_t asn_PER_type_fQIPERSlicesPerPlmnPerCellList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_fQIPERSlicesPerPlmnPerCellList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..64)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_fQIPERSlicesPerPlmnPerCellList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_fQIPERSlicesPerPlmnPerCellList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_FQIPERSlicesPerPlmnPerCellListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_fQIPERSlicesPerPlmnPerCellList_specs_3 = {
|
||||
sizeof(struct SlicePerPlmnPerCellListItem__fQIPERSlicesPerPlmnPerCellList),
|
||||
offsetof(struct SlicePerPlmnPerCellListItem__fQIPERSlicesPerPlmnPerCellList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_fQIPERSlicesPerPlmnPerCellList_3 = {
|
||||
"fQIPERSlicesPerPlmnPerCellList",
|
||||
"fQIPERSlicesPerPlmnPerCellList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3,
|
||||
sizeof(asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3)
|
||||
/sizeof(asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3)
|
||||
/sizeof(asn_DEF_fQIPERSlicesPerPlmnPerCellList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_fQIPERSlicesPerPlmnPerCellList_constr_3, &asn_PER_type_fQIPERSlicesPerPlmnPerCellList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_fQIPERSlicesPerPlmnPerCellList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_fQIPERSlicesPerPlmnPerCellList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_SlicePerPlmnPerCellListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct SlicePerPlmnPerCellListItem, sliceID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_SNSSAI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"sliceID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct SlicePerPlmnPerCellListItem, fQIPERSlicesPerPlmnPerCellList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_fQIPERSlicesPerPlmnPerCellList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_fQIPERSlicesPerPlmnPerCellList_constr_3, &asn_PER_memb_fQIPERSlicesPerPlmnPerCellList_constr_3, memb_fQIPERSlicesPerPlmnPerCellList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"fQIPERSlicesPerPlmnPerCellList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_SlicePerPlmnPerCellListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_SlicePerPlmnPerCellListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sliceID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* fQIPERSlicesPerPlmnPerCellList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_SlicePerPlmnPerCellListItem_specs_1 = {
|
||||
sizeof(struct SlicePerPlmnPerCellListItem),
|
||||
offsetof(struct SlicePerPlmnPerCellListItem, _asn_ctx),
|
||||
asn_MAP_SlicePerPlmnPerCellListItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_SlicePerPlmnPerCellListItem = {
|
||||
"SlicePerPlmnPerCellListItem",
|
||||
"SlicePerPlmnPerCellListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_SlicePerPlmnPerCellListItem_tags_1,
|
||||
sizeof(asn_DEF_SlicePerPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_SlicePerPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_SlicePerPlmnPerCellListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_SlicePerPlmnPerCellListItem_tags_1)
|
||||
/sizeof(asn_DEF_SlicePerPlmnPerCellListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_SlicePerPlmnPerCellListItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_SlicePerPlmnPerCellListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
140
e2sm/lib/SliceToReportListItem.c
Normal file
140
e2sm/lib/SliceToReportListItem.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "SliceToReportListItem.h"
|
||||
|
||||
#include "FQIPERSlicesPerPlmnListItem.h"
|
||||
static int
|
||||
memb_fQIPERSlicesPerPlmnList_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Determine the number of elements */
|
||||
size = _A_CSEQUENCE_FROM_VOID(sptr)->count;
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Perform validation of the inner elements */
|
||||
return td->encoding_constraints.general_constraints(td, sptr, ctfailcb, app_key);
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_fQIPERSlicesPerPlmnList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..64)) */};
|
||||
static asn_per_constraints_t asn_PER_type_fQIPERSlicesPerPlmnList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_fQIPERSlicesPerPlmnList_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(1..64)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_fQIPERSlicesPerPlmnList_constr_3 CC_NOTUSED = {
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
{ APC_CONSTRAINED, 6, 6, 1, 64 } /* (SIZE(1..64)) */,
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static asn_TYPE_member_t asn_MBR_fQIPERSlicesPerPlmnList_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_FQIPERSlicesPerPlmnListItem,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_fQIPERSlicesPerPlmnList_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_fQIPERSlicesPerPlmnList_specs_3 = {
|
||||
sizeof(struct SliceToReportListItem__fQIPERSlicesPerPlmnList),
|
||||
offsetof(struct SliceToReportListItem__fQIPERSlicesPerPlmnList, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_fQIPERSlicesPerPlmnList_3 = {
|
||||
"fQIPERSlicesPerPlmnList",
|
||||
"fQIPERSlicesPerPlmnList",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_fQIPERSlicesPerPlmnList_tags_3,
|
||||
sizeof(asn_DEF_fQIPERSlicesPerPlmnList_tags_3)
|
||||
/sizeof(asn_DEF_fQIPERSlicesPerPlmnList_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_fQIPERSlicesPerPlmnList_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_fQIPERSlicesPerPlmnList_tags_3)
|
||||
/sizeof(asn_DEF_fQIPERSlicesPerPlmnList_tags_3[0]), /* 2 */
|
||||
{ &asn_OER_type_fQIPERSlicesPerPlmnList_constr_3, &asn_PER_type_fQIPERSlicesPerPlmnList_constr_3, SEQUENCE_OF_constraint },
|
||||
asn_MBR_fQIPERSlicesPerPlmnList_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_fQIPERSlicesPerPlmnList_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_SliceToReportListItem_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct SliceToReportListItem, sliceID),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_SNSSAI,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"sliceID"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct SliceToReportListItem, fQIPERSlicesPerPlmnList),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_fQIPERSlicesPerPlmnList_3,
|
||||
0,
|
||||
{ &asn_OER_memb_fQIPERSlicesPerPlmnList_constr_3, &asn_PER_memb_fQIPERSlicesPerPlmnList_constr_3, memb_fQIPERSlicesPerPlmnList_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"fQIPERSlicesPerPlmnList"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_SliceToReportListItem_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_SliceToReportListItem_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sliceID */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* fQIPERSlicesPerPlmnList */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_SliceToReportListItem_specs_1 = {
|
||||
sizeof(struct SliceToReportListItem),
|
||||
offsetof(struct SliceToReportListItem, _asn_ctx),
|
||||
asn_MAP_SliceToReportListItem_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_SliceToReportListItem = {
|
||||
"SliceToReportListItem",
|
||||
"SliceToReportListItem",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_SliceToReportListItem_tags_1,
|
||||
sizeof(asn_DEF_SliceToReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_SliceToReportListItem_tags_1[0]), /* 1 */
|
||||
asn_DEF_SliceToReportListItem_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_SliceToReportListItem_tags_1)
|
||||
/sizeof(asn_DEF_SliceToReportListItem_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_SliceToReportListItem_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_SliceToReportListItem_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
31
e2sm/lib/Timestamp.c
Normal file
31
e2sm/lib/Timestamp.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "Timestamp.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using OCTET_STRING,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_Timestamp_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_Timestamp = {
|
||||
"Timestamp",
|
||||
"Timestamp",
|
||||
&asn_OP_OCTET_STRING,
|
||||
asn_DEF_Timestamp_tags_1,
|
||||
sizeof(asn_DEF_Timestamp_tags_1)
|
||||
/sizeof(asn_DEF_Timestamp_tags_1[0]), /* 1 */
|
||||
asn_DEF_Timestamp_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_Timestamp_tags_1)
|
||||
/sizeof(asn_DEF_Timestamp_tags_1[0]), /* 1 */
|
||||
{ 0, 0, OCTET_STRING_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_OCTET_STRING_specs /* Additional specs */
|
||||
};
|
||||
|
||||
50
e2sm/lib/Trigger-ConditionIE-Item.c
Normal file
50
e2sm/lib/Trigger-ConditionIE-Item.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "Trigger-ConditionIE-Item.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_Trigger_ConditionIE_Item_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct Trigger_ConditionIE_Item, report_Period_IE),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_RT_Period_IE,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"report-Period-IE"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_Trigger_ConditionIE_Item_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_Trigger_ConditionIE_Item_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* report-Period-IE */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_Trigger_ConditionIE_Item_specs_1 = {
|
||||
sizeof(struct Trigger_ConditionIE_Item),
|
||||
offsetof(struct Trigger_ConditionIE_Item, _asn_ctx),
|
||||
asn_MAP_Trigger_ConditionIE_Item_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_Trigger_ConditionIE_Item = {
|
||||
"Trigger-ConditionIE-Item",
|
||||
"Trigger-ConditionIE-Item",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_Trigger_ConditionIE_Item_tags_1,
|
||||
sizeof(asn_DEF_Trigger_ConditionIE_Item_tags_1)
|
||||
/sizeof(asn_DEF_Trigger_ConditionIE_Item_tags_1[0]), /* 1 */
|
||||
asn_DEF_Trigger_ConditionIE_Item_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_Trigger_ConditionIE_Item_tags_1)
|
||||
/sizeof(asn_DEF_Trigger_ConditionIE_Item_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_Trigger_ConditionIE_Item_1,
|
||||
1, /* Elements count */
|
||||
&asn_SPC_Trigger_ConditionIE_Item_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
60
e2sm/lib/UE-Report-Type.c
Normal file
60
e2sm/lib/UE-Report-Type.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "E2SM-KPM-IEs"
|
||||
* found in "e2sm-kpm-v01.02.asn"
|
||||
* `asn1c -pdu=auto -fno-include-deps -fcompound-names -findirect-choice -gen-PER -gen-OER -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "UE-Report-Type.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using NativeEnumerated,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static asn_oer_constraints_t asn_OER_type_UE_Report_Type_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_UE_Report_Type_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
static const asn_INTEGER_enum_map_t asn_MAP_UE_Report_Type_value2enum_1[] = {
|
||||
{ 0, 17, "oDU-Report-Per-UE" },
|
||||
{ 1, 20, "oCU-CP-Report-Per-UE" },
|
||||
{ 2, 20, "oCU-UP-Report-Per-UE" }
|
||||
/* This list is extensible */
|
||||
};
|
||||
static const unsigned int asn_MAP_UE_Report_Type_enum2value_1[] = {
|
||||
1, /* oCU-CP-Report-Per-UE(1) */
|
||||
2, /* oCU-UP-Report-Per-UE(2) */
|
||||
0 /* oDU-Report-Per-UE(0) */
|
||||
/* This list is extensible */
|
||||
};
|
||||
const asn_INTEGER_specifics_t asn_SPC_UE_Report_Type_specs_1 = {
|
||||
asn_MAP_UE_Report_Type_value2enum_1, /* "tag" => N; sorted by tag */
|
||||
asn_MAP_UE_Report_Type_enum2value_1, /* N => "tag"; sorted by N */
|
||||
3, /* Number of elements in the maps */
|
||||
4, /* Extensions before this member */
|
||||
1, /* Strict enumeration */
|
||||
0, /* Native long size */
|
||||
0
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_UE_Report_Type_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_UE_Report_Type = {
|
||||
"UE-Report-Type",
|
||||
"UE-Report-Type",
|
||||
&asn_OP_NativeEnumerated,
|
||||
asn_DEF_UE_Report_Type_tags_1,
|
||||
sizeof(asn_DEF_UE_Report_Type_tags_1)
|
||||
/sizeof(asn_DEF_UE_Report_Type_tags_1[0]), /* 1 */
|
||||
asn_DEF_UE_Report_Type_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_UE_Report_Type_tags_1)
|
||||
/sizeof(asn_DEF_UE_Report_Type_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_UE_Report_Type_constr_1, &asn_PER_type_UE_Report_Type_constr_1, NativeEnumerated_constraint },
|
||||
0, 0, /* Defined elsewhere */
|
||||
&asn_SPC_UE_Report_Type_specs_1 /* Additional specs */
|
||||
};
|
||||
|
||||
41
e2sm/lib/asn_SEQUENCE_OF.c
Normal file
41
e2sm/lib/asn_SEQUENCE_OF.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_SEQUENCE_OF.h>
|
||||
|
||||
typedef A_SEQUENCE_OF(void) asn_sequence;
|
||||
|
||||
void
|
||||
asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) {
|
||||
asn_sequence *as = (asn_sequence *)asn_sequence_of_x;
|
||||
|
||||
if(as) {
|
||||
void *ptr;
|
||||
int n;
|
||||
|
||||
if(number < 0 || number >= as->count)
|
||||
return; /* Nothing to delete */
|
||||
|
||||
if(_do_free && as->free) {
|
||||
ptr = as->array[number];
|
||||
} else {
|
||||
ptr = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shift all elements to the left to hide the gap.
|
||||
*/
|
||||
--as->count;
|
||||
for(n = number; n < as->count; n++)
|
||||
as->array[n] = as->array[n+1];
|
||||
|
||||
/*
|
||||
* Invoke the third-party function only when the state
|
||||
* of the parent structure is consistent.
|
||||
*/
|
||||
if(ptr) as->free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
88
e2sm/lib/asn_SET_OF.c
Normal file
88
e2sm/lib/asn_SET_OF.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_SET_OF.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* Add another element into the set.
|
||||
*/
|
||||
int
|
||||
asn_set_add(void *asn_set_of_x, void *ptr) {
|
||||
asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x);
|
||||
|
||||
if(as == 0 || ptr == 0) {
|
||||
errno = EINVAL; /* Invalid arguments */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure there's enough space to insert an element.
|
||||
*/
|
||||
if(as->count == as->size) {
|
||||
int _newsize = as->size ? (as->size << 1) : 4;
|
||||
void *_new_arr;
|
||||
_new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0]));
|
||||
if(_new_arr) {
|
||||
as->array = (void **)_new_arr;
|
||||
as->size = _newsize;
|
||||
} else {
|
||||
/* ENOMEM */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
as->array[as->count++] = ptr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
asn_set_del(void *asn_set_of_x, int number, int _do_free) {
|
||||
asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x);
|
||||
|
||||
if(as) {
|
||||
void *ptr;
|
||||
if(number < 0 || number >= as->count)
|
||||
return;
|
||||
|
||||
if(_do_free && as->free) {
|
||||
ptr = as->array[number];
|
||||
} else {
|
||||
ptr = 0;
|
||||
}
|
||||
|
||||
as->array[number] = as->array[--as->count];
|
||||
|
||||
/*
|
||||
* Invoke the third-party function only when the state
|
||||
* of the parent structure is consistent.
|
||||
*/
|
||||
if(ptr) as->free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the contents of the set, do not free the set itself.
|
||||
*/
|
||||
void
|
||||
asn_set_empty(void *asn_set_of_x) {
|
||||
asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x);
|
||||
|
||||
if(as) {
|
||||
if(as->array) {
|
||||
if(as->free) {
|
||||
while(as->count--)
|
||||
as->free(as->array[as->count]);
|
||||
}
|
||||
FREEMEM(as->array);
|
||||
as->array = 0;
|
||||
}
|
||||
as->count = 0;
|
||||
as->size = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
481
e2sm/lib/asn_application.c
Normal file
481
e2sm/lib/asn_application.c
Normal file
@@ -0,0 +1,481 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_application.h>
|
||||
#include <errno.h>
|
||||
|
||||
static asn_enc_rval_t asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const void *sptr,
|
||||
asn_app_consume_bytes_f *callback,
|
||||
void *callback_key);
|
||||
|
||||
|
||||
struct callback_count_bytes_key {
|
||||
asn_app_consume_bytes_f *callback;
|
||||
void *callback_key;
|
||||
size_t computed_size;
|
||||
};
|
||||
|
||||
/*
|
||||
* Encoder which just counts bytes that come through it.
|
||||
*/
|
||||
static int
|
||||
callback_count_bytes_cb(const void *data, size_t size, void *keyp) {
|
||||
struct callback_count_bytes_key *key = keyp;
|
||||
int ret;
|
||||
|
||||
ret = key->callback(data, size, key->callback_key);
|
||||
if(ret >= 0) {
|
||||
key->computed_size += size;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct overrun_encoder_key {
|
||||
void *buffer;
|
||||
size_t buffer_size;
|
||||
size_t computed_size;
|
||||
};
|
||||
|
||||
struct dynamic_encoder_key {
|
||||
void *buffer;
|
||||
size_t buffer_size;
|
||||
size_t computed_size;
|
||||
};
|
||||
|
||||
struct callback_failure_catch_key {
|
||||
asn_app_consume_bytes_f *callback;
|
||||
void *callback_key;
|
||||
int callback_failed;
|
||||
};
|
||||
|
||||
/*
|
||||
* Encoder which doesn't stop counting bytes
|
||||
* even if it reaches the end of the buffer.
|
||||
*/
|
||||
static int
|
||||
overrun_encoder_cb(const void *data, size_t size, void *keyp) {
|
||||
struct overrun_encoder_key *key = keyp;
|
||||
|
||||
if(key->computed_size + size > key->buffer_size) {
|
||||
/*
|
||||
* Avoid accident on the next call:
|
||||
* stop adding bytes to the buffer.
|
||||
*/
|
||||
key->buffer_size = 0;
|
||||
} else {
|
||||
memcpy((char *)key->buffer + key->computed_size, data, size);
|
||||
}
|
||||
key->computed_size += size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encoder which dynamically allocates output, and continues
|
||||
* to count even if allocation failed.
|
||||
*/
|
||||
static int
|
||||
dynamic_encoder_cb(const void *data, size_t size, void *keyp) {
|
||||
struct dynamic_encoder_key *key = keyp;
|
||||
|
||||
if(key->buffer) {
|
||||
if(key->computed_size + size >= key->buffer_size) {
|
||||
void *p;
|
||||
size_t new_size = key->buffer_size;
|
||||
|
||||
do {
|
||||
new_size *= 2;
|
||||
} while(new_size <= key->computed_size + size);
|
||||
|
||||
p = REALLOC(key->buffer, new_size);
|
||||
if(p) {
|
||||
key->buffer = p;
|
||||
key->buffer_size = new_size;
|
||||
} else {
|
||||
FREEMEM(key->buffer);
|
||||
key->buffer = 0;
|
||||
key->buffer_size = 0;
|
||||
key->computed_size += size;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
memcpy((char *)key->buffer + key->computed_size, data, size);
|
||||
}
|
||||
|
||||
key->computed_size += size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encoder which help convert the application level encoder failure into EIO.
|
||||
*/
|
||||
static int
|
||||
callback_failure_catch_cb(const void *data, size_t size, void *keyp) {
|
||||
struct callback_failure_catch_key *key = keyp;
|
||||
int ret;
|
||||
|
||||
ret = key->callback(data, size, key->callback_key);
|
||||
if(ret < 0) {
|
||||
key->callback_failed = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
asn_encode(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td,
|
||||
const void *sptr, asn_app_consume_bytes_f *callback, void *callback_key) {
|
||||
struct callback_failure_catch_key cb_key;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
|
||||
if(!callback) {
|
||||
errno = EINVAL;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
cb_key.callback = callback;
|
||||
cb_key.callback_key = callback_key;
|
||||
cb_key.callback_failed = 0;
|
||||
|
||||
er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
|
||||
callback_failure_catch_cb, &cb_key);
|
||||
if(cb_key.callback_failed) {
|
||||
assert(er.encoded == -1);
|
||||
assert(errno == EBADF);
|
||||
errno = EIO;
|
||||
}
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
asn_encode_to_buffer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax,
|
||||
const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
void *buffer, size_t buffer_size) {
|
||||
struct overrun_encoder_key buf_key;
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
|
||||
if(buffer_size > 0 && !buffer) {
|
||||
errno = EINVAL;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
buf_key.buffer = buffer;
|
||||
buf_key.buffer_size = buffer_size;
|
||||
buf_key.computed_size = 0;
|
||||
|
||||
er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
|
||||
overrun_encoder_cb, &buf_key);
|
||||
|
||||
if(er.encoded >= 0 && (size_t)er.encoded != buf_key.computed_size) {
|
||||
ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE
|
||||
" yet produced %" ASN_PRI_SIZE " bytes",
|
||||
er.encoded, buf_key.computed_size);
|
||||
assert(er.encoded < 0 || (size_t)er.encoded == buf_key.computed_size);
|
||||
}
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
asn_encode_to_new_buffer_result_t
|
||||
asn_encode_to_new_buffer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax,
|
||||
const asn_TYPE_descriptor_t *td, const void *sptr) {
|
||||
struct dynamic_encoder_key buf_key;
|
||||
asn_encode_to_new_buffer_result_t res;
|
||||
|
||||
buf_key.buffer_size = 16;
|
||||
buf_key.buffer = MALLOC(buf_key.buffer_size);
|
||||
buf_key.computed_size = 0;
|
||||
|
||||
res.result = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
|
||||
dynamic_encoder_cb, &buf_key);
|
||||
|
||||
if(res.result.encoded >= 0
|
||||
&& (size_t)res.result.encoded != buf_key.computed_size) {
|
||||
ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE
|
||||
" yet produced %" ASN_PRI_SIZE " bytes",
|
||||
res.result.encoded, buf_key.computed_size);
|
||||
assert(res.result.encoded < 0
|
||||
|| (size_t)res.result.encoded == buf_key.computed_size);
|
||||
}
|
||||
|
||||
res.buffer = buf_key.buffer;
|
||||
|
||||
/* 0-terminate just in case. */
|
||||
if(res.buffer) {
|
||||
assert(buf_key.computed_size < buf_key.buffer_size);
|
||||
((char *)res.buffer)[buf_key.computed_size] = '\0';
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static asn_enc_rval_t
|
||||
asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax,
|
||||
const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_consume_bytes_f *callback, void *callback_key) {
|
||||
asn_enc_rval_t er = {0,0,0};
|
||||
enum xer_encoder_flags_e xer_flags = XER_F_CANONICAL;
|
||||
|
||||
(void)opt_codec_ctx; /* Parameters are not checked on encode yet. */
|
||||
|
||||
if(!td || !sptr) {
|
||||
errno = EINVAL;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
switch(syntax) {
|
||||
case ATS_NONSTANDARD_PLAINTEXT:
|
||||
if(td->op->print_struct) {
|
||||
struct callback_count_bytes_key cb_key;
|
||||
cb_key.callback = callback;
|
||||
cb_key.callback_key = callback_key;
|
||||
cb_key.computed_size = 0;
|
||||
if(td->op->print_struct(td, sptr, 1, callback_count_bytes_cb,
|
||||
&cb_key)
|
||||
< 0
|
||||
|| callback_count_bytes_cb("\n", 1, &cb_key) < 0) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
er.encoded = -1;
|
||||
er.failed_type = td;
|
||||
er.structure_ptr = sptr;
|
||||
} else {
|
||||
er.encoded = cb_key.computed_size;
|
||||
er.failed_type = 0;
|
||||
er.structure_ptr = 0;
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
|
||||
case ATS_RANDOM:
|
||||
errno = ENOENT; /* Randomization doesn't make sense on output. */
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
case ATS_BER:
|
||||
/* BER is a superset of DER. */
|
||||
/* Fall through. */
|
||||
case ATS_DER:
|
||||
if(td->op->der_encoder) {
|
||||
er = der_encode(td, sptr, callback, callback_key);
|
||||
if(er.encoded == -1) {
|
||||
if(er.failed_type && er.failed_type->op->der_encoder) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
} else {
|
||||
errno = ENOENT; /* DER is not defined for this type. */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
case ATS_CER:
|
||||
errno = ENOENT; /* Transfer syntax is not defined for any type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
case ATS_BASIC_OER:
|
||||
case ATS_CANONICAL_OER:
|
||||
errno = ENOENT; /* PER is not defined. */
|
||||
ASN__ENCODE_FAILED;
|
||||
break;
|
||||
#else /* ASN_DISABLE_OER_SUPPORT */
|
||||
case ATS_BASIC_OER:
|
||||
/* CANONICAL-OER is a superset of BASIC-OER. */
|
||||
/* Fall through. */
|
||||
case ATS_CANONICAL_OER:
|
||||
if(td->op->oer_encoder) {
|
||||
er = oer_encode(td, sptr, callback, callback_key);
|
||||
if(er.encoded == -1) {
|
||||
if(er.failed_type && er.failed_type->op->oer_encoder) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
} else {
|
||||
errno = ENOENT; /* OER is not defined for this type. */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
case ATS_UNALIGNED_BASIC_PER:
|
||||
case ATS_UNALIGNED_CANONICAL_PER:
|
||||
case ATS_ALIGNED_BASIC_PER:
|
||||
case ATS_ALIGNED_CANONICAL_PER:
|
||||
errno = ENOENT; /* PER is not defined. */
|
||||
ASN__ENCODE_FAILED;
|
||||
break;
|
||||
#else /* ASN_DISABLE_PER_SUPPORT */
|
||||
case ATS_UNALIGNED_BASIC_PER:
|
||||
/* CANONICAL-UPER is a superset of BASIC-UPER. */
|
||||
/* Fall through. */
|
||||
case ATS_UNALIGNED_CANONICAL_PER:
|
||||
if(td->op->uper_encoder) {
|
||||
er = uper_encode(td, 0, sptr, callback, callback_key);
|
||||
if(er.encoded == -1) {
|
||||
if(er.failed_type && er.failed_type->op->uper_encoder) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
} else {
|
||||
errno = ENOENT; /* UPER is not defined for this type. */
|
||||
}
|
||||
} else {
|
||||
ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded);
|
||||
if(er.encoded == 0) {
|
||||
/* Enforce "Complete Encoding" of X.691 #11.1 */
|
||||
if(callback("\0", 1, callback_key) < 0) {
|
||||
errno = EBADF;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
er.encoded = 8; /* Exactly 8 zero bits is added. */
|
||||
}
|
||||
/* Convert bits into bytes */
|
||||
er.encoded = (er.encoded + 7) >> 3;
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
case ATS_ALIGNED_BASIC_PER:
|
||||
/* CANONICAL-APER is a superset of BASIC-APER. */
|
||||
/* Fall through. */
|
||||
case ATS_ALIGNED_CANONICAL_PER:
|
||||
if(td->op->aper_encoder) {
|
||||
er = aper_encode(td, 0, sptr, callback, callback_key);
|
||||
if(er.encoded == -1) {
|
||||
if(er.failed_type && er.failed_type->op->aper_encoder) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
} else {
|
||||
errno = ENOENT; /* APER is not defined for this type. */
|
||||
}
|
||||
} else {
|
||||
ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded);
|
||||
if(er.encoded == 0) {
|
||||
/* Enforce "Complete Encoding" of X.691 #11.1 */
|
||||
if(callback("\0", 1, callback_key) < 0) {
|
||||
errno = EBADF;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
er.encoded = 8; /* Exactly 8 zero bits is added. */
|
||||
}
|
||||
/* Convert bits into bytes */
|
||||
er.encoded = (er.encoded + 7) >> 3;
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
|
||||
case ATS_BASIC_XER:
|
||||
/* CANONICAL-XER is a superset of BASIC-XER. */
|
||||
xer_flags &= ~XER_F_CANONICAL;
|
||||
xer_flags |= XER_F_BASIC;
|
||||
/* Fall through. */
|
||||
case ATS_CANONICAL_XER:
|
||||
if(td->op->xer_encoder) {
|
||||
er = xer_encode(td, sptr, xer_flags, callback, callback_key);
|
||||
if(er.encoded == -1) {
|
||||
if(er.failed_type && er.failed_type->op->xer_encoder) {
|
||||
errno = EBADF; /* Structure has incorrect form. */
|
||||
} else {
|
||||
errno = ENOENT; /* XER is not defined for this type. */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errno = ENOENT; /* Transfer syntax is not defined for this type. */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = ENOENT;
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
asn_decode(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td,
|
||||
void **sptr, const void *buffer, size_t size) {
|
||||
if(!td || !td->op || !sptr || (size && !buffer)) {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
switch(syntax) {
|
||||
case ATS_CER:
|
||||
case ATS_NONSTANDARD_PLAINTEXT:
|
||||
default:
|
||||
errno = ENOENT;
|
||||
ASN__DECODE_FAILED;
|
||||
|
||||
case ATS_RANDOM:
|
||||
if(!td->op->random_fill) {
|
||||
ASN__DECODE_FAILED;
|
||||
} else {
|
||||
if(asn_random_fill(td, sptr, 16000) == 0) {
|
||||
asn_dec_rval_t ret = {RC_OK, 0};
|
||||
return ret;
|
||||
} else {
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ATS_DER:
|
||||
case ATS_BER:
|
||||
return ber_decode(opt_codec_ctx, td, sptr, buffer, size);
|
||||
|
||||
case ATS_BASIC_OER:
|
||||
case ATS_CANONICAL_OER:
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
errno = ENOENT;
|
||||
ASN__DECODE_FAILED;
|
||||
#else
|
||||
return oer_decode(opt_codec_ctx, td, sptr, buffer, size);
|
||||
#endif
|
||||
|
||||
case ATS_UNALIGNED_BASIC_PER:
|
||||
case ATS_UNALIGNED_CANONICAL_PER:
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
errno = ENOENT;
|
||||
ASN__DECODE_FAILED;
|
||||
#else
|
||||
return uper_decode_complete(opt_codec_ctx, td, sptr, buffer, size);
|
||||
#endif
|
||||
|
||||
case ATS_ALIGNED_BASIC_PER:
|
||||
case ATS_ALIGNED_CANONICAL_PER:
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
errno = ENOENT;
|
||||
ASN__DECODE_FAILED;
|
||||
#else
|
||||
return aper_decode_complete(opt_codec_ctx, td, sptr, buffer, size);
|
||||
#endif
|
||||
|
||||
case ATS_BASIC_XER:
|
||||
case ATS_CANONICAL_XER:
|
||||
return xer_decode(opt_codec_ctx, td, sptr, buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
333
e2sm/lib/asn_bit_data.c
Normal file
333
e2sm/lib/asn_bit_data.c
Normal file
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_system.h>
|
||||
#include <asn_internal.h>
|
||||
#include <asn_bit_data.h>
|
||||
|
||||
/*
|
||||
* Create a contiguous non-refillable bit data structure.
|
||||
* Can be freed by FREEMEM().
|
||||
*/
|
||||
asn_bit_data_t *
|
||||
asn_bit_data_new_contiguous(const void *data, size_t size_bits) {
|
||||
size_t size_bytes = (size_bits + 7) / 8;
|
||||
asn_bit_data_t *pd;
|
||||
uint8_t *bytes;
|
||||
|
||||
/* Get the extensions map */
|
||||
pd = CALLOC(1, sizeof(*pd) + size_bytes + 1);
|
||||
if(!pd) {
|
||||
return NULL;
|
||||
}
|
||||
bytes = (void *)(((char *)pd) + sizeof(*pd));
|
||||
memcpy(bytes, data, size_bytes);
|
||||
bytes[size_bytes] = 0;
|
||||
pd->buffer = bytes;
|
||||
pd->nboff = 0;
|
||||
pd->nbits = size_bits;
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
asn_bit_data_string(asn_bit_data_t *pd) {
|
||||
static char buf[2][32];
|
||||
static int n;
|
||||
n = (n+1) % 2;
|
||||
snprintf(buf[n], sizeof(buf[n]),
|
||||
"{m=%" ASN_PRI_SIZE " span %" ASN_PRI_SIZE "[%" ASN_PRI_SIZE
|
||||
"..%" ASN_PRI_SIZE "] (%" ASN_PRI_SIZE ")}",
|
||||
pd->moved, ((uintptr_t)(pd->buffer) & 0xf), pd->nboff, pd->nbits,
|
||||
pd->nbits - pd->nboff);
|
||||
return buf[n];
|
||||
}
|
||||
|
||||
void
|
||||
asn_get_undo(asn_bit_data_t *pd, int nbits) {
|
||||
if((ssize_t)pd->nboff < nbits) {
|
||||
assert((ssize_t)pd->nboff < nbits);
|
||||
} else {
|
||||
pd->nboff -= nbits;
|
||||
pd->moved -= nbits;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract a small number of bits (<= 31) from the specified PER data pointer.
|
||||
*/
|
||||
int32_t
|
||||
asn_get_few_bits(asn_bit_data_t *pd, int nbits) {
|
||||
size_t off; /* Next after last bit offset */
|
||||
ssize_t nleft; /* Number of bits left in this stream */
|
||||
uint32_t accum;
|
||||
const uint8_t *buf;
|
||||
|
||||
if(nbits < 0)
|
||||
return -1;
|
||||
|
||||
nleft = pd->nbits - pd->nboff;
|
||||
if(nbits > nleft) {
|
||||
int32_t tailv, vhead;
|
||||
if(!pd->refill || nbits > 31) return -1;
|
||||
/* Accumulate unused bytes before refill */
|
||||
ASN_DEBUG("Obtain the rest %d bits (want %d)",
|
||||
(int)nleft, (int)nbits);
|
||||
tailv = asn_get_few_bits(pd, nleft);
|
||||
if(tailv < 0) return -1;
|
||||
/* Refill (replace pd contents with new data) */
|
||||
if(pd->refill(pd))
|
||||
return -1;
|
||||
nbits -= nleft;
|
||||
vhead = asn_get_few_bits(pd, nbits);
|
||||
/* Combine the rest of previous pd with the head of new one */
|
||||
tailv = (tailv << nbits) | vhead; /* Could == -1 */
|
||||
return tailv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normalize position indicator.
|
||||
*/
|
||||
if(pd->nboff >= 8) {
|
||||
pd->buffer += (pd->nboff >> 3);
|
||||
pd->nbits -= (pd->nboff & ~0x07);
|
||||
pd->nboff &= 0x07;
|
||||
}
|
||||
pd->moved += nbits;
|
||||
pd->nboff += nbits;
|
||||
off = pd->nboff;
|
||||
buf = pd->buffer;
|
||||
|
||||
/*
|
||||
* Extract specified number of bits.
|
||||
*/
|
||||
if(off <= 8)
|
||||
accum = nbits ? (buf[0]) >> (8 - off) : 0;
|
||||
else if(off <= 16)
|
||||
accum = ((buf[0] << 8) + buf[1]) >> (16 - off);
|
||||
else if(off <= 24)
|
||||
accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off);
|
||||
else if(off <= 31)
|
||||
accum = (((uint32_t)buf[0] << 24) + (buf[1] << 16)
|
||||
+ (buf[2] << 8) + (buf[3])) >> (32 - off);
|
||||
else if(nbits <= 31) {
|
||||
asn_bit_data_t tpd = *pd;
|
||||
/* Here are we with our 31-bits limit plus 1..7 bits offset. */
|
||||
asn_get_undo(&tpd, nbits);
|
||||
/* The number of available bits in the stream allow
|
||||
* for the following operations to take place without
|
||||
* invoking the ->refill() function */
|
||||
accum = asn_get_few_bits(&tpd, nbits - 24) << 24;
|
||||
accum |= asn_get_few_bits(&tpd, 24);
|
||||
} else {
|
||||
asn_get_undo(pd, nbits);
|
||||
return -1;
|
||||
}
|
||||
|
||||
accum &= (((uint32_t)1 << nbits) - 1);
|
||||
|
||||
ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]",
|
||||
(int)nbits, (int)nleft,
|
||||
(int)pd->moved,
|
||||
(((long)pd->buffer) & 0xf),
|
||||
(int)pd->nboff, (int)pd->nbits,
|
||||
((pd->buffer != NULL)?pd->buffer[0]:0),
|
||||
(int)(pd->nbits - pd->nboff),
|
||||
(int)accum);
|
||||
|
||||
return accum;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract a large number of bits from the specified PER data pointer.
|
||||
*/
|
||||
int
|
||||
asn_get_many_bits(asn_bit_data_t *pd, uint8_t *dst, int alright, int nbits) {
|
||||
int32_t value;
|
||||
|
||||
if(alright && (nbits & 7)) {
|
||||
/* Perform right alignment of a first few bits */
|
||||
value = asn_get_few_bits(pd, nbits & 0x07);
|
||||
if(value < 0) return -1;
|
||||
*dst++ = value; /* value is already right-aligned */
|
||||
nbits &= ~7;
|
||||
}
|
||||
|
||||
while(nbits) {
|
||||
if(nbits >= 24) {
|
||||
value = asn_get_few_bits(pd, 24);
|
||||
if(value < 0) return -1;
|
||||
*(dst++) = value >> 16;
|
||||
*(dst++) = value >> 8;
|
||||
*(dst++) = value;
|
||||
nbits -= 24;
|
||||
} else {
|
||||
value = asn_get_few_bits(pd, nbits);
|
||||
if(value < 0) return -1;
|
||||
if(nbits & 7) { /* implies left alignment */
|
||||
value <<= 8 - (nbits & 7),
|
||||
nbits += 8 - (nbits & 7);
|
||||
if(nbits > 24)
|
||||
*dst++ = value >> 24;
|
||||
}
|
||||
if(nbits > 16)
|
||||
*dst++ = value >> 16;
|
||||
if(nbits > 8)
|
||||
*dst++ = value >> 8;
|
||||
*dst++ = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put a small number of bits (<= 31).
|
||||
*/
|
||||
int
|
||||
asn_put_few_bits(asn_bit_outp_t *po, uint32_t bits, int obits) {
|
||||
size_t off; /* Next after last bit offset */
|
||||
size_t omsk; /* Existing last byte meaningful bits mask */
|
||||
uint8_t *buf;
|
||||
|
||||
if(obits <= 0 || obits >= 32) return obits ? -1 : 0;
|
||||
|
||||
ASN_DEBUG("[PER put %d bits %x to %p+%d bits]",
|
||||
obits, (int)bits, (void *)po->buffer, (int)po->nboff);
|
||||
|
||||
/*
|
||||
* Normalize position indicator.
|
||||
*/
|
||||
if(po->nboff >= 8) {
|
||||
po->buffer += (po->nboff >> 3);
|
||||
po->nbits -= (po->nboff & ~0x07);
|
||||
po->nboff &= 0x07;
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush whole-bytes output, if necessary.
|
||||
*/
|
||||
if(po->nboff + obits > po->nbits) {
|
||||
size_t complete_bytes;
|
||||
if(!po->buffer) po->buffer = po->tmpspace;
|
||||
complete_bytes = (po->buffer - po->tmpspace);
|
||||
ASN_DEBUG("[PER output %ld complete + %ld]",
|
||||
(long)complete_bytes, (long)po->flushed_bytes);
|
||||
if(po->output(po->tmpspace, complete_bytes, po->op_key) < 0)
|
||||
return -1;
|
||||
if(po->nboff)
|
||||
po->tmpspace[0] = po->buffer[0];
|
||||
po->buffer = po->tmpspace;
|
||||
po->nbits = 8 * sizeof(po->tmpspace);
|
||||
po->flushed_bytes += complete_bytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, due to sizeof(tmpspace), we are guaranteed large enough space.
|
||||
*/
|
||||
buf = po->buffer;
|
||||
omsk = ~((1 << (8 - po->nboff)) - 1);
|
||||
off = (po->nboff + obits);
|
||||
|
||||
/* Clear data of debris before meaningful bits */
|
||||
bits &= (((uint32_t)1 << obits) - 1);
|
||||
|
||||
ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits,
|
||||
(int)bits, (int)bits,
|
||||
(int)po->nboff, (int)off,
|
||||
buf[0], (int)(omsk&0xff),
|
||||
(int)(buf[0] & omsk));
|
||||
|
||||
if(off <= 8) /* Completely within 1 byte */
|
||||
po->nboff = off,
|
||||
bits <<= (8 - off),
|
||||
buf[0] = (buf[0] & omsk) | bits;
|
||||
else if(off <= 16)
|
||||
po->nboff = off,
|
||||
bits <<= (16 - off),
|
||||
buf[0] = (buf[0] & omsk) | (bits >> 8),
|
||||
buf[1] = bits;
|
||||
else if(off <= 24)
|
||||
po->nboff = off,
|
||||
bits <<= (24 - off),
|
||||
buf[0] = (buf[0] & omsk) | (bits >> 16),
|
||||
buf[1] = bits >> 8,
|
||||
buf[2] = bits;
|
||||
else if(off <= 31)
|
||||
po->nboff = off,
|
||||
bits <<= (32 - off),
|
||||
buf[0] = (buf[0] & omsk) | (bits >> 24),
|
||||
buf[1] = bits >> 16,
|
||||
buf[2] = bits >> 8,
|
||||
buf[3] = bits;
|
||||
else {
|
||||
if(asn_put_few_bits(po, bits >> (obits - 24), 24)) return -1;
|
||||
if(asn_put_few_bits(po, bits, obits - 24)) return -1;
|
||||
}
|
||||
|
||||
ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]",
|
||||
(int)bits, (int)bits, buf[0],
|
||||
(long)(po->buffer - po->tmpspace));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Output a large number of bits.
|
||||
*/
|
||||
int
|
||||
asn_put_many_bits(asn_bit_outp_t *po, const uint8_t *src, int nbits) {
|
||||
|
||||
while(nbits) {
|
||||
uint32_t value;
|
||||
|
||||
if(nbits >= 24) {
|
||||
value = (src[0] << 16) | (src[1] << 8) | src[2];
|
||||
src += 3;
|
||||
nbits -= 24;
|
||||
if(asn_put_few_bits(po, value, 24))
|
||||
return -1;
|
||||
} else {
|
||||
value = src[0];
|
||||
if(nbits > 8)
|
||||
value = (value << 8) | src[1];
|
||||
if(nbits > 16)
|
||||
value = (value << 8) | src[2];
|
||||
if(nbits & 0x07)
|
||||
value >>= (8 - (nbits & 0x07));
|
||||
if(asn_put_few_bits(po, value, nbits))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
asn_put_aligned_flush(asn_bit_outp_t *po) {
|
||||
uint32_t unused_bits = (0x7 & (8 - (po->nboff & 0x07)));
|
||||
size_t complete_bytes =
|
||||
(po->buffer ? po->buffer - po->tmpspace : 0) + ((po->nboff + 7) >> 3);
|
||||
|
||||
if(unused_bits) {
|
||||
po->buffer[po->nboff >> 3] &= ~0u << unused_bits;
|
||||
}
|
||||
|
||||
if(po->output(po->tmpspace, complete_bytes, po->op_key) < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
po->buffer = po->tmpspace;
|
||||
po->nboff = 0;
|
||||
po->nbits = 8 * sizeof(po->tmpspace);
|
||||
po->flushed_bytes += complete_bytes;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
317
e2sm/lib/asn_codecs_prim.c
Normal file
317
e2sm/lib/asn_codecs_prim.c
Normal file
@@ -0,0 +1,317 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_codecs_prim.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* Decode an always-primitive type.
|
||||
*/
|
||||
asn_dec_rval_t
|
||||
ber_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void **sptr,
|
||||
const void *buf_ptr, size_t size, int tag_mode) {
|
||||
ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr;
|
||||
asn_dec_rval_t rval;
|
||||
ber_tlv_len_t length = 0; /* =0 to avoid [incorrect] warning. */
|
||||
|
||||
/*
|
||||
* If the structure is not there, allocate it.
|
||||
*/
|
||||
if(st == NULL) {
|
||||
st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st));
|
||||
if(st == NULL) ASN__DECODE_FAILED;
|
||||
*sptr = (void *)st;
|
||||
}
|
||||
|
||||
ASN_DEBUG("Decoding %s as plain primitive (tm=%d)",
|
||||
td->name, tag_mode);
|
||||
|
||||
/*
|
||||
* Check tags and extract value length.
|
||||
*/
|
||||
rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size,
|
||||
tag_mode, 0, &length, 0);
|
||||
if(rval.code != RC_OK)
|
||||
return rval;
|
||||
|
||||
ASN_DEBUG("%s length is %d bytes", td->name, (int)length);
|
||||
|
||||
/*
|
||||
* Make sure we have this length.
|
||||
*/
|
||||
buf_ptr = ((const char *)buf_ptr) + rval.consumed;
|
||||
size -= rval.consumed;
|
||||
if(length > (ber_tlv_len_t)size) {
|
||||
rval.code = RC_WMORE;
|
||||
rval.consumed = 0;
|
||||
return rval;
|
||||
}
|
||||
|
||||
st->size = (int)length;
|
||||
/* The following better be optimized away. */
|
||||
if(sizeof(st->size) != sizeof(length)
|
||||
&& (ber_tlv_len_t)st->size != length) {
|
||||
st->size = 0;
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
st->buf = (uint8_t *)MALLOC(length + 1);
|
||||
if(!st->buf) {
|
||||
st->size = 0;
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memcpy(st->buf, buf_ptr, length);
|
||||
st->buf[length] = '\0'; /* Just in case */
|
||||
|
||||
rval.code = RC_OK;
|
||||
rval.consumed += length;
|
||||
|
||||
ASN_DEBUG("Took %ld/%ld bytes to encode %s",
|
||||
(long)rval.consumed,
|
||||
(long)length, td->name);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode an always-primitive type using DER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
der_encode_primitive(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
int tag_mode, ber_tlv_tag_t tag,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
asn_enc_rval_t erval = {0,0,0};
|
||||
const ASN__PRIMITIVE_TYPE_t *st = (const ASN__PRIMITIVE_TYPE_t *)sptr;
|
||||
|
||||
ASN_DEBUG("%s %s as a primitive type (tm=%d)",
|
||||
cb?"Encoding":"Estimating", td->name, tag_mode);
|
||||
|
||||
erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag,
|
||||
cb, app_key);
|
||||
ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded);
|
||||
if(erval.encoded == -1) {
|
||||
erval.failed_type = td;
|
||||
erval.structure_ptr = sptr;
|
||||
return erval;
|
||||
}
|
||||
|
||||
if(cb && st->buf) {
|
||||
if(cb(st->buf, st->size, app_key) < 0) {
|
||||
erval.encoded = -1;
|
||||
erval.failed_type = td;
|
||||
erval.structure_ptr = sptr;
|
||||
return erval;
|
||||
}
|
||||
} else {
|
||||
assert(st->buf || st->size == 0);
|
||||
}
|
||||
|
||||
erval.encoded += st->size;
|
||||
ASN__ENCODED_OK(erval);
|
||||
}
|
||||
|
||||
void
|
||||
ASN__PRIMITIVE_TYPE_free(const asn_TYPE_descriptor_t *td, void *sptr,
|
||||
enum asn_struct_free_method method) {
|
||||
ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr;
|
||||
|
||||
if(!td || !sptr)
|
||||
return;
|
||||
|
||||
ASN_DEBUG("Freeing %s as a primitive type", td->name);
|
||||
|
||||
if(st->buf)
|
||||
FREEMEM(st->buf);
|
||||
|
||||
switch(method) {
|
||||
case ASFM_FREE_EVERYTHING:
|
||||
FREEMEM(sptr);
|
||||
break;
|
||||
case ASFM_FREE_UNDERLYING:
|
||||
break;
|
||||
case ASFM_FREE_UNDERLYING_AND_RESET:
|
||||
memset(sptr, 0, sizeof(ASN__PRIMITIVE_TYPE_t));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local internal type passed around as an argument.
|
||||
*/
|
||||
struct xdp_arg_s {
|
||||
const asn_TYPE_descriptor_t *type_descriptor;
|
||||
void *struct_key;
|
||||
xer_primitive_body_decoder_f *prim_body_decoder;
|
||||
int decoded_something;
|
||||
int want_more;
|
||||
};
|
||||
|
||||
/*
|
||||
* Since some kinds of primitive values can be encoded using value-specific
|
||||
* tags (<MINUS-INFINITY>, <enum-element>, etc), the primitive decoder must
|
||||
* be supplied with such tags to parse them as needed.
|
||||
*/
|
||||
static int
|
||||
xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) {
|
||||
struct xdp_arg_s *arg = (struct xdp_arg_s *)key;
|
||||
enum xer_pbd_rval bret;
|
||||
|
||||
/*
|
||||
* The chunk_buf is guaranteed to start at '<'.
|
||||
*/
|
||||
assert(chunk_size && ((const char *)chunk_buf)[0] == 0x3c);
|
||||
|
||||
/*
|
||||
* Decoding was performed once already. Prohibit doing it again.
|
||||
*/
|
||||
if(arg->decoded_something)
|
||||
return -1;
|
||||
|
||||
bret = arg->prim_body_decoder(arg->type_descriptor,
|
||||
arg->struct_key, chunk_buf, chunk_size);
|
||||
switch(bret) {
|
||||
case XPBD_SYSTEM_FAILURE:
|
||||
case XPBD_DECODER_LIMIT:
|
||||
case XPBD_BROKEN_ENCODING:
|
||||
break;
|
||||
case XPBD_BODY_CONSUMED:
|
||||
/* Tag decoded successfully */
|
||||
arg->decoded_something = 1;
|
||||
/* Fall through */
|
||||
case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) {
|
||||
struct xdp_arg_s *arg = (struct xdp_arg_s *)key;
|
||||
enum xer_pbd_rval bret;
|
||||
size_t lead_wsp_size;
|
||||
|
||||
if(arg->decoded_something) {
|
||||
if(xer_whitespace_span(chunk_buf, chunk_size) == chunk_size) {
|
||||
/*
|
||||
* Example:
|
||||
* "<INTEGER>123<!--/--> </INTEGER>"
|
||||
* ^- chunk_buf position.
|
||||
*/
|
||||
return chunk_size;
|
||||
}
|
||||
/*
|
||||
* Decoding was done once already. Prohibit doing it again.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!have_more) {
|
||||
/*
|
||||
* If we've received something like "1", we can't really
|
||||
* tell whether it is really `1` or `123`, until we know
|
||||
* that there is no more data coming.
|
||||
* The have_more argument will be set to 1 once something
|
||||
* like this is available to the caller of this callback:
|
||||
* "1<tag_start..."
|
||||
*/
|
||||
arg->want_more = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
lead_wsp_size = xer_whitespace_span(chunk_buf, chunk_size);
|
||||
chunk_buf = (const char *)chunk_buf + lead_wsp_size;
|
||||
chunk_size -= lead_wsp_size;
|
||||
|
||||
bret = arg->prim_body_decoder(arg->type_descriptor,
|
||||
arg->struct_key, chunk_buf, chunk_size);
|
||||
switch(bret) {
|
||||
case XPBD_SYSTEM_FAILURE:
|
||||
case XPBD_DECODER_LIMIT:
|
||||
case XPBD_BROKEN_ENCODING:
|
||||
break;
|
||||
case XPBD_BODY_CONSUMED:
|
||||
/* Tag decoded successfully */
|
||||
arg->decoded_something = 1;
|
||||
/* Fall through */
|
||||
case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */
|
||||
return lead_wsp_size + chunk_size;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
asn_dec_rval_t
|
||||
xer_decode_primitive(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, void **sptr,
|
||||
size_t struct_size, const char *opt_mname,
|
||||
const void *buf_ptr, size_t size,
|
||||
xer_primitive_body_decoder_f *prim_body_decoder) {
|
||||
const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
|
||||
asn_struct_ctx_t s_ctx;
|
||||
struct xdp_arg_s s_arg;
|
||||
asn_dec_rval_t rc;
|
||||
|
||||
/*
|
||||
* Create the structure if does not exist.
|
||||
*/
|
||||
if(!*sptr) {
|
||||
*sptr = CALLOC(1, struct_size);
|
||||
if(!*sptr) ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
memset(&s_ctx, 0, sizeof(s_ctx));
|
||||
s_arg.type_descriptor = td;
|
||||
s_arg.struct_key = *sptr;
|
||||
s_arg.prim_body_decoder = prim_body_decoder;
|
||||
s_arg.decoded_something = 0;
|
||||
s_arg.want_more = 0;
|
||||
|
||||
rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg,
|
||||
xml_tag, buf_ptr, size,
|
||||
xer_decode__unexpected_tag, xer_decode__primitive_body);
|
||||
switch(rc.code) {
|
||||
case RC_OK:
|
||||
if(!s_arg.decoded_something) {
|
||||
char ch;
|
||||
ASN_DEBUG("Primitive body is not recognized, "
|
||||
"supplying empty one");
|
||||
/*
|
||||
* Decoding opportunity has come and gone.
|
||||
* Where's the result?
|
||||
* Try to feed with empty body, see if it eats it.
|
||||
*/
|
||||
if(prim_body_decoder(s_arg.type_descriptor,
|
||||
s_arg.struct_key, &ch, 0)
|
||||
!= XPBD_BODY_CONSUMED) {
|
||||
/*
|
||||
* This decoder does not like empty stuff.
|
||||
*/
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RC_WMORE:
|
||||
/*
|
||||
* Redo the whole thing later.
|
||||
* We don't have a context to save intermediate parsing state.
|
||||
*/
|
||||
rc.consumed = 0;
|
||||
break;
|
||||
case RC_FAIL:
|
||||
rc.consumed = 0;
|
||||
if(s_arg.want_more)
|
||||
rc.code = RC_WMORE;
|
||||
else
|
||||
ASN__DECODE_FAILED;
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
48
e2sm/lib/asn_internal.c
Normal file
48
e2sm/lib/asn_internal.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <asn_internal.h>
|
||||
|
||||
ssize_t
|
||||
asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key,
|
||||
const char *fmt, ...) {
|
||||
char scratch[64];
|
||||
char *buf = scratch;
|
||||
size_t buf_size = sizeof(scratch);
|
||||
int wrote;
|
||||
int cb_ret;
|
||||
|
||||
do {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
wrote = vsnprintf(buf, buf_size, fmt, args);
|
||||
if(wrote < (ssize_t)buf_size) {
|
||||
if(wrote < 0) {
|
||||
if(buf != scratch) FREEMEM(buf);
|
||||
va_end(args);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
buf_size <<= 1;
|
||||
if(buf == scratch) {
|
||||
buf = MALLOC(buf_size);
|
||||
if(!buf) return -1;
|
||||
} else {
|
||||
void *p = REALLOC(buf, buf_size);
|
||||
if(!p) {
|
||||
FREEMEM(buf);
|
||||
return -1;
|
||||
}
|
||||
buf = p;
|
||||
}
|
||||
} while(1);
|
||||
|
||||
cb_ret = cb(buf, wrote, key);
|
||||
if(buf != scratch) FREEMEM(buf);
|
||||
if(cb_ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return wrote;
|
||||
}
|
||||
|
||||
56
e2sm/lib/asn_random_fill.c
Normal file
56
e2sm/lib/asn_random_fill.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <asn_random_fill.h>
|
||||
#include <constr_TYPE.h>
|
||||
|
||||
int
|
||||
asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr,
|
||||
size_t length) {
|
||||
|
||||
if(td && td->op->random_fill) {
|
||||
asn_random_fill_result_t res =
|
||||
td->op->random_fill(td, struct_ptr, 0, length);
|
||||
return (res.code == ARFILL_OK) ? 0 : -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static uintmax_t
|
||||
asn__intmax_range(intmax_t lb, intmax_t ub) {
|
||||
assert(lb <= ub);
|
||||
if((ub < 0) == (lb < 0)) {
|
||||
return ub - lb;
|
||||
} else if(lb < 0) {
|
||||
return 1 + ((uintmax_t)ub + (uintmax_t)-(lb + 1));
|
||||
} else {
|
||||
assert(!"Unreachable");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
intmax_t
|
||||
asn_random_between(intmax_t lb, intmax_t rb) {
|
||||
if(lb == rb) {
|
||||
return lb;
|
||||
} else {
|
||||
const uintmax_t intmax_max = ((~(uintmax_t)0) >> 1);
|
||||
uintmax_t range = asn__intmax_range(lb, rb);
|
||||
uintmax_t value = 0;
|
||||
uintmax_t got_entropy = 0;
|
||||
|
||||
assert(RAND_MAX > 0xffffff); /* Seen 7ffffffd! */
|
||||
assert(range < intmax_max);
|
||||
|
||||
for(; got_entropy < range;) {
|
||||
got_entropy = (got_entropy << 24) | 0xffffff;
|
||||
value = (value << 24) | (random() % 0xffffff);
|
||||
}
|
||||
|
||||
return lb + (intmax_t)(value % (range + 1));
|
||||
}
|
||||
}
|
||||
283
e2sm/lib/ber_decoder.c
Normal file
283
e2sm/lib/ber_decoder.c
Normal file
@@ -0,0 +1,283 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
|
||||
#undef ADVANCE
|
||||
#define ADVANCE(num_bytes) do { \
|
||||
size_t num = num_bytes; \
|
||||
ptr = ((const char *)ptr) + num; \
|
||||
size -= num; \
|
||||
consumed_myself += num; \
|
||||
} while(0)
|
||||
#undef RETURN
|
||||
#define RETURN(_code) do { \
|
||||
asn_dec_rval_t rval; \
|
||||
rval.code = _code; \
|
||||
if(opt_ctx) opt_ctx->step = step; /* Save context */ \
|
||||
if(_code == RC_OK || opt_ctx) \
|
||||
rval.consumed = consumed_myself; \
|
||||
else \
|
||||
rval.consumed = 0; /* Context-free */ \
|
||||
return rval; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* The BER decoder of any type.
|
||||
*/
|
||||
asn_dec_rval_t
|
||||
ber_decode(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
|
||||
const void *ptr, size_t size) {
|
||||
asn_codec_ctx_t s_codec_ctx;
|
||||
|
||||
/*
|
||||
* Stack checker requires that the codec context
|
||||
* must be allocated on the stack.
|
||||
*/
|
||||
if(opt_codec_ctx) {
|
||||
if(opt_codec_ctx->max_stack_size) {
|
||||
s_codec_ctx = *opt_codec_ctx;
|
||||
opt_codec_ctx = &s_codec_ctx;
|
||||
}
|
||||
} else {
|
||||
/* If context is not given, be security-conscious anyway */
|
||||
memset(&s_codec_ctx, 0, sizeof(s_codec_ctx));
|
||||
s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX;
|
||||
opt_codec_ctx = &s_codec_ctx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invoke type-specific decoder.
|
||||
*/
|
||||
return type_descriptor->op->ber_decoder(opt_codec_ctx, type_descriptor,
|
||||
struct_ptr, /* Pointer to the destination structure */
|
||||
ptr, size, /* Buffer and its size */
|
||||
0 /* Default tag mode is 0 */
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the set of <TL<TL<TL...>>> tags matches the definition.
|
||||
*/
|
||||
asn_dec_rval_t
|
||||
ber_check_tags(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx,
|
||||
const void *ptr, size_t size, int tag_mode, int last_tag_form,
|
||||
ber_tlv_len_t *last_length, int *opt_tlv_form) {
|
||||
ssize_t consumed_myself = 0;
|
||||
ssize_t tag_len;
|
||||
ssize_t len_len;
|
||||
ber_tlv_tag_t tlv_tag;
|
||||
ber_tlv_len_t tlv_len;
|
||||
ber_tlv_len_t limit_len = -1;
|
||||
int expect_00_terminators = 0;
|
||||
int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */
|
||||
int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */
|
||||
int tagno;
|
||||
|
||||
/*
|
||||
* Make sure we didn't exceed the maximum stack size.
|
||||
*/
|
||||
if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx))
|
||||
RETURN(RC_FAIL);
|
||||
|
||||
/*
|
||||
* So what does all this implicit skip stuff mean?
|
||||
* Imagine two types,
|
||||
* A ::= [5] IMPLICIT T
|
||||
* B ::= [2] EXPLICIT T
|
||||
* Where T is defined as
|
||||
* T ::= [4] IMPLICIT SEQUENCE { ... }
|
||||
*
|
||||
* Let's say, we are starting to decode type A, given the
|
||||
* following TLV stream: <5> <0>. What does this mean?
|
||||
* It means that the type A contains type T which is,
|
||||
* in turn, empty.
|
||||
* Remember though, that we are still in A. We cannot
|
||||
* just pass control to the type T decoder. Why? Because
|
||||
* the type T decoder expects <4> <0>, not <5> <0>.
|
||||
* So, we must make sure we are going to receive <5> while
|
||||
* still in A, then pass control to the T decoder, indicating
|
||||
* that the tag <4> was implicitly skipped. The decoder of T
|
||||
* hence will be prepared to treat <4> as valid tag, and decode
|
||||
* it appropriately.
|
||||
*/
|
||||
|
||||
tagno = step /* Continuing where left previously */
|
||||
+ (tag_mode==1?-1:0)
|
||||
;
|
||||
ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)",
|
||||
td->name, (long)size, tag_mode, step, tagno);
|
||||
/* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */
|
||||
|
||||
if(tag_mode == 0 && tagno == (int)td->tags_count) {
|
||||
/*
|
||||
* This must be the _untagged_ ANY type,
|
||||
* which outermost tag isn't known in advance.
|
||||
* Fetch the tag and length separately.
|
||||
*/
|
||||
tag_len = ber_fetch_tag(ptr, size, &tlv_tag);
|
||||
switch(tag_len) {
|
||||
case -1: RETURN(RC_FAIL);
|
||||
case 0: RETURN(RC_WMORE);
|
||||
}
|
||||
tlv_constr = BER_TLV_CONSTRUCTED(ptr);
|
||||
len_len = ber_fetch_length(tlv_constr,
|
||||
(const char *)ptr + tag_len, size - tag_len, &tlv_len);
|
||||
switch(len_len) {
|
||||
case -1: RETURN(RC_FAIL);
|
||||
case 0: RETURN(RC_WMORE);
|
||||
}
|
||||
ASN_DEBUG("Advancing %ld in ANY case",
|
||||
(long)(tag_len + len_len));
|
||||
ADVANCE(tag_len + len_len);
|
||||
} else {
|
||||
assert(tagno < (int)td->tags_count); /* At least one loop */
|
||||
}
|
||||
for((void)tagno; tagno < (int)td->tags_count; tagno++, step++) {
|
||||
|
||||
/*
|
||||
* Fetch and process T from TLV.
|
||||
*/
|
||||
tag_len = ber_fetch_tag(ptr, size, &tlv_tag);
|
||||
ASN_DEBUG("Fetching tag from {%p,%ld}: "
|
||||
"len %ld, step %d, tagno %d got %s",
|
||||
ptr, (long)size,
|
||||
(long)tag_len, step, tagno,
|
||||
ber_tlv_tag_string(tlv_tag));
|
||||
switch(tag_len) {
|
||||
case -1: RETURN(RC_FAIL);
|
||||
case 0: RETURN(RC_WMORE);
|
||||
}
|
||||
|
||||
tlv_constr = BER_TLV_CONSTRUCTED(ptr);
|
||||
|
||||
/*
|
||||
* If {I}, don't check anything.
|
||||
* If {I,B,C}, check B and C unless we're at I.
|
||||
*/
|
||||
if(tag_mode != 0 && step == 0) {
|
||||
/*
|
||||
* We don't expect tag to match here.
|
||||
* It's just because we don't know how the tag
|
||||
* is supposed to look like.
|
||||
*/
|
||||
} else {
|
||||
assert(tagno >= 0); /* Guaranteed by the code above */
|
||||
if(tlv_tag != td->tags[tagno]) {
|
||||
/*
|
||||
* Unexpected tag. Too bad.
|
||||
*/
|
||||
ASN_DEBUG("Expected: %s, "
|
||||
"expectation failed (tn=%d, tm=%d)",
|
||||
ber_tlv_tag_string(td->tags[tagno]),
|
||||
tagno, tag_mode
|
||||
);
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Attention: if there are more tags expected,
|
||||
* ensure that the current tag is presented
|
||||
* in constructed form (it contains other tags!).
|
||||
* If this one is the last one, check that the tag form
|
||||
* matches the one given in descriptor.
|
||||
*/
|
||||
if(tagno < ((int)td->tags_count - 1)) {
|
||||
if(tlv_constr == 0) {
|
||||
ASN_DEBUG("tlv_constr = %d, expfail",
|
||||
tlv_constr);
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
} else {
|
||||
if(last_tag_form != tlv_constr
|
||||
&& last_tag_form != -1) {
|
||||
ASN_DEBUG("last_tag_form %d != %d",
|
||||
last_tag_form, tlv_constr);
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch and process L from TLV.
|
||||
*/
|
||||
len_len = ber_fetch_length(tlv_constr,
|
||||
(const char *)ptr + tag_len, size - tag_len, &tlv_len);
|
||||
ASN_DEBUG("Fetching len = %ld", (long)len_len);
|
||||
switch(len_len) {
|
||||
case -1: RETURN(RC_FAIL);
|
||||
case 0: RETURN(RC_WMORE);
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME
|
||||
* As of today, the chain of tags
|
||||
* must either contain several indefinite length TLVs,
|
||||
* or several definite length ones.
|
||||
* No mixing is allowed.
|
||||
*/
|
||||
if(tlv_len == -1) {
|
||||
/*
|
||||
* Indefinite length.
|
||||
*/
|
||||
if(limit_len == -1) {
|
||||
expect_00_terminators++;
|
||||
} else {
|
||||
ASN_DEBUG("Unexpected indefinite length "
|
||||
"in a chain of definite lengths");
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
ADVANCE(tag_len + len_len);
|
||||
continue;
|
||||
} else {
|
||||
if(expect_00_terminators) {
|
||||
ASN_DEBUG("Unexpected definite length "
|
||||
"in a chain of indefinite lengths");
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that multiple TLVs specify ever decreasing length,
|
||||
* which is consistent.
|
||||
*/
|
||||
if(limit_len == -1) {
|
||||
limit_len = tlv_len + tag_len + len_len;
|
||||
if(limit_len < 0) {
|
||||
/* Too great tlv_len value? */
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
} else if(limit_len != tlv_len + tag_len + len_len) {
|
||||
/*
|
||||
* Inner TLV specifies length which is inconsistent
|
||||
* with the outer TLV's length value.
|
||||
*/
|
||||
ASN_DEBUG("Outer TLV is %ld and inner is %ld",
|
||||
(long)limit_len, (long)tlv_len);
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
ADVANCE(tag_len + len_len);
|
||||
|
||||
limit_len -= (tag_len + len_len);
|
||||
if((ssize_t)size > limit_len) {
|
||||
/*
|
||||
* Make sure that we won't consume more bytes
|
||||
* from the parent frame than the inferred limit.
|
||||
*/
|
||||
size = limit_len;
|
||||
}
|
||||
}
|
||||
|
||||
if(opt_tlv_form)
|
||||
*opt_tlv_form = tlv_constr;
|
||||
if(expect_00_terminators)
|
||||
*last_length = -expect_00_terminators;
|
||||
else
|
||||
*last_length = tlv_len;
|
||||
|
||||
RETURN(RC_OK);
|
||||
}
|
||||
168
e2sm/lib/ber_tlv_length.c
Normal file
168
e2sm/lib/ber_tlv_length.c
Normal file
@@ -0,0 +1,168 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <ber_tlv_length.h>
|
||||
#include <ber_tlv_tag.h>
|
||||
|
||||
ssize_t
|
||||
ber_fetch_length(int _is_constructed, const void *bufptr, size_t size,
|
||||
ber_tlv_len_t *len_r) {
|
||||
const uint8_t *buf = (const uint8_t *)bufptr;
|
||||
unsigned oct;
|
||||
|
||||
if(size == 0)
|
||||
return 0; /* Want more */
|
||||
|
||||
oct = *(const uint8_t *)buf;
|
||||
if((oct & 0x80) == 0) {
|
||||
/*
|
||||
* Short definite length.
|
||||
*/
|
||||
*len_r = oct; /* & 0x7F */
|
||||
return 1;
|
||||
} else {
|
||||
ber_tlv_len_t len;
|
||||
size_t skipped;
|
||||
|
||||
if(_is_constructed && oct == 0x80) {
|
||||
*len_r = -1; /* Indefinite length */
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(oct == 0xff) {
|
||||
/* Reserved in standard for future use. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
oct &= 0x7F; /* Leave only the 7 LS bits */
|
||||
for(len = 0, buf++, skipped = 1;
|
||||
oct && (++skipped <= size); buf++, oct--) {
|
||||
|
||||
/* Verify that we won't overflow. */
|
||||
if(!(len >> ((8 * sizeof(len)) - (8+1)))) {
|
||||
len = (len << 8) | *buf;
|
||||
} else {
|
||||
/* Too large length value. */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if(oct == 0) {
|
||||
if(len < 0 || len > RSSIZE_MAX) {
|
||||
/* Length value out of sane range. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
*len_r = len;
|
||||
return skipped;
|
||||
}
|
||||
|
||||
return 0; /* Want more */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ssize_t
|
||||
ber_skip_length(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
int _is_constructed, const void *ptr, size_t size) {
|
||||
ber_tlv_len_t vlen; /* Length of V in TLV */
|
||||
ssize_t tl; /* Length of L in TLV */
|
||||
ssize_t ll; /* Length of L in TLV */
|
||||
size_t skip;
|
||||
|
||||
/*
|
||||
* Make sure we didn't exceed the maximum stack size.
|
||||
*/
|
||||
if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx))
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Determine the size of L in TLV.
|
||||
*/
|
||||
ll = ber_fetch_length(_is_constructed, ptr, size, &vlen);
|
||||
if(ll <= 0) return ll;
|
||||
|
||||
/*
|
||||
* Definite length.
|
||||
*/
|
||||
if(vlen >= 0) {
|
||||
skip = ll + vlen;
|
||||
if(skip > size)
|
||||
return 0; /* Want more */
|
||||
return skip;
|
||||
}
|
||||
|
||||
/*
|
||||
* Indefinite length!
|
||||
*/
|
||||
ASN_DEBUG("Skipping indefinite length");
|
||||
for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) {
|
||||
ber_tlv_tag_t tag;
|
||||
|
||||
/* Fetch the tag */
|
||||
tl = ber_fetch_tag(ptr, size, &tag);
|
||||
if(tl <= 0) return tl;
|
||||
|
||||
ll = ber_skip_length(opt_codec_ctx,
|
||||
BER_TLV_CONSTRUCTED(ptr),
|
||||
((const char *)ptr) + tl, size - tl);
|
||||
if(ll <= 0) return ll;
|
||||
|
||||
skip += tl + ll;
|
||||
|
||||
/*
|
||||
* This may be the end of the indefinite length structure,
|
||||
* two consecutive 0 octets.
|
||||
* Check if it is true.
|
||||
*/
|
||||
if(((const uint8_t *)ptr)[0] == 0
|
||||
&& ((const uint8_t *)ptr)[1] == 0)
|
||||
return skip;
|
||||
|
||||
ptr = ((const char *)ptr) + tl + ll;
|
||||
size -= tl + ll;
|
||||
}
|
||||
|
||||
/* UNREACHABLE */
|
||||
}
|
||||
|
||||
size_t
|
||||
der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) {
|
||||
size_t required_size; /* Size of len encoding */
|
||||
uint8_t *buf = (uint8_t *)bufp;
|
||||
uint8_t *end;
|
||||
int i;
|
||||
|
||||
if(len <= 127) {
|
||||
/* Encoded in 1 octet */
|
||||
if(size) *buf = (uint8_t)len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the subsequent bytes.
|
||||
*/
|
||||
for(required_size = 1, i = 8; i < 8 * (int)sizeof(len); i += 8) {
|
||||
if(len >> i)
|
||||
required_size++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(size <= required_size)
|
||||
return required_size + 1;
|
||||
|
||||
*buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */
|
||||
|
||||
/*
|
||||
* Produce the len encoding, space permitting.
|
||||
*/
|
||||
end = buf + required_size;
|
||||
for(i -= 8; buf < end; i -= 8, buf++)
|
||||
*buf = (uint8_t)(len >> i);
|
||||
|
||||
return required_size + 1;
|
||||
}
|
||||
|
||||
144
e2sm/lib/ber_tlv_tag.c
Normal file
144
e2sm/lib/ber_tlv_tag.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include <asn_internal.h>
|
||||
#include <ber_tlv_tag.h>
|
||||
#include <errno.h>
|
||||
|
||||
ssize_t
|
||||
ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
|
||||
ber_tlv_tag_t val;
|
||||
ber_tlv_tag_t tclass;
|
||||
size_t skipped;
|
||||
|
||||
if(size == 0)
|
||||
return 0;
|
||||
|
||||
val = *(const uint8_t *)ptr;
|
||||
tclass = (val >> 6);
|
||||
if((val &= 0x1F) != 0x1F) {
|
||||
/*
|
||||
* Simple form: everything encoded in a single octet.
|
||||
* Tag Class is encoded using two least significant bits.
|
||||
*/
|
||||
*tag_r = (val << 2) | tclass;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Each octet contains 7 bits of useful information.
|
||||
* The MSB is 0 if it is the last octet of the tag.
|
||||
*/
|
||||
for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2;
|
||||
skipped <= size;
|
||||
ptr = ((const char *)ptr) + 1, skipped++) {
|
||||
unsigned int oct = *(const uint8_t *)ptr;
|
||||
if(oct & 0x80) {
|
||||
val = (val << 7) | (oct & 0x7F);
|
||||
/*
|
||||
* Make sure there are at least 9 bits spare
|
||||
* at the MS side of a value.
|
||||
*/
|
||||
if(val >> ((8 * sizeof(val)) - 9)) {
|
||||
/*
|
||||
* We would not be able to accomodate
|
||||
* any more tag bits.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
val = (val << 7) | oct;
|
||||
*tag_r = (val << 2) | tclass;
|
||||
return skipped;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; /* Want more */
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) {
|
||||
char buf[sizeof("[APPLICATION ]") + 32];
|
||||
ssize_t ret;
|
||||
|
||||
ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf));
|
||||
if(ret >= (ssize_t)sizeof(buf) || ret < 2) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fwrite(buf, 1, ret, f);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) {
|
||||
const char *type = 0;
|
||||
int ret;
|
||||
|
||||
switch(tag & 0x3) {
|
||||
case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break;
|
||||
case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break;
|
||||
case ASN_TAG_CLASS_CONTEXT: type = ""; break;
|
||||
case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break;
|
||||
}
|
||||
|
||||
ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2);
|
||||
if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
ber_tlv_tag_string(ber_tlv_tag_t tag) {
|
||||
static char buf[sizeof("[APPLICATION ]") + 32];
|
||||
|
||||
(void)ber_tlv_tag_snprint(tag, buf, sizeof(buf));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) {
|
||||
int tclass = BER_TAG_CLASS(tag);
|
||||
ber_tlv_tag_t tval = BER_TAG_VALUE(tag);
|
||||
uint8_t *buf = (uint8_t *)bufp;
|
||||
uint8_t *end;
|
||||
size_t required_size;
|
||||
size_t i;
|
||||
|
||||
if(tval <= 30) {
|
||||
/* Encoded in 1 octet */
|
||||
if(size) buf[0] = (tclass << 6) | tval;
|
||||
return 1;
|
||||
} else if(size) {
|
||||
*buf++ = (tclass << 6) | 0x1F;
|
||||
size--;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the subsequent bytes.
|
||||
*/
|
||||
for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) {
|
||||
if(tval >> i)
|
||||
required_size++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(size < required_size)
|
||||
return required_size + 1;
|
||||
|
||||
/*
|
||||
* Fill in the buffer, space permitting.
|
||||
*/
|
||||
end = buf + required_size - 1;
|
||||
for(i -= 7; buf < end; i -= 7, buf++)
|
||||
*buf = 0x80 | ((tval >> i) & 0x7F);
|
||||
*buf = (tval & 0x7F); /* Last octet without high bit */
|
||||
|
||||
return required_size + 1;
|
||||
}
|
||||
|
||||
1533
e2sm/lib/constr_CHOICE.c
Normal file
1533
e2sm/lib/constr_CHOICE.c
Normal file
File diff suppressed because it is too large
Load Diff
380
e2sm/lib/constr_CHOICE_oer.c
Normal file
380
e2sm/lib/constr_CHOICE_oer.c
Normal file
@@ -0,0 +1,380 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
|
||||
* All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_DISABLE_OER_SUPPORT
|
||||
|
||||
#include <asn_internal.h>
|
||||
#include <constr_CHOICE.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* Return a standardized complex structure.
|
||||
*/
|
||||
#undef RETURN
|
||||
#define RETURN(_code) \
|
||||
do { \
|
||||
asn_dec_rval_t rval; \
|
||||
rval.code = _code; \
|
||||
rval.consumed = consumed_myself; \
|
||||
return rval; \
|
||||
} while(0)
|
||||
|
||||
#undef ADVANCE
|
||||
#define ADVANCE(num_bytes) \
|
||||
do { \
|
||||
size_t num = num_bytes; \
|
||||
ptr = ((const char *)ptr) + num; \
|
||||
size -= num; \
|
||||
consumed_myself += num; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* Switch to the next phase of parsing.
|
||||
*/
|
||||
#undef NEXT_PHASE
|
||||
#define NEXT_PHASE(ctx) \
|
||||
do { \
|
||||
ctx->phase++; \
|
||||
ctx->step = 0; \
|
||||
} while(0)
|
||||
#undef SET_PHASE
|
||||
#define SET_PHASE(ctx, value) \
|
||||
do { \
|
||||
ctx->phase = value; \
|
||||
ctx->step = 0; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* Tags are canonically sorted in the tag to member table.
|
||||
*/
|
||||
static int
|
||||
_search4tag(const void *ap, const void *bp) {
|
||||
const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap;
|
||||
const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp;
|
||||
|
||||
int a_class = BER_TAG_CLASS(a->el_tag);
|
||||
int b_class = BER_TAG_CLASS(b->el_tag);
|
||||
|
||||
if(a_class == b_class) {
|
||||
ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag);
|
||||
ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag);
|
||||
|
||||
if(a_value == b_value)
|
||||
return 0;
|
||||
else if(a_value < b_value)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
} else if(a_class < b_class) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* X.696 (08/2015) #8.7 Encoding of tags
|
||||
*/
|
||||
static ssize_t
|
||||
oer_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
|
||||
ber_tlv_tag_t val;
|
||||
ber_tlv_tag_t tclass;
|
||||
size_t skipped;
|
||||
|
||||
if(size == 0)
|
||||
return 0;
|
||||
|
||||
val = *(const uint8_t *)ptr;
|
||||
tclass = (val >> 6);
|
||||
if((val & 0x3F) != 0x3F) {
|
||||
/* #8.7.1 */
|
||||
*tag_r = ((val & 0x3F) << 2) | tclass;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Each octet contains 7 bits of useful information.
|
||||
* The MSB is 0 if it is the last octet of the tag.
|
||||
*/
|
||||
for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; skipped <= size;
|
||||
ptr = ((const char *)ptr) + 1, skipped++) {
|
||||
unsigned int oct = *(const uint8_t *)ptr;
|
||||
if(oct & 0x80) {
|
||||
val = (val << 7) | (oct & 0x7F);
|
||||
/*
|
||||
* Make sure there are at least 9 bits spare
|
||||
* at the MS side of a value.
|
||||
*/
|
||||
if(val >> ((8 * sizeof(val)) - 9)) {
|
||||
/*
|
||||
* We would not be able to accomodate
|
||||
* any more tag bits.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
val = (val << 7) | oct;
|
||||
*tag_r = (val << 2) | tclass;
|
||||
return skipped;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; /* Want more */
|
||||
}
|
||||
|
||||
asn_dec_rval_t
|
||||
CHOICE_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, void **struct_ptr,
|
||||
const void *ptr, size_t size) {
|
||||
/*
|
||||
* Bring closer parts of structure description.
|
||||
*/
|
||||
const asn_CHOICE_specifics_t *specs =
|
||||
(const asn_CHOICE_specifics_t *)td->specifics;
|
||||
asn_TYPE_member_t *elements = td->elements;
|
||||
|
||||
/*
|
||||
* Parts of the structure being constructed.
|
||||
*/
|
||||
void *st = *struct_ptr; /* Target structure. */
|
||||
asn_struct_ctx_t *ctx; /* Decoder context */
|
||||
|
||||
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
|
||||
|
||||
(void)constraints;
|
||||
|
||||
ASN_DEBUG("Decoding %s as CHOICE", td->name);
|
||||
|
||||
/*
|
||||
* Create the target structure if it is not present already.
|
||||
*/
|
||||
if(st == 0) {
|
||||
st = *struct_ptr = CALLOC(1, specs->struct_size);
|
||||
if(st == 0) {
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore parsing context.
|
||||
*/
|
||||
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
|
||||
switch(ctx->phase) {
|
||||
case 0: {
|
||||
/*
|
||||
* Discover the tag.
|
||||
*/
|
||||
ber_tlv_tag_t tlv_tag; /* T from TLV */
|
||||
ssize_t tag_len; /* Length of TLV's T */
|
||||
|
||||
tag_len = oer_fetch_tag(ptr, size, &tlv_tag);
|
||||
switch(tag_len) {
|
||||
case 0:
|
||||
ASN__DECODE_STARVED;
|
||||
case -1:
|
||||
ASN__DECODE_FAILED;
|
||||
}
|
||||
|
||||
do {
|
||||
const asn_TYPE_tag2member_t *t2m;
|
||||
asn_TYPE_tag2member_t key = {0, 0, 0, 0};
|
||||
key.el_tag = tlv_tag;
|
||||
|
||||
t2m = (const asn_TYPE_tag2member_t *)bsearch(
|
||||
&key, specs->tag2el, specs->tag2el_count,
|
||||
sizeof(specs->tag2el[0]), _search4tag);
|
||||
if(t2m) {
|
||||
/*
|
||||
* Found the element corresponding to the tag.
|
||||
*/
|
||||
NEXT_PHASE(ctx);
|
||||
ctx->step = t2m->el_no;
|
||||
break;
|
||||
} else if(specs->ext_start == -1) {
|
||||
ASN_DEBUG(
|
||||
"Unexpected tag %s "
|
||||
"in non-extensible CHOICE %s",
|
||||
ber_tlv_tag_string(tlv_tag), td->name);
|
||||
RETURN(RC_FAIL);
|
||||
} else {
|
||||
/* Skip open type extension */
|
||||
ASN_DEBUG(
|
||||
"Not implemented skipping open type extension for tag %s",
|
||||
ber_tlv_tag_string(tlv_tag));
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
} while(0);
|
||||
|
||||
|
||||
ADVANCE(tag_len);
|
||||
}
|
||||
/* Fall through */
|
||||
case 1: {
|
||||
asn_TYPE_member_t *elm = &elements[ctx->step]; /* CHOICE's element */
|
||||
void *memb_ptr; /* Pointer to the member */
|
||||
void **memb_ptr2; /* Pointer to that pointer */
|
||||
asn_dec_rval_t rval = {0,0};
|
||||
|
||||
/*
|
||||
* Compute the position of the member inside a structure,
|
||||
* and also a type of containment (it may be contained
|
||||
* as pointer or using inline inclusion).
|
||||
*/
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
/* Member is a pointer to another structure */
|
||||
memb_ptr2 = (void **)((char *)st + elm->memb_offset);
|
||||
} else {
|
||||
/*
|
||||
* A pointer to a pointer
|
||||
* holding the start of the structure
|
||||
*/
|
||||
memb_ptr = (char *)st + elm->memb_offset;
|
||||
memb_ptr2 = &memb_ptr;
|
||||
}
|
||||
|
||||
/* Set presence to be able to free it properly at any time */
|
||||
(void)CHOICE_variant_set_presence(td, st, ctx->step + 1);
|
||||
|
||||
if(specs->ext_start >= 0 && specs->ext_start <= ctx->step) {
|
||||
ssize_t got =
|
||||
oer_open_type_get(opt_codec_ctx, elm->type,
|
||||
elm->encoding_constraints.oer_constraints,
|
||||
memb_ptr2, ptr, size);
|
||||
if(got < 0) ASN__DECODE_FAILED;
|
||||
if(got == 0) ASN__DECODE_STARVED;
|
||||
rval.code = RC_OK;
|
||||
rval.consumed = got;
|
||||
} else {
|
||||
rval = elm->type->op->oer_decoder(
|
||||
opt_codec_ctx, elm->type,
|
||||
elm->encoding_constraints.oer_constraints, memb_ptr2, ptr,
|
||||
size);
|
||||
}
|
||||
rval.consumed += consumed_myself;
|
||||
switch(rval.code) {
|
||||
case RC_OK:
|
||||
NEXT_PHASE(ctx);
|
||||
case RC_WMORE:
|
||||
break;
|
||||
case RC_FAIL:
|
||||
SET_PHASE(ctx, 3); /* => 3 */
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
case 2:
|
||||
/* Already decoded everything */
|
||||
RETURN(RC_OK);
|
||||
case 3:
|
||||
/* Failed to decode, after all */
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
* X.696 (08/2015) #8.7 Encoding of tags
|
||||
*/
|
||||
static ssize_t
|
||||
oer_put_tag(ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
uint8_t tclass = BER_TAG_CLASS(tag);
|
||||
ber_tlv_tag_t tval = BER_TAG_VALUE(tag);
|
||||
|
||||
if(tval < 0x3F) {
|
||||
uint8_t b = (uint8_t)((tclass << 6) | tval);
|
||||
if(cb(&b, 1, app_key) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
uint8_t buf[1 + 2 * sizeof(tval)];
|
||||
uint8_t *b = &buf[sizeof(buf)-1]; /* Last addressable */
|
||||
size_t encoded;
|
||||
for(; ; tval >>= 7) {
|
||||
if(tval >> 7) {
|
||||
*b-- = 0x80 | (tval & 0x7f);
|
||||
} else {
|
||||
*b-- = tval & 0x7f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*b = (uint8_t)((tclass << 6) | 0x3F);
|
||||
encoded = sizeof(buf) - (b - buf);
|
||||
if(cb(b, encoded, app_key) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return encoded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode as Canonical OER.
|
||||
*/
|
||||
asn_enc_rval_t
|
||||
CHOICE_encode_oer(const asn_TYPE_descriptor_t *td,
|
||||
const asn_oer_constraints_t *constraints, const void *sptr,
|
||||
asn_app_consume_bytes_f *cb, void *app_key) {
|
||||
const asn_CHOICE_specifics_t *specs =
|
||||
(const asn_CHOICE_specifics_t *)td->specifics;
|
||||
asn_TYPE_member_t *elm; /* CHOICE element */
|
||||
unsigned present;
|
||||
const void *memb_ptr;
|
||||
ber_tlv_tag_t tag;
|
||||
ssize_t tag_len;
|
||||
asn_enc_rval_t er = {0, 0, 0};
|
||||
|
||||
(void)constraints;
|
||||
|
||||
if(!sptr) ASN__ENCODE_FAILED;
|
||||
|
||||
ASN_DEBUG("OER %s encoding as CHOICE", td->name);
|
||||
|
||||
present = CHOICE_variant_get_presence(td, sptr);
|
||||
if(present == 0 || present > td->elements_count) {
|
||||
ASN_DEBUG("CHOICE %s member is not selected", td->name);
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
elm = &td->elements[present-1];
|
||||
if(elm->flags & ATF_POINTER) {
|
||||
memb_ptr =
|
||||
*(const void *const *)((const char *)sptr + elm->memb_offset);
|
||||
if(memb_ptr == 0) {
|
||||
/* Mandatory element absent */
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
} else {
|
||||
memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
|
||||
}
|
||||
|
||||
tag = asn_TYPE_outmost_tag(elm->type, memb_ptr, elm->tag_mode, elm->tag);
|
||||
if(tag == 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
tag_len = oer_put_tag(tag, cb, app_key);
|
||||
if(tag_len < 0) {
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
if(specs->ext_start >= 0 && (unsigned)specs->ext_start <= (present-1)) {
|
||||
ssize_t encoded = oer_open_type_put(elm->type,
|
||||
elm->encoding_constraints.oer_constraints,
|
||||
memb_ptr, cb, app_key);
|
||||
if(encoded < 0) ASN__ENCODE_FAILED;
|
||||
er.encoded = tag_len + encoded;
|
||||
} else {
|
||||
er = elm->type->op->oer_encoder(
|
||||
elm->type, elm->encoding_constraints.oer_constraints, memb_ptr, cb,
|
||||
app_key);
|
||||
if(er.encoded >= 0) er.encoded += tag_len;
|
||||
}
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
2059
e2sm/lib/constr_SEQUENCE.c
Normal file
2059
e2sm/lib/constr_SEQUENCE.c
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user