re-add s1ap

This commit is contained in:
Sukchan Lee 2018-03-04 16:30:03 +09:00
parent da04290a62
commit 0d8928ff05
1135 changed files with 180464 additions and 3 deletions

View File

@ -424,9 +424,9 @@ AC_CONFIG_FILES([lib/core/test/Makefile])
AC_CONFIG_FILES([lib/core/Makefile])
AC_CONFIG_FILES([lib/s1ap/asn1c/Makefile])
AC_CONFIG_FILES([lib/s1ap/Makefile])
AC_CONFIG_FILES([lib/s1ap2/asn1c/Makefile])
AC_CONFIG_FILES([lib/s1ap2/Makefile])
AC_CONFIG_FILES([lib/s1ap2/test/Makefile])
AC_CONFIG_FILES([lib/s1ap3/asn1c/Makefile])
AC_CONFIG_FILES([lib/s1ap3/Makefile])
AC_CONFIG_FILES([lib/s1ap3/test/Makefile])
AC_CONFIG_FILES([lib/nas/Makefile])
AC_CONFIG_FILES([lib/fd/Makefile])
AC_CONFIG_FILES([lib/gtp/Makefile])

6
lib/s1ap3/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = @FREEDIAMETER_DIR@ ipfw core s1ap nas fd gtp
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

450
lib/s1ap3/asn1c/ANY.c Normal file
View File

@ -0,0 +1,450 @@
/*
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <ANY.h>
#include <errno.h>
asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
sizeof(ANY_t),
offsetof(ANY_t, _asn_ctx),
ASN_OSUBV_ANY
};
asn_TYPE_operation_t asn_OP_ANY = {
OCTET_STRING_free,
OCTET_STRING_print,
OCTET_STRING_compare,
OCTET_STRING_decode_ber,
OCTET_STRING_encode_der,
OCTET_STRING_decode_xer_hex,
ANY_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
0,
0,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0, 0, 0, 0,
#else
ANY_decode_uper,
ANY_encode_uper,
ANY_decode_aper,
ANY_encode_aper,
#endif /* ASN_DISABLE_PER_SUPPORT */
0, /* Random fill is not defined for ANY type */
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_ANY = {
"ANY",
"ANY",
&asn_OP_ANY,
0, 0, 0, 0,
{ 0, 0, asn_generic_no_constraint }, /* No constraints */
0, 0, /* No members */
&asn_SPC_ANY_specs,
};
#undef RETURN
#define RETURN(_code) \
do { \
asn_dec_rval_t tmprval; \
tmprval.code = _code; \
tmprval.consumed = consumed_myself; \
return tmprval; \
} while(0)
asn_enc_rval_t
ANY_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) {
if(flags & XER_F_CANONICAL) {
/*
* Canonical XER-encoding of ANY type is not supported.
*/
ASN__ENCODE_FAILED;
}
/* Dump as binary */
return OCTET_STRING_encode_xer(td, sptr, ilevel, flags, cb, app_key);
}
struct _callback_arg {
uint8_t *buffer;
size_t offset;
size_t size;
};
static int ANY__consume_bytes(const void *buffer, size_t size, void *key);
int
ANY_fromType(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) {
struct _callback_arg arg;
asn_enc_rval_t erval;
if(!st || !td) {
errno = EINVAL;
return -1;
}
if(!sptr) {
if(st->buf) FREEMEM(st->buf);
st->size = 0;
return 0;
}
arg.offset = arg.size = 0;
arg.buffer = 0;
erval = der_encode(td, sptr, ANY__consume_bytes, &arg);
if(erval.encoded == -1) {
if(arg.buffer) FREEMEM(arg.buffer);
return -1;
}
assert((size_t)erval.encoded == arg.offset);
if(st->buf) FREEMEM(st->buf);
st->buf = arg.buffer;
st->size = arg.offset;
return 0;
}
int
ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) {
uint8_t *buffer = NULL;
ssize_t erval;
if(!st || !td) {
errno = EINVAL;
return -1;
}
if(!sptr) {
if(st->buf) FREEMEM(st->buf);
st->size = 0;
return 0;
}
erval = aper_encode_to_new_buffer(td, td->encoding_constraints.per_constraints, sptr, (void**)&buffer);
if(erval == -1) {
if(buffer) FREEMEM(buffer);
return -1;
}
assert((size_t)erval > 0);
if(st->buf) FREEMEM(st->buf);
st->buf = buffer;
st->size = erval;
return 0;
}
ANY_t *
ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) {
ANY_t tmp;
ANY_t *st;
if(!td || !sptr) {
errno = EINVAL;
return 0;
}
memset(&tmp, 0, sizeof(tmp));
if(ANY_fromType(&tmp, td, sptr)) return 0;
st = (ANY_t *)CALLOC(1, sizeof(ANY_t));
if(st) {
*st = tmp;
return st;
} else {
FREEMEM(tmp.buf);
return 0;
}
}
ANY_t *
ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr) {
ANY_t tmp;
ANY_t *st;
if(!td || !sptr) {
errno = EINVAL;
return 0;
}
memset(&tmp, 0, sizeof(tmp));
if(ANY_fromType_aper(&tmp, td, sptr)) return 0;
st = (ANY_t *)CALLOC(1, sizeof(ANY_t));
if(st) {
*st = tmp;
return st;
} else {
FREEMEM(tmp.buf);
return 0;
}
}
int
ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
asn_dec_rval_t rval;
void *newst = 0;
if(!st || !td || !struct_ptr) {
errno = EINVAL;
return -1;
}
if(st->buf == 0) {
/* Nothing to convert, make it empty. */
*struct_ptr = (void *)0;
return 0;
}
rval = ber_decode(0, td, (void **)&newst, st->buf, st->size);
if(rval.code == RC_OK) {
*struct_ptr = newst;
return 0;
} else {
/* Remove possibly partially decoded data. */
ASN_STRUCT_FREE(*td, newst);
return -1;
}
}
int
ANY_to_type_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
asn_dec_rval_t rval;
void *newst = 0;
if(!st || !td || !struct_ptr) {
errno = EINVAL;
return -1;
}
if(st->buf == 0) {
/* Nothing to convert, make it empty. */
*struct_ptr = (void *)0;
return 0;
}
rval = aper_decode(0, td, (void **)&newst, st->buf, st->size, 0, 0);
if(rval.code == RC_OK) {
*struct_ptr = newst;
return 0;
} else {
/* Remove possibly partially decoded data. */
ASN_STRUCT_FREE(*td, newst);
return -1;
}
}
static int ANY__consume_bytes(const void *buffer, size_t size, void *key) {
struct _callback_arg *arg = (struct _callback_arg *)key;
if((arg->offset + size) >= arg->size) {
size_t nsize = (arg->size ? arg->size << 2 : 16) + size;
void *p = REALLOC(arg->buffer, nsize);
if(!p) return -1;
arg->buffer = (uint8_t *)p;
arg->size = nsize;
}
memcpy(arg->buffer + arg->offset, buffer, size);
arg->offset += size;
assert(arg->offset < arg->size);
return 0;
}
#ifndef ASN_DISABLE_PER_SUPPORT
asn_dec_rval_t
ANY_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_ANY_specs;
size_t consumed_myself = 0;
int repeat;
ANY_t *st = (ANY_t *)*sptr;
(void)opt_codec_ctx;
(void)constraints;
/*
* Allocate the structure.
*/
if(!st) {
st = (ANY_t *)(*sptr = CALLOC(1, specs->struct_size));
if(!st) RETURN(RC_FAIL);
}
ASN_DEBUG("UPER Decoding ANY type");
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, -1, 0, &repeat);
if(raw_len < 0) RETURN(RC_WMORE);
if(raw_len == 0 && st->buf) break;
ASN_DEBUG("Got PER length len %" ASN_PRI_SIZE ", %s (%s)", raw_len,
repeat ? "repeat" : "once", td->name);
len_bytes = raw_len;
len_bits = len_bytes * 8;
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);
consumed_myself += len_bits;
st->size += len_bytes;
} while(repeat);
st->buf[st->size] = 0; /* nul-terminate */
RETURN(RC_OK);
}
asn_enc_rval_t
ANY_encode_uper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, const void *sptr,
asn_per_outp_t *po) {
const ANY_t *st = (const ANY_t *)sptr;
asn_enc_rval_t er = {0, 0, 0};
const uint8_t *buf;
size_t size;
int ret;
(void)constraints;
if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED;
buf = st->buf;
size = st->size;
do {
int need_eom = 0;
ssize_t may_save = uper_put_length(po, size, &need_eom);
if(may_save < 0) ASN__ENCODE_FAILED;
ret = per_put_many_bits(po, buf, may_save * 8);
if(ret) ASN__ENCODE_FAILED;
buf += may_save;
size -= may_save;
assert(!(may_save & 0x07) || !size);
if(need_eom && uper_put_length(po, 0, 0))
ASN__ENCODE_FAILED; /* End of Message length */
} while(size);
ASN__ENCODED_OK(er);
}
asn_dec_rval_t
ANY_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_OCTET_STRING_specifics_t *specs =
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_SPC_ANY_specs;
size_t consumed_myself = 0;
int repeat;
ANY_t *st = (ANY_t *)*sptr;
(void)opt_codec_ctx;
(void)constraints;
/*
* Allocate the structure.
*/
if(!st) {
st = (ANY_t *)(*sptr = CALLOC(1, specs->struct_size));
if(!st) RETURN(RC_FAIL);
}
ASN_DEBUG("APER Decoding ANY type");
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 = aper_get_length(pd, -1, 0, &repeat);
if(raw_len < 0) RETURN(RC_WMORE);
if(raw_len == 0 && st->buf) break;
ASN_DEBUG("Got PER length len %" ASN_PRI_SIZE ", %s (%s)", raw_len,
repeat ? "repeat" : "once", td->name);
len_bytes = raw_len;
len_bits = len_bytes * 8;
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);
consumed_myself += len_bits;
st->size += len_bytes;
} while(repeat);
st->buf[st->size] = 0; /* nul-terminate */
RETURN(RC_OK);
}
asn_enc_rval_t
ANY_encode_aper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, const void *sptr,
asn_per_outp_t *po) {
const ANY_t *st = (const ANY_t *)sptr;
asn_enc_rval_t er = {0, 0, 0};
const uint8_t *buf;
size_t size;
int ret;
(void)constraints;
if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED;
buf = st->buf;
size = st->size;
do {
int need_eom = 0;
ssize_t may_save = uper_put_length(po, size, &need_eom);
if(may_save < 0) ASN__ENCODE_FAILED;
ret = per_put_many_bits(po, buf, may_save * 8);
if(ret) ASN__ENCODE_FAILED;
buf += may_save;
size -= may_save;
assert(!(may_save & 0x07) || !size);
if(need_eom && uper_put_length(po, 0, 0))
ASN__ENCODE_FAILED; /* End of Message length */
} while(size);
ASN__ENCODED_OK(er);
}
#endif /* ASN_DISABLE_PER_SUPPORT */

65
lib/s1ap3/asn1c/ANY.h Normal file
View File

@ -0,0 +1,65 @@
/*-
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN_TYPE_ANY_H
#define ASN_TYPE_ANY_H
#include <OCTET_STRING.h> /* Implemented via OCTET STRING type */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ANY {
uint8_t *buf; /* BER-encoded ANY contents */
int size; /* Size of the above buffer */
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} ANY_t;
extern asn_TYPE_descriptor_t asn_DEF_ANY;
extern asn_TYPE_operation_t asn_OP_ANY;
extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
asn_struct_free_f ANY_free;
asn_struct_print_f ANY_print;
ber_type_decoder_f ANY_decode_ber;
der_type_encoder_f ANY_encode_der;
xer_type_encoder_f ANY_encode_xer;
per_type_decoder_f ANY_decode_uper;
per_type_encoder_f ANY_encode_uper;
per_type_decoder_f ANY_decode_aper;
per_type_encoder_f ANY_encode_aper;
#define ANY_free OCTET_STRING_free
#define ANY_print OCTET_STRING_print
#define ANY_compare OCTET_STRING_compare
#define ANY_constraint asn_generic_no_constraint
#define ANY_decode_ber OCTET_STRING_decode_ber
#define ANY_encode_der OCTET_STRING_encode_der
#define ANY_decode_xer OCTET_STRING_decode_xer_hex
/******************************
* Handy conversion routines. *
******************************/
/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
/* Convert the contents of the ANY type into the specified type. */
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
&asn_DEF_ANY, (buf), (size))
#ifdef __cplusplus
}
#endif
#endif /* ASN_TYPE_ANY_H */

View 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;
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;
}

View File

@ -0,0 +1,48 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _BIT_STRING_H_
#define _BIT_STRING_H_
#include <OCTET_STRING.h> /* Some help from OCTET STRING */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct BIT_STRING_s {
uint8_t *buf; /* BIT STRING body */
size_t size; /* Size of the above buffer */
int bits_unused;/* Unused trailing bits in the last octet (0..7) */
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} BIT_STRING_t;
extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING;
extern asn_TYPE_operation_t asn_OP_BIT_STRING;
extern asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs;
asn_struct_print_f BIT_STRING_print; /* Human-readable output */
asn_struct_compare_f BIT_STRING_compare;
asn_constr_check_f BIT_STRING_constraint;
xer_type_encoder_f BIT_STRING_encode_xer;
oer_type_decoder_f BIT_STRING_decode_oer;
oer_type_encoder_f BIT_STRING_encode_oer;
per_type_decoder_f BIT_STRING_decode_uper;
per_type_encoder_f BIT_STRING_encode_uper;
asn_random_fill_f BIT_STRING_random_fill;
#define BIT_STRING_free OCTET_STRING_free
#define BIT_STRING_decode_ber OCTET_STRING_decode_ber
#define BIT_STRING_encode_der OCTET_STRING_encode_der
#define BIT_STRING_decode_xer OCTET_STRING_decode_xer_binary
#define BIT_STRING_decode_aper OCTET_STRING_decode_aper
#define BIT_STRING_encode_aper OCTET_STRING_encode_aper
#ifdef __cplusplus
}
#endif
#endif /* _BIT_STRING_H_ */

View 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 */

491
lib/s1ap3/asn1c/BOOLEAN.c Normal file
View File

@ -0,0 +1,491 @@
/*-
* Copyright (c) 2003, 2005 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 <BOOLEAN.h>
/*
* BOOLEAN basic type description.
*/
static const ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (1 << 2))
};
asn_TYPE_operation_t asn_OP_BOOLEAN = {
BOOLEAN_free,
BOOLEAN_print,
BOOLEAN_compare,
BOOLEAN_decode_ber,
BOOLEAN_encode_der,
BOOLEAN_decode_xer,
BOOLEAN_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
BOOLEAN_decode_oer,
BOOLEAN_encode_oer,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
0,
0,
#else
BOOLEAN_decode_uper, /* Unaligned PER decoder */
BOOLEAN_encode_uper, /* Unaligned PER encoder */
BOOLEAN_decode_aper, /* Aligned PER decoder */
BOOLEAN_encode_aper, /* Aligned PER encoder */
#endif /* ASN_DISABLE_PER_SUPPORT */
BOOLEAN_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
"BOOLEAN",
"BOOLEAN",
&asn_OP_BOOLEAN,
asn_DEF_BOOLEAN_tags,
sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]),
asn_DEF_BOOLEAN_tags, /* Same as above */
sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]),
{ 0, 0, asn_generic_no_constraint },
0, 0, /* No members */
0 /* No specifics */
};
/*
* Decode BOOLEAN type.
*/
asn_dec_rval_t
BOOLEAN_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *td, void **bool_value,
const void *buf_ptr, size_t size, int tag_mode) {
BOOLEAN_t *st = (BOOLEAN_t *)*bool_value;
asn_dec_rval_t rval;
ber_tlv_len_t length;
ber_tlv_len_t lidx;
if(st == NULL) {
st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st)));
if(st == NULL) {
rval.code = RC_FAIL;
rval.consumed = 0;
return rval;
}
}
ASN_DEBUG("Decoding %s as BOOLEAN (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("Boolean length is %d bytes", (int)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;
}
/*
* Compute boolean value.
*/
for(*st = 0, lidx = 0;
(lidx < length) && *st == 0; lidx++) {
/*
* Very simple approach: read bytes until the end or
* value is already TRUE.
* BOOLEAN is not supposed to contain meaningful data anyway.
*/
*st |= ((const uint8_t *)buf_ptr)[lidx];
}
rval.code = RC_OK;
rval.consumed += length;
ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d",
(long)rval.consumed, (long)length,
td->name, *st);
return rval;
}
asn_enc_rval_t
BOOLEAN_encode_der(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;
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key);
if(erval.encoded == -1) {
erval.failed_type = td;
erval.structure_ptr = sptr;
return erval;
}
if(cb) {
uint8_t bool_value;
bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */
if(cb(&bool_value, 1, app_key) < 0) {
erval.encoded = -1;
erval.failed_type = td;
erval.structure_ptr = sptr;
return erval;
}
}
erval.encoded += 1;
ASN__ENCODED_OK(erval);
}
/*
* Decode the chunk of XML text encoding INTEGER.
*/
static enum xer_pbd_rval
BOOLEAN__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
const void *chunk_buf, size_t chunk_size) {
BOOLEAN_t *st = (BOOLEAN_t *)sptr;
const char *p = (const char *)chunk_buf;
(void)td;
if(chunk_size && p[0] == 0x3c /* '<' */) {
switch(xer_check_tag(chunk_buf, chunk_size, "false")) {
case XCT_BOTH:
/* "<false/>" */
*st = 0;
break;
case XCT_UNKNOWN_BO:
if(xer_check_tag(chunk_buf, chunk_size, "true")
!= XCT_BOTH)
return XPBD_BROKEN_ENCODING;
/* "<true/>" */
*st = 1; /* Or 0xff as in DER?.. */
break;
default:
return XPBD_BROKEN_ENCODING;
}
return XPBD_BODY_CONSUMED;
} else {
return XPBD_BROKEN_ENCODING;
}
}
asn_dec_rval_t
BOOLEAN_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) {
return xer_decode_primitive(opt_codec_ctx, td,
sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size,
BOOLEAN__xer_body_decode);
}
asn_enc_rval_t
BOOLEAN_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 BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er = {0, 0, 0};
(void)ilevel;
(void)flags;
if(!st) ASN__ENCODE_FAILED;
if(*st) {
ASN__CALLBACK("<true/>", 7);
} else {
ASN__CALLBACK("<false/>", 8);
}
ASN__ENCODED_OK(er);
cb_failed:
ASN__ENCODE_FAILED;
}
int
BOOLEAN_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
const char *buf;
size_t buflen;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
if(st) {
if(*st) {
buf = "TRUE";
buflen = 4;
} else {
buf = "FALSE";
buflen = 5;
}
} else {
buf = "<absent>";
buflen = 8;
}
return (cb(buf, buflen, app_key) < 0) ? -1 : 0;
}
void
BOOLEAN_free(const asn_TYPE_descriptor_t *td, void *ptr,
enum asn_struct_free_method method) {
if(td && 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(BOOLEAN_t));
break;
}
}
}
#ifndef ASN_DISABLE_PER_SUPPORT
asn_dec_rval_t
BOOLEAN_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) {
asn_dec_rval_t rv;
BOOLEAN_t *st = (BOOLEAN_t *)*sptr;
(void)opt_codec_ctx;
(void)td;
(void)constraints;
if(!st) {
st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st)));
if(!st) ASN__DECODE_FAILED;
}
/*
* Extract a single bit
*/
switch(per_get_few_bits(pd, 1)) {
case 1: *st = 1; break;
case 0: *st = 0; break;
case -1: default: ASN__DECODE_STARVED;
}
ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE");
rv.code = RC_OK;
rv.consumed = 1;
return rv;
}
asn_enc_rval_t
BOOLEAN_encode_uper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, const void *sptr,
asn_per_outp_t *po) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er = { 0, 0, 0 };
(void)constraints;
if(!st) ASN__ENCODE_FAILED;
if(per_put_few_bits(po, *st ? 1 : 0, 1))
ASN__ENCODE_FAILED;
ASN__ENCODED_OK(er);
}
asn_dec_rval_t
BOOLEAN_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) {
asn_dec_rval_t rv;
BOOLEAN_t *st = (BOOLEAN_t *)*sptr;
(void)opt_codec_ctx;
(void)constraints;
(void)td;
if(!st) {
st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st)));
if(!st) ASN__DECODE_FAILED;
}
/*
* Extract a single bit
*/
switch(per_get_few_bits(pd, 1)) {
case 1:
*st = 1;
break;
case 0:
*st = 0;
break;
case -1:
default:
ASN__DECODE_STARVED;
}
ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE");
rv.code = RC_OK;
rv.consumed = 1;
return rv;
}
asn_enc_rval_t
BOOLEAN_encode_aper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints,
const void *sptr, asn_per_outp_t *po) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er;
(void)constraints;
if(!st) ASN__ENCODE_FAILED;
per_put_few_bits(po, *st ? 1 : 0, 1);
ASN__ENCODED_OK(er);
}
#endif /* ASN_DISABLE_PER_SUPPORT */
#ifndef ASN_DISABLE_OER_SUPPORT
/*
* Encode as Canonical OER.
*/
asn_enc_rval_t
BOOLEAN_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 = { 1, 0, 0 };
const BOOLEAN_t *st = sptr;
uint8_t bool_value = *st ? 0xff : 0; /* 0xff mandated by OER */
(void)td;
(void)constraints; /* Constraints are unused in OER */
if(cb(&bool_value, 1, app_key) < 0) {
ASN__ENCODE_FAILED;
} else {
ASN__ENCODED_OK(er);
}
}
asn_dec_rval_t
BOOLEAN_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) {
asn_dec_rval_t ok = {RC_OK, 1};
BOOLEAN_t *st;
(void)opt_codec_ctx;
(void)td;
(void)constraints; /* Constraints are unused in OER */
if(size < 1) {
ASN__DECODE_STARVED;
}
if(!(st = *sptr)) {
st = (BOOLEAN_t *)(*sptr = CALLOC(1, sizeof(*st)));
if(!st) ASN__DECODE_FAILED;
}
*st = *(const uint8_t *)ptr;
return ok;
}
#endif
int
BOOLEAN_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
const void *bptr) {
const BOOLEAN_t *a = aptr;
const BOOLEAN_t *b = bptr;
(void)td;
if(a && b) {
if(!*a == !*b) { /* TRUE can be encoded by any non-zero byte. */
return 0;
} else if(!*a) {
return -1;
} else {
return 1;
}
} else if(!a) {
return -1;
} else {
return 1;
}
}
asn_random_fill_result_t
BOOLEAN_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
const asn_encoding_constraints_t *constraints,
size_t max_length) {
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};
BOOLEAN_t *st = *sptr;
if(max_length == 0) return result_skipped;
if(st == NULL) {
st = (BOOLEAN_t *)(*sptr = CALLOC(1, sizeof(*st)));
if(st == NULL) {
return result_failed;
}
}
if(!constraints || !constraints->per_constraints)
constraints = &td->encoding_constraints;
if(constraints->per_constraints) {
const asn_per_constraint_t *pc = &constraints->per_constraints->value;
if(pc->flags & APC_CONSTRAINED) {
*st = asn_random_between(pc->lower_bound, pc->upper_bound);
return result_ok;
}
}
/* Simulate booleans that are sloppily set and biased. */
switch(asn_random_between(0, 7)) {
case 0:
case 1:
case 2:
*st = 0; break;
case 3: *st = -1; break;
case 4: *st = 1; break;
case 5: *st = INT_MIN; break;
case 6: *st = INT_MAX; break;
default:
*st = asn_random_between(INT_MIN, INT_MAX);
break;
}
return result_ok;
}

45
lib/s1ap3/asn1c/BOOLEAN.h Normal file
View File

@ -0,0 +1,45 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _BOOLEAN_H_
#define _BOOLEAN_H_
#include <asn_application.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The underlying integer may contain various values, but everything
* non-zero is capped to 0xff by the DER encoder. The BER decoder may
* yield non-zero values different from 1, beware.
*/
typedef int BOOLEAN_t;
extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN;
extern asn_TYPE_operation_t asn_OP_BOOLEAN;
asn_struct_free_f BOOLEAN_free;
asn_struct_print_f BOOLEAN_print;
asn_struct_compare_f BOOLEAN_compare;
ber_type_decoder_f BOOLEAN_decode_ber;
der_type_encoder_f BOOLEAN_encode_der;
oer_type_decoder_f BOOLEAN_decode_oer;
oer_type_encoder_f BOOLEAN_encode_oer;
per_type_decoder_f BOOLEAN_decode_uper;
per_type_encoder_f BOOLEAN_encode_uper;
per_type_decoder_f BOOLEAN_decode_aper;
per_type_encoder_f BOOLEAN_encode_aper;
xer_type_decoder_f BOOLEAN_decode_xer;
xer_type_encoder_f BOOLEAN_encode_xer;
asn_random_fill_f BOOLEAN_random_fill;
#define BOOLEAN_constraint asn_generic_no_constraint
#ifdef __cplusplus
}
#endif
#endif /* _BOOLEAN_H_ */

1719
lib/s1ap3/asn1c/INTEGER.c Normal file

File diff suppressed because it is too large Load Diff

108
lib/s1ap3/asn1c/INTEGER.h Normal file
View File

@ -0,0 +1,108 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _INTEGER_H_
#define _INTEGER_H_
#include <asn_application.h>
#include <asn_codecs_prim.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
extern asn_TYPE_descriptor_t asn_DEF_INTEGER;
extern asn_TYPE_operation_t asn_OP_INTEGER;
/* Map with <tag> to integer value association */
typedef struct asn_INTEGER_enum_map_s {
long nat_value; /* associated native integer value */
size_t enum_len; /* strlen("tag") */
const char *enum_name; /* "tag" */
} asn_INTEGER_enum_map_t;
/* This type describes an enumeration for INTEGER and ENUMERATED types */
typedef struct asn_INTEGER_specifics_s {
const asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */
const unsigned int *enum2value; /* "tag" => N; sorted by tag */
int map_count; /* Elements in either map */
int extension; /* This map is extensible */
int strict_enumeration; /* Enumeration set is fixed */
int field_width; /* Size of native integer */
int field_unsigned; /* Signed=0, unsigned=1 */
} asn_INTEGER_specifics_t;
#define INTEGER_free ASN__PRIMITIVE_TYPE_free
#define INTEGER_decode_ber ber_decode_primitive
#define INTEGER_constraint asn_generic_no_constraint
asn_struct_print_f INTEGER_print;
asn_struct_compare_f INTEGER_compare;
der_type_encoder_f INTEGER_encode_der;
xer_type_decoder_f INTEGER_decode_xer;
xer_type_encoder_f INTEGER_encode_xer;
oer_type_decoder_f INTEGER_decode_oer;
oer_type_encoder_f INTEGER_encode_oer;
per_type_decoder_f INTEGER_decode_uper;
per_type_encoder_f INTEGER_encode_uper;
per_type_decoder_f INTEGER_decode_aper;
per_type_encoder_f INTEGER_encode_aper;
asn_random_fill_f INTEGER_random_fill;
/***********************************
* Some handy conversion routines. *
***********************************/
/*
* Natiwe size-independent conversion of native integers to/from INTEGER.
* (l_size) is in bytes.
* Returns 0 if it was possible to convert, -1 otherwise.
* -1/EINVAL: Mandatory argument missing
* -1/ERANGE: Value encoded is out of range for long representation
* -1/ENOMEM: Memory allocation failed (in asn_*2INTEGER()).
*/
int asn_INTEGER2imax(const INTEGER_t *i, intmax_t *l);
int asn_INTEGER2umax(const INTEGER_t *i, uintmax_t *l);
int asn_imax2INTEGER(INTEGER_t *i, intmax_t l);
int asn_umax2INTEGER(INTEGER_t *i, uintmax_t l);
/*
* Size-specific conversion helpers.
*/
int asn_INTEGER2long(const INTEGER_t *i, long *l);
int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
int asn_long2INTEGER(INTEGER_t *i, long l);
int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);
int asn_int642INTEGER(INTEGER_t *i, int64_t l);
int asn_uint642INTEGER(INTEGER_t *i, uint64_t l);
/* A version of strtol/strtoimax(3) with nicer error reporting. */
enum asn_strtox_result_e {
ASN_STRTOX_ERROR_RANGE = -3, /* Input outside of supported numeric range */
ASN_STRTOX_ERROR_INVAL = -2, /* Invalid data encountered (e.g., "+-") */
ASN_STRTOX_EXPECT_MORE = -1, /* More data expected (e.g. "+") */
ASN_STRTOX_OK = 0, /* Conversion succeded, number ends at (*end) */
ASN_STRTOX_EXTRA_DATA = 1 /* Conversion succeded, but the string has extra stuff */
};
enum asn_strtox_result_e asn_strtol_lim(const char *str, const char **end,
long *l);
enum asn_strtox_result_e asn_strtoul_lim(const char *str, const char **end,
unsigned long *l);
enum asn_strtox_result_e asn_strtoimax_lim(const char *str, const char **end,
intmax_t *l);
enum asn_strtox_result_e asn_strtoumax_lim(const char *str, const char **end,
uintmax_t *l);
/*
* Convert the integer value into the corresponding enumeration map entry.
*/
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(
const asn_INTEGER_specifics_t *specs, long value);
#ifdef __cplusplus
}
#endif
#endif /* _INTEGER_H_ */

View 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;
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 */

1159
lib/s1ap3/asn1c/Makefile.am Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

299
lib/s1ap3/asn1c/NULL.c Normal file
View File

@ -0,0 +1,299 @@
/*-
* Copyright (c) 2003, 2005 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 <NULL.h>
#include <BOOLEAN.h> /* Implemented in terms of BOOLEAN type */
/*
* NULL basic type description.
*/
static const ber_tlv_tag_t asn_DEF_NULL_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (5 << 2))
};
asn_TYPE_operation_t asn_OP_NULL = {
BOOLEAN_free,
NULL_print,
NULL_compare,
BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */
NULL_encode_der, /* Special handling of DER encoding */
NULL_decode_xer,
NULL_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
NULL_decode_oer,
NULL_encode_oer,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
0,
0,
0,
#else
NULL_decode_uper, /* Unaligned PER decoder */
NULL_encode_uper, /* Unaligned PER encoder */
NULL_decode_aper, /* Aligned PER decoder */
NULL_encode_aper, /* Aligned PER encoder */
#endif /* ASN_DISABLE_PER_SUPPORT */
NULL_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_NULL = {
"NULL",
"NULL",
&asn_OP_NULL,
asn_DEF_NULL_tags,
sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
asn_DEF_NULL_tags, /* Same as above */
sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]),
{ 0, 0, asn_generic_no_constraint },
0, 0, /* No members */
0 /* No specifics */
};
asn_enc_rval_t
NULL_encode_der(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode,
ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t erval;
erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key);
if(erval.encoded == -1) {
erval.failed_type = td;
erval.structure_ptr = ptr;
}
ASN__ENCODED_OK(erval);
}
asn_enc_rval_t
NULL_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;
(void)td;
(void)sptr;
(void)ilevel;
(void)flags;
(void)cb;
(void)app_key;
/* XMLNullValue is empty */
er.encoded = 0;
ASN__ENCODED_OK(er);
}
static enum xer_pbd_rval
NULL__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
const void *chunk_buf, size_t chunk_size) {
(void)td;
(void)sptr;
(void)chunk_buf; /* Going to be empty according to the rules below. */
/*
* There must be no content in self-terminating <NULL/> tag.
*/
if(chunk_size)
return XPBD_BROKEN_ENCODING;
else
return XPBD_BODY_CONSUMED;
}
asn_dec_rval_t
NULL_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) {
return xer_decode_primitive(opt_codec_ctx, td,
sptr, sizeof(NULL_t), opt_mname, buf_ptr, size,
NULL__xer_body_decode);
}
int
NULL_compare(const asn_TYPE_descriptor_t *td, const void *a, const void *b) {
(void)td;
(void)a;
(void)b;
return 0;
}
int
NULL_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
if(sptr) {
return (cb("<present>", 9, app_key) < 0) ? -1 : 0;
} else {
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
}
}
#ifndef ASN_DISABLE_OER_SUPPORT
asn_dec_rval_t
NULL_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) {
asn_dec_rval_t rv = {RC_OK, 0};
(void)opt_codec_ctx;
(void)td;
(void)constraints;
(void)ptr;
(void)size;
if(!*sptr) {
*sptr = MALLOC(sizeof(NULL_t));
if(*sptr) {
*(NULL_t *)*sptr = 0;
} else {
ASN__DECODE_FAILED;
}
}
return rv;
}
asn_enc_rval_t
NULL_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;
(void)td;
(void)sptr;
(void)constraints;
(void)cb;
(void)app_key;
er.encoded = 0; /* Encoding in 0 bytes. */
ASN__ENCODED_OK(er);
}
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifndef ASN_DISABLE_PER_SUPPORT
asn_dec_rval_t
NULL_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) {
asn_dec_rval_t rv;
(void)opt_codec_ctx;
(void)td;
(void)constraints;
(void)pd;
if(!*sptr) {
*sptr = MALLOC(sizeof(NULL_t));
if(*sptr) {
*(NULL_t *)*sptr = 0;
} else {
ASN__DECODE_FAILED;
}
}
/*
* NULL type does not have content octets.
*/
rv.code = RC_OK;
rv.consumed = 0;
return rv;
}
asn_enc_rval_t
NULL_encode_uper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, const void *sptr,
asn_per_outp_t *po) {
asn_enc_rval_t er;
(void)td;
(void)constraints;
(void)sptr;
(void)po;
er.encoded = 0;
ASN__ENCODED_OK(er);
}
asn_dec_rval_t
NULL_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) {
asn_dec_rval_t rv;
(void)opt_codec_ctx;
(void)td;
(void)constraints;
(void)pd;
if(!*sptr) {
*sptr = MALLOC(sizeof(NULL_t));
if(*sptr) {
*(NULL_t *)*sptr = 0;
} else {
ASN__DECODE_FAILED;
}
}
/*
* NULL type does not have content octets.
*/
rv.code = RC_OK;
rv.consumed = 0;
return rv;
}
asn_enc_rval_t
NULL_encode_aper(const asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints,
const void *sptr, asn_per_outp_t *po) {
asn_enc_rval_t er;
(void)td;
(void)constraints;
(void)sptr;
(void)po;
er.encoded = 0;
ASN__ENCODED_OK(er);
}
#endif /* ASN_DISABLE_PER_SUPPORT */
asn_random_fill_result_t
NULL_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
const asn_encoding_constraints_t *constr,
size_t max_length) {
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};
NULL_t *st = *sptr;
(void)td;
(void)constr;
if(max_length == 0) return result_skipped;
if(st == NULL) {
st = (NULL_t *)(*sptr = CALLOC(1, sizeof(*st)));
if(st == NULL) {
return result_failed;
}
}
return result_ok;
}

45
lib/s1ap3/asn1c/NULL.h Normal file
View File

@ -0,0 +1,45 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN_TYPE_NULL_H
#define ASN_TYPE_NULL_H
#include <asn_application.h>
#include <BOOLEAN.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The value of the NULL type is meaningless: see BOOLEAN if you want to
* carry true/false semantics.
*/
typedef int NULL_t;
extern asn_TYPE_descriptor_t asn_DEF_NULL;
extern asn_TYPE_operation_t asn_OP_NULL;
asn_struct_print_f NULL_print;
asn_struct_compare_f NULL_compare;
der_type_encoder_f NULL_encode_der;
xer_type_decoder_f NULL_decode_xer;
xer_type_encoder_f NULL_encode_xer;
oer_type_decoder_f NULL_decode_oer;
oer_type_encoder_f NULL_encode_oer;
per_type_decoder_f NULL_decode_uper;
per_type_encoder_f NULL_encode_uper;
per_type_decoder_f NULL_decode_aper;
per_type_encoder_f NULL_encode_aper;
asn_random_fill_f NULL_random_fill;
#define NULL_free BOOLEAN_free
#define NULL_decode_ber BOOLEAN_decode_ber
#define NULL_constraint asn_generic_no_constraint
#ifdef __cplusplus
}
#endif
#endif /* NULL_H */

View 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;
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;
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->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;
long native, value;
const asn_per_constraint_t *ct;
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->range_bits >= 0) {
int cmpWith = specs->extension
? specs->extension - 1 : specs->map_count;
if(value >= cmpWith)
inext = 1;
}
if(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;
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->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;
long native, value;
const asn_per_constraint_t *ct;
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->range_bits >= 0) {
int cmpWith = specs->extension
? specs->extension - 1 : specs->map_count;
if(value >= cmpWith)
inext = 1;
}
if(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);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
/*
* This type differs from the standard ENUMERATED in that it is modelled using
* the fixed machine type (long, int, short), so it can hold only values of
* limited length. There is no type (i.e., NativeEnumerated_t, any integer type
* will do).
* This type may be used when integer range is limited by subtype constraints.
*/
#ifndef _NativeEnumerated_H_
#define _NativeEnumerated_H_
#include <NativeInteger.h>
#ifdef __cplusplus
extern "C" {
#endif
extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated;
extern asn_TYPE_operation_t asn_OP_NativeEnumerated;
xer_type_encoder_f NativeEnumerated_encode_xer;
oer_type_decoder_f NativeEnumerated_decode_oer;
oer_type_encoder_f NativeEnumerated_encode_oer;
per_type_decoder_f NativeEnumerated_decode_uper;
per_type_encoder_f NativeEnumerated_encode_uper;
per_type_decoder_f NativeEnumerated_decode_aper;
per_type_encoder_f NativeEnumerated_encode_aper;
#define NativeEnumerated_free NativeInteger_free
#define NativeEnumerated_print NativeInteger_print
#define NativeEnumerated_compare NativeInteger_compare
#define NativeEnumerated_random_fill NativeInteger_random_fill
#define NativeEnumerated_constraint asn_generic_no_constraint
#define NativeEnumerated_decode_ber NativeInteger_decode_ber
#define NativeEnumerated_encode_der NativeInteger_encode_der
#define NativeEnumerated_decode_xer NativeInteger_decode_xer
#ifdef __cplusplus
}
#endif
#endif /* _NativeEnumerated_H_ */

View 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;
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 */

View 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;
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;
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;
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;
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;
}

View File

@ -0,0 +1,46 @@
/*-
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
/*
* This type differs from the standard INTEGER in that it is modelled using
* the fixed machine type (long, int, short), so it can hold only values of
* limited length. There is no type (i.e., NativeInteger_t, any integer type
* will do).
* This type may be used when integer range is limited by subtype constraints.
*/
#ifndef _NativeInteger_H_
#define _NativeInteger_H_
#include <asn_application.h>
#include <INTEGER.h>
#ifdef __cplusplus
extern "C" {
#endif
extern asn_TYPE_descriptor_t asn_DEF_NativeInteger;
extern asn_TYPE_operation_t asn_OP_NativeInteger;
asn_struct_free_f NativeInteger_free;
asn_struct_print_f NativeInteger_print;
asn_struct_compare_f NativeInteger_compare;
ber_type_decoder_f NativeInteger_decode_ber;
der_type_encoder_f NativeInteger_encode_der;
xer_type_decoder_f NativeInteger_decode_xer;
xer_type_encoder_f NativeInteger_encode_xer;
oer_type_decoder_f NativeInteger_decode_oer;
oer_type_encoder_f NativeInteger_encode_oer;
per_type_decoder_f NativeInteger_decode_uper;
per_type_encoder_f NativeInteger_encode_uper;
per_type_decoder_f NativeInteger_decode_aper;
per_type_encoder_f NativeInteger_encode_aper;
asn_random_fill_f NativeInteger_random_fill;
#define NativeInteger_constraint asn_generic_no_constraint
#ifdef __cplusplus
}
#endif
#endif /* _NativeInteger_H_ */

View 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 */

View File

@ -0,0 +1,647 @@
/*-
* 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 <INTEGER.h>
#include <OBJECT_IDENTIFIER.h>
#include <OCTET_STRING.h>
#include <limits.h> /* for CHAR_BIT */
#include <errno.h>
/*
* OBJECT IDENTIFIER basic type description.
*/
static const ber_tlv_tag_t asn_DEF_OBJECT_IDENTIFIER_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2))
};
asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = {
ASN__PRIMITIVE_TYPE_free,
OBJECT_IDENTIFIER_print,
OCTET_STRING_compare, /* Implemented in terms of a string comparison */
ber_decode_primitive,
der_encode_primitive,
OBJECT_IDENTIFIER_decode_xer,
OBJECT_IDENTIFIER_encode_xer,
#ifdef ASN_DISABLE_OER_SUPPORT
0,
0,
#else
OBJECT_IDENTIFIER_decode_oer,
OBJECT_IDENTIFIER_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 */
OBJECT_IDENTIFIER_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = {
"OBJECT IDENTIFIER",
"OBJECT_IDENTIFIER",
&asn_OP_OBJECT_IDENTIFIER,
asn_DEF_OBJECT_IDENTIFIER_tags,
sizeof(asn_DEF_OBJECT_IDENTIFIER_tags)
/ sizeof(asn_DEF_OBJECT_IDENTIFIER_tags[0]),
asn_DEF_OBJECT_IDENTIFIER_tags, /* Same as above */
sizeof(asn_DEF_OBJECT_IDENTIFIER_tags)
/ sizeof(asn_DEF_OBJECT_IDENTIFIER_tags[0]),
{ 0, 0, OBJECT_IDENTIFIER_constraint },
0, 0, /* No members */
0 /* No specifics */
};
int
OBJECT_IDENTIFIER_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb,
void *app_key) {
const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
if(st && st->buf) {
if(st->size < 1) {
ASN__CTFAIL(app_key, td, sptr,
"%s: at least one numerical value "
"expected (%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 ssize_t
OBJECT_IDENTIFIER_get_first_arcs(const uint8_t *arcbuf, size_t arcbuf_len,
asn_oid_arc_t *arc0, asn_oid_arc_t *arc1) {
asn_oid_arc_t value;
ssize_t rd = OBJECT_IDENTIFIER_get_single_arc(arcbuf, arcbuf_len, &value);
if(rd <= 0) return rd;
if(value >= 80) {
*arc0 = 2;
*arc1 = value - 80;
} else if(value >= 40) {
*arc0 = 1;
*arc1 = value - 40;
} else {
*arc0 = 0;
*arc1 = value;
}
return rd;
}
ssize_t
OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, size_t arcbuf_len,
asn_oid_arc_t *ret_value) {
const uint8_t *b = arcbuf;
const uint8_t *arcend = arcbuf + arcbuf_len; /* End of arc */
if(arcbuf == arcend) {
return 0;
} else {
asn_oid_arc_t accum;
/* Gather all bits into the accumulator */
for(accum = 0; b < arcend; b++) {
accum = (accum << 7) | (*b & ~0x80);
if((*b & 0x80) == 0) {
if(accum <= ASN_OID_ARC_MAX) {
*ret_value = accum;
return 1 + (b - arcbuf);
} else {
errno = ERANGE; /* Overflow */
return -1;
}
}
}
errno = EINVAL;
return -1;
}
}
static ssize_t
OBJECT_IDENTIFIER__dump_body(const OBJECT_IDENTIFIER_t *st,
asn_app_consume_bytes_f *cb, void *app_key) {
char scratch[32];
asn_oid_arc_t arc0, arc1;
size_t produced = 0;
size_t off = 0;
ssize_t rd;
int ret;
rd = OBJECT_IDENTIFIER_get_first_arcs(st->buf, st->size, &arc0, &arc1);
if(rd <= 0) {
return -1;
}
ret = snprintf(scratch, sizeof(scratch), "%"PRIu32".%"PRIu32, arc0, arc1);
if(ret >= (ssize_t)sizeof(scratch)) {
return -1;
}
produced += ret;
if(cb(scratch, ret, app_key) < 0)
return -1;
for(off = rd; ; ) {
asn_oid_arc_t arc;
rd = OBJECT_IDENTIFIER_get_single_arc(st->buf + off, st->size - off,
&arc);
if(rd < 0) {
return -1;
} else if(rd == 0) {
/* No more arcs. */
break;
} else {
off += rd;
assert(off <= st->size);
ret = snprintf(scratch, sizeof(scratch), ".%" PRIu32, arc);
if(ret >= (ssize_t)sizeof(scratch)) {
return -1;
}
produced += ret;
if(cb(scratch, ret, app_key) < 0) return -1;
}
}
if(off != st->size) {
ASN_DEBUG("Could not scan to the end of Object Identifier");
return -1;
}
return produced;
}
static enum xer_pbd_rval
OBJECT_IDENTIFIER__xer_body_decode(const asn_TYPE_descriptor_t *td, void *sptr,
const void *chunk_buf, size_t chunk_size) {
OBJECT_IDENTIFIER_t *st = (OBJECT_IDENTIFIER_t *)sptr;
const char *chunk_end = (const char *)chunk_buf + chunk_size;
const char *endptr;
asn_oid_arc_t s_arcs[10];
asn_oid_arc_t *arcs = s_arcs;
ssize_t num_arcs;
ssize_t ret;
(void)td;
num_arcs = OBJECT_IDENTIFIER_parse_arcs(
(const char *)chunk_buf, chunk_size, arcs,
sizeof(s_arcs) / sizeof(s_arcs[0]), &endptr);
if(num_arcs < 0) {
/* Expecting more than zero arcs */
return XPBD_BROKEN_ENCODING;
} else if(num_arcs == 0) {
return XPBD_NOT_BODY_IGNORE;
}
assert(endptr == chunk_end);
if((size_t)num_arcs > sizeof(s_arcs)/sizeof(s_arcs[0])) {
arcs = (asn_oid_arc_t *)MALLOC(num_arcs * sizeof(asn_oid_arc_t));
if(!arcs) return XPBD_SYSTEM_FAILURE;
ret = OBJECT_IDENTIFIER_parse_arcs((const char *)chunk_buf, chunk_size,
arcs, num_arcs, &endptr);
if(ret != num_arcs)
return XPBD_SYSTEM_FAILURE; /* assert?.. */
}
/*
* Convert arcs into BER representation.
*/
ret = OBJECT_IDENTIFIER_set_arcs(st, arcs, num_arcs);
if(arcs != s_arcs) FREEMEM(arcs);
return ret ? XPBD_SYSTEM_FAILURE : XPBD_BODY_CONSUMED;
}
asn_dec_rval_t
OBJECT_IDENTIFIER_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) {
return xer_decode_primitive(opt_codec_ctx, td,
sptr, sizeof(OBJECT_IDENTIFIER_t), opt_mname,
buf_ptr, size, OBJECT_IDENTIFIER__xer_body_decode);
}
asn_enc_rval_t
OBJECT_IDENTIFIER_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 OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
asn_enc_rval_t er;
(void)ilevel;
(void)flags;
if(!st || !st->buf) {
ASN__ENCODE_FAILED;
}
er.encoded = OBJECT_IDENTIFIER__dump_body(st, cb, app_key);
if(er.encoded < 0) ASN__ENCODE_FAILED;
ASN__ENCODED_OK(er);
}
int
OBJECT_IDENTIFIER_print(const asn_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb,
void *app_key) {
const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
if(!st || !st->buf)
return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
/* Dump preamble */
if(cb("{ ", 2, app_key) < 0)
return -1;
if(OBJECT_IDENTIFIER__dump_body(st, cb, app_key) < 0) {
return -1;
}
return (cb(" }", 2, app_key) < 0) ? -1 : 0;
}
ssize_t
OBJECT_IDENTIFIER_get_arcs(const OBJECT_IDENTIFIER_t *st, asn_oid_arc_t *arcs,
size_t arc_slots) {
asn_oid_arc_t arc0, arc1;
size_t num_arcs = 0;
size_t off;
ssize_t rd;
if(!st || !st->buf) {
errno = EINVAL;
return -1;
}
rd = OBJECT_IDENTIFIER_get_first_arcs(st->buf, st->size, &arc0, &arc1);
if(rd <= 0) {
return -1;
}
num_arcs = 2;
switch(arc_slots) {
default:
case 2:
arcs[1] = arc1;
/* Fall through */
case 1:
arcs[0] = arc0;
/* Fall through */
case 0:
break;
}
for(off = rd; ; ) {
asn_oid_arc_t arc;
rd = OBJECT_IDENTIFIER_get_single_arc(st->buf + off, st->size - off,
&arc);
if(rd < 0) {
return -1;
} else if(rd == 0) {
/* No more arcs. */
break;
} else {
off += rd;
if(num_arcs < arc_slots) {
arcs[num_arcs] = arc;
}
num_arcs++;
}
}
if(off != st->size) {
return -1;
}
return num_arcs;
}
/*
* Save the single value as an object identifier arc.
*/
ssize_t
OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, size_t arcbuf_len,
asn_oid_arc_t value) {
/*
* The following conditions must hold:
* assert(arcbuf);
*/
uint8_t scratch[((sizeof(value) * CHAR_BIT + 6) / 7)];
uint8_t *scratch_end = &scratch[sizeof(scratch)-1];
uint8_t *b;
size_t result_len;
uint8_t mask;
for(b = scratch_end, mask = 0; ; mask = 0x80, b--) {
*b = mask | (value & 0x7f);
value >>= 7;
if(!value) {
break;
}
}
result_len = (scratch_end - b) + 1;
if(result_len > arcbuf_len) {
return -1;
}
memcpy(arcbuf, b, result_len);
return result_len;
}
int
OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *st, const asn_oid_arc_t *arcs,
size_t arc_slots) {
uint8_t *buf;
uint8_t *bp;
ssize_t wrote;
asn_oid_arc_t arc0;
asn_oid_arc_t arc1;
size_t size;
size_t i;
if(!st || !arcs || arc_slots < 2) {
errno = EINVAL;
return -1;
}
arc0 = arcs[0];
arc1 = arcs[1];
if(arc0 <= 1) {
if(arc1 >= 40) {
/* 8.19.4: At most 39 subsequent values (including 0) */
errno = ERANGE;
return -1;
}
} else if(arc0 == 2) {
if(arc1 > ASN_OID_ARC_MAX - 80) {
errno = ERANGE;
return -1;
}
} else if(arc0 > 2) {
/* 8.19.4: Only three values are allocated from the root node */
errno = ERANGE;
return -1;
}
/*
* After above tests it is known that the value of arc0 is completely
* trustworthy (0..2). However, the arc1's value is still meaningless.
*/
/*
* Roughly estimate the maximum size necessary to encode these arcs.
* This estimation implicitly takes in account the following facts,
* that cancel each other:
* * the first two arcs are encoded in a single value.
* * the first value may require more space (+1 byte)
* * the value of the first arc which is in range (0..2)
*/
size = ((sizeof(asn_oid_arc_t) * CHAR_BIT + 6) / 7) * arc_slots;
bp = buf = (uint8_t *)MALLOC(size + 1);
if(!buf) {
/* ENOMEM */
return -1;
}
wrote = OBJECT_IDENTIFIER_set_single_arc(bp, size, arc0 * 40 + arc1);
if(wrote <= 0) {
FREEMEM(buf);
return -1;
}
assert((size_t)wrote <= size);
bp += wrote;
size -= wrote;
for(i = 2; i < arc_slots; i++) {
wrote = OBJECT_IDENTIFIER_set_single_arc(bp, size, arcs[i]);
if(wrote <= 0) {
FREEMEM(buf);
return -1;
}
assert((size_t)wrote <= size);
bp += wrote;
size -= wrote;
}
/*
* Replace buffer.
*/
st->size = bp - buf;
bp = st->buf;
st->buf = buf;
st->buf[st->size] = '\0';
if(bp) FREEMEM(bp);
return 0;
}
ssize_t
OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length,
asn_oid_arc_t *arcs, size_t arcs_count,
const char **opt_oid_text_end) {
size_t num_arcs = 0;
const char *oid_end;
enum {
ST_LEADSPACE,
ST_TAILSPACE,
ST_AFTERVALUE, /* Next character ought to be '.' or a space */
ST_WAITDIGITS /* Next character is expected to be a digit */
} state = ST_LEADSPACE;
if(!oid_text || oid_txt_length < -1 || (arcs_count && !arcs)) {
if(opt_oid_text_end) *opt_oid_text_end = oid_text;
errno = EINVAL;
return -1;
}
if(oid_txt_length == -1)
oid_txt_length = strlen(oid_text);
#define _OID_CAPTURE_ARC(oid_text, oid_end) \
do { \
const char *endp = oid_end; \
unsigned long value; \
switch(asn_strtoul_lim(oid_text, &endp, &value)) { \
case ASN_STRTOX_EXTRA_DATA: \
case ASN_STRTOX_OK: \
if(value <= ASN_OID_ARC_MAX) { \
if(num_arcs < arcs_count) arcs[num_arcs] = value; \
num_arcs++; \
oid_text = endp - 1; \
break; \
} \
/* Fall through */ \
case ASN_STRTOX_ERROR_RANGE: \
if(opt_oid_text_end) *opt_oid_text_end = oid_text; \
errno = ERANGE; \
return -1; \
case ASN_STRTOX_ERROR_INVAL: \
case ASN_STRTOX_EXPECT_MORE: \
if(opt_oid_text_end) *opt_oid_text_end = oid_text; \
errno = EINVAL; \
return -1; \
} \
} while(0)
for(oid_end = oid_text + oid_txt_length; oid_text<oid_end; oid_text++) {
switch(*oid_text) {
case 0x09: case 0x0a: case 0x0d: case 0x20: /* whitespace */
switch(state) {
case ST_LEADSPACE:
case ST_TAILSPACE:
continue;
case ST_AFTERVALUE:
state = ST_TAILSPACE;
continue;
case ST_WAITDIGITS:
break; /* Digits expected after ".", got whitespace */
}
break;
case 0x2e: /* '.' */
switch(state) {
case ST_LEADSPACE:
case ST_TAILSPACE:
case ST_WAITDIGITS:
if(opt_oid_text_end)
*opt_oid_text_end = oid_text;
errno = EINVAL; /* Broken OID */
return -1;
break;
case ST_AFTERVALUE:
state = ST_WAITDIGITS;
continue;
}
break;
case 0x30: case 0x31: case 0x32: case 0x33: case 0x34:
case 0x35: case 0x36: case 0x37: case 0x38: case 0x39:
switch(state) {
case ST_TAILSPACE:
case ST_AFTERVALUE:
if(opt_oid_text_end)
*opt_oid_text_end = oid_text;
errno = EINVAL; /* "1. 1" => broken OID */
return -1;
case ST_LEADSPACE:
case ST_WAITDIGITS:
_OID_CAPTURE_ARC(oid_text, oid_end);
state = ST_AFTERVALUE;
continue;
}
break;
default:
/* Unexpected symbols */
state = ST_WAITDIGITS;
break;
} /* switch() */
break;
} /* for() */
if(opt_oid_text_end) *opt_oid_text_end = oid_text;
/* Finalize last arc */
switch(state) {
case ST_LEADSPACE:
return 0; /* No OID found in input data */
case ST_WAITDIGITS:
errno = EINVAL; /* Broken OID */
return -1;
case ST_AFTERVALUE:
case ST_TAILSPACE:
return num_arcs;
}
errno = EINVAL; /* Broken OID */
return -1;
}
/*
* Generate values from the list of interesting values, or just a random
* value up to the upper limit.
*/
static asn_oid_arc_t
OBJECT_IDENTIFIER__biased_random_arc(asn_oid_arc_t upper_bound) {
const asn_oid_arc_t values[] = {0, 1, 127, 128, 129, 254, 255, 256};
size_t idx;
switch(asn_random_between(0, 2)) {
case 0:
idx = asn_random_between(0, sizeof(values) / sizeof(values[0]) - 1);
if(values[idx] < upper_bound) {
return values[idx];
}
/* Fall through */
case 1:
return asn_random_between(0, upper_bound);
case 2:
default:
return upper_bound;
}
}
asn_random_fill_result_t
OBJECT_IDENTIFIER_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
const asn_encoding_constraints_t *constraints,
size_t max_length) {
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};
OBJECT_IDENTIFIER_t *st;
asn_oid_arc_t arcs[5];
size_t arcs_len = asn_random_between(2, 5);
size_t i;
(void)constraints;
if(max_length < arcs_len) return result_skipped;
if(*sptr) {
st = *sptr;
} else {
st = CALLOC(1, sizeof(*st));
}
arcs[0] = asn_random_between(0, 2);
arcs[1] = OBJECT_IDENTIFIER__biased_random_arc(
arcs[0] <= 1 ? 39 : (ASN_OID_ARC_MAX - 80));
for(i = 2; i < arcs_len; i++) {
arcs[i] = OBJECT_IDENTIFIER__biased_random_arc(ASN_OID_ARC_MAX);
}
if(OBJECT_IDENTIFIER_set_arcs(st, arcs, arcs_len)) {
if(st != *sptr) {
ASN_STRUCT_FREE(*td, st);
}
return result_failed;
}
*sptr = st;
result_ok.length = st->size;
return result_ok;
}

View File

@ -0,0 +1,156 @@
/*
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _OBJECT_IDENTIFIER_H_
#define _OBJECT_IDENTIFIER_H_
#include <asn_application.h>
#include <asn_codecs_prim.h>
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint32_t asn_oid_arc_t;
#define ASN_OID_ARC_MAX (~((asn_oid_arc_t)0))
typedef ASN__PRIMITIVE_TYPE_t OBJECT_IDENTIFIER_t;
extern asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER;
extern asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER;
asn_struct_print_f OBJECT_IDENTIFIER_print;
asn_constr_check_f OBJECT_IDENTIFIER_constraint;
der_type_encoder_f OBJECT_IDENTIFIER_encode_der;
xer_type_decoder_f OBJECT_IDENTIFIER_decode_xer;
xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer;
asn_random_fill_f OBJECT_IDENTIFIER_random_fill;
#define OBJECT_IDENTIFIER_free ASN__PRIMITIVE_TYPE_free
#define OBJECT_IDENTIFIER_compare OCTET_STRING_compare
#define OBJECT_IDENTIFIER_decode_ber ber_decode_primitive
#define OBJECT_IDENTIFIER_encode_der der_encode_primitive
#define OBJECT_IDENTIFIER_decode_oer oer_decode_primitive
#define OBJECT_IDENTIFIER_encode_oer oer_encode_primitive
#define OBJECT_IDENTIFIER_decode_uper OCTET_STRING_decode_uper
#define OBJECT_IDENTIFIER_encode_uper OCTET_STRING_encode_uper
#define OBJECT_IDENTIFIER_decode_aper OCTET_STRING_decode_aper
#define OBJECT_IDENTIFIER_encode_aper OCTET_STRING_encode_aper
/**********************************
* Some handy conversion routines *
**********************************/
/*
* This function fills an (arcs) array with OBJECT IDENTIFIER arcs
* up to specified (arc_slots) elements.
*
* EXAMPLE:
* void print_arcs(OBJECT_IDENTIFIER_t *oid) {
* asn_oid_arc_t fixed_arcs[10]; // Try with fixed space first
* asn_oid_arc_t *arcs = fixed_arcs;
* size_t arc_slots = sizeof(fixed_arcs)/sizeof(fixed_arcs[0]); // 10
* ssize_t count; // Real number of arcs.
* int i;
*
* count = OBJECT_IDENTIFIER_get_arcs(oid, arcs, arc_slots);
* // If necessary, reallocate arcs array and try again.
* if(count > arc_slots) {
* arc_slots = count;
* arcs = malloc(sizeof(asn_oid_arc_t) * arc_slots);
* if(!arcs) return;
* count = OBJECT_IDENTIFIER_get_arcs(oid, arcs, arc_slots);
* assert(count == arc_slots);
* }
*
* // Print the contents of the arcs array.
* for(i = 0; i < count; i++)
* printf("%"PRIu32"\n", arcs[i]);
*
* // Avoid memory leak.
* if(arcs != fixed_arcs) free(arcs);
* }
*
* RETURN VALUES:
* -1/EINVAL: Invalid arguments (oid is missing)
* -1/ERANGE: One or more arcs have value out of array cell type range.
* >=0: Number of arcs contained in the OBJECT IDENTIFIER
*
* WARNING: The function always returns the actual number of arcs,
* even if there is no sufficient (arc_slots) provided.
*/
ssize_t OBJECT_IDENTIFIER_get_arcs(const OBJECT_IDENTIFIER_t *oid,
asn_oid_arc_t *arcs, size_t arc_slots);
/*
* This functions initializes the OBJECT IDENTIFIER object with
* the given set of arcs.
* The minimum of two arcs must be present; some restrictions apply.
* RETURN VALUES:
* -1/EINVAL: Invalid arguments
* -1/ERANGE: The first two arcs do not conform to ASN.1 restrictions.
* -1/ENOMEM: Memory allocation failed
* 0: The object was initialized with new arcs.
*/
int OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *oid,
const asn_oid_arc_t *arcs, size_t arcs_count);
/*
* Parse the OBJECT IDENTIFIER textual representation ("1.3.6.1.4.1.9363").
* No arc can exceed the (0..ASN_OID_ARC_MAX, which is the same as UINT32_MAX).
* This function is not specific to OBJECT IDENTIFIER, it may be used to parse
* the RELATIVE-OID data, or any other data consisting of dot-separated
* series of numeric values.
*
* If (oid_txt_length == -1), the strlen() will be invoked to determine the
* size of the (oid_text) string.
*
* After return, the optional (opt_oid_text_end) is set to the character after
* the last parsed one. (opt_oid_text_end) is never less than (oid_text).
*
* RETURN VALUES:
* -1: Parse error.
* >= 0: Number of arcs contained in the OBJECT IDENTIFIER.
*
* WARNING: The function always returns the real number of arcs,
* even if there is no sufficient (arc_slots) provided.
* This is useful for (arc_slots) value estimation.
*/
ssize_t OBJECT_IDENTIFIER_parse_arcs(const char *oid_text,
ssize_t oid_txt_length,
asn_oid_arc_t *arcs, size_t arcs_count,
const char **opt_oid_text_end);
/*
* Internal functions.
* Used by RELATIVE-OID implementation in particular.
*/
/*
* Retrieve a single arc of size from the (arcbuf) buffer.
* RETURN VALUES:
* -1: Failed to retrieve the value from the (arcbuf).
* >0: Number of bytes consumed from the (arcbuf), <= (arcbuf_len).
*/
ssize_t OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf,
size_t arcbuf_len,
asn_oid_arc_t *ret_value);
/*
* Write the unterminated arc value into the (arcbuf) which has the size at
* least (arcbuf_len).
* RETURN VALUES:
* -1: (arcbuf_len) size is not sufficient to write the value.
* <n>: Number of bytes appended to the arcbuf (<= arcbuf_len).
*/
ssize_t OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, size_t arcbuf_len,
asn_oid_arc_t arc_value);
#ifdef __cplusplus
}
#endif
#endif /* _OBJECT_IDENTIFIER_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _OCTET_STRING_H_
#define _OCTET_STRING_H_
#include <asn_application.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OCTET_STRING {
uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */
size_t size; /* Size of the buffer */
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} OCTET_STRING_t;
extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING;
extern asn_TYPE_operation_t asn_OP_OCTET_STRING;
asn_struct_free_f OCTET_STRING_free;
asn_struct_print_f OCTET_STRING_print;
asn_struct_print_f OCTET_STRING_print_utf8;
asn_struct_compare_f OCTET_STRING_compare;
ber_type_decoder_f OCTET_STRING_decode_ber;
der_type_encoder_f OCTET_STRING_encode_der;
xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */
xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */
xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */
xer_type_encoder_f OCTET_STRING_encode_xer;
xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
oer_type_decoder_f OCTET_STRING_decode_oer;
oer_type_encoder_f OCTET_STRING_encode_oer;
per_type_decoder_f OCTET_STRING_decode_uper;
per_type_encoder_f OCTET_STRING_encode_uper;
per_type_decoder_f OCTET_STRING_decode_aper;
per_type_encoder_f OCTET_STRING_encode_aper;
asn_random_fill_f OCTET_STRING_random_fill;
#define OCTET_STRING_constraint asn_generic_no_constraint
#define OCTET_STRING_decode_xer OCTET_STRING_decode_xer_hex
/******************************
* Handy conversion routines. *
******************************/
/*
* This function clears the previous value of the OCTET STRING (if any)
* and then allocates a new memory with the specified content (str/size).
* If size = -1, the size of the original string will be determined
* using strlen(str).
* If str equals to NULL, the function will silently clear the
* current contents of the OCTET STRING.
* Returns 0 if it was possible to perform operation, -1 otherwise.
*/
int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size);
/* Handy conversion from the C string into the OCTET STRING. */
#define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1)
/*
* Allocate and fill the new OCTET STRING and return a pointer to the newly
* allocated object. NULL is permitted in str: the function will just allocate
* empty OCTET STRING.
*/
OCTET_STRING_t *OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td,
const char *str, int size);
/****************************
* Internally useful stuff. *
****************************/
typedef struct asn_OCTET_STRING_specifics_s {
/*
* Target structure description.
*/
unsigned struct_size; /* Size of the structure */
unsigned ctx_offset; /* Offset of the asn_struct_ctx_t member */
enum asn_OS_Subvariant {
ASN_OSUBV_ANY, /* The open type (ANY) */
ASN_OSUBV_BIT, /* BIT STRING */
ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */
ASN_OSUBV_U16, /* 16-bit character (BMPString) */
ASN_OSUBV_U32 /* 32-bit character (UniversalString) */
} subvariant;
} asn_OCTET_STRING_specifics_t;
extern asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs;
size_t OCTET_STRING_random_length_constrained(
const asn_TYPE_descriptor_t *, const asn_encoding_constraints_t *,
size_t max_length);
#ifdef __cplusplus
}
#endif
#endif /* _OCTET_STRING_H_ */

View 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 */

521
lib/s1ap3/asn1c/OPEN_TYPE.c Normal file
View File

@ -0,0 +1,521 @@
/*
* 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) {
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;
}
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) {
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;
}
/*
* 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) {
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;
}
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;
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) {
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;
}
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;
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 */

View File

@ -0,0 +1,77 @@
/*-
* Copyright (c) 2017-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef ASN_OPEN_TYPE_H
#define ASN_OPEN_TYPE_H
#include <asn_application.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OPEN_TYPE_free CHOICE_free
#define OPEN_TYPE_print CHOICE_print
#define OPEN_TYPE_compare CHOICE_compare
#define OPEN_TYPE_constraint CHOICE_constraint
#define OPEN_TYPE_decode_ber NULL
#define OPEN_TYPE_encode_der CHOICE_encode_der
#define OPEN_TYPE_decode_xer NULL
#define OPEN_TYPE_encode_xer CHOICE_encode_xer
#define OPEN_TYPE_decode_oer NULL
#define OPEN_TYPE_encode_oer CHOICE_encode_oer
#define OPEN_TYPE_decode_uper NULL
#define OPEN_TYPE_decode_aper NULL
extern asn_TYPE_operation_t asn_OP_OPEN_TYPE;
/*
* Decode an Open Type which is potentially constraiend
* by the other members of the parent structure.
*/
asn_dec_rval_t OPEN_TYPE_ber_get(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *parent_type,
void *parent_structure,
const asn_TYPE_member_t *element,
const void *ptr, size_t size);
asn_dec_rval_t OPEN_TYPE_xer_get(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *parent_type,
void *parent_structure,
const asn_TYPE_member_t *element,
const void *ptr, size_t size);
asn_dec_rval_t OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *parent_type,
void *parent_structure,
asn_TYPE_member_t *element, const void *ptr,
size_t size);
asn_dec_rval_t OPEN_TYPE_uper_get(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *parent_type,
void *parent_structure,
const asn_TYPE_member_t *element,
asn_per_data_t *pd);
asn_dec_rval_t OPEN_TYPE_aper_get(const asn_codec_ctx_t *opt_codec_ctx,
const asn_TYPE_descriptor_t *parent_type,
void *parent_structure,
const asn_TYPE_member_t *element,
asn_per_data_t *pd);
asn_enc_rval_t OPEN_TYPE_encode_uper(
const asn_TYPE_descriptor_t *type_descriptor,
const asn_per_constraints_t *constraints, const void *struct_ptr,
asn_per_outp_t *per_output);
asn_enc_rval_t OPEN_TYPE_encode_aper(
const asn_TYPE_descriptor_t *type_descriptor,
const asn_per_constraints_t *constraints, const void *struct_ptr,
asn_per_outp_t *per_output);
#ifdef __cplusplus
}
#endif
#endif /* ASN_OPEN_TYPE_H */

View 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;
}

View 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;
}

View File

@ -0,0 +1,37 @@
/*-
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef _PrintableString_H_
#define _PrintableString_H_
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef OCTET_STRING_t PrintableString_t; /* Implemented via OCTET STRING */
extern asn_TYPE_descriptor_t asn_DEF_PrintableString;
extern asn_TYPE_operation_t asn_OP_PrintableString;
asn_constr_check_f PrintableString_constraint;
#define PrintableString_free OCTET_STRING_free
#define PrintableString_print OCTET_STRING_print_utf8
#define PrintableString_compare OCTET_STRING_compare
#define PrintableString_decode_ber OCTET_STRING_decode_ber
#define PrintableString_encode_der OCTET_STRING_encode_der
#define PrintableString_decode_xer OCTET_STRING_decode_xer_utf8
#define PrintableString_encode_xer OCTET_STRING_encode_xer_utf8
#define PrintableString_decode_uper OCTET_STRING_decode_uper
#define PrintableString_encode_uper OCTET_STRING_encode_uper
#define PrintableString_decode_aper OCTET_STRING_decode_aper
#define PrintableString_encode_aper OCTET_STRING_encode_aper
#ifdef __cplusplus
}
#endif
#endif /* _PrintableString_H_ */

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_Additional-GUTI.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_Additional_GUTI_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Additional_GUTI, gUMMEI),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_GUMMEI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"gUMMEI"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Additional_GUTI, m_TMSI),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_M_TMSI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"m-TMSI"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_Additional_GUTI, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P20,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_Additional_GUTI_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_Additional_GUTI_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_Additional_GUTI_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* gUMMEI */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* m-TMSI */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_Additional_GUTI_specs_1 = {
sizeof(struct S1AP_Additional_GUTI),
offsetof(struct S1AP_Additional_GUTI, _asn_ctx),
asn_MAP_S1AP_Additional_GUTI_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_Additional_GUTI_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_Additional_GUTI = {
"Additional-GUTI",
"Additional-GUTI",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_Additional_GUTI_tags_1,
sizeof(asn_DEF_S1AP_Additional_GUTI_tags_1)
/sizeof(asn_DEF_S1AP_Additional_GUTI_tags_1[0]), /* 1 */
asn_DEF_S1AP_Additional_GUTI_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_Additional_GUTI_tags_1)
/sizeof(asn_DEF_S1AP_Additional_GUTI_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_Additional_GUTI_1,
3, /* Elements count */
&asn_SPC_S1AP_Additional_GUTI_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_Additional_GUTI_H_
#define _S1AP_Additional_GUTI_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_GUMMEI.h"
#include "S1AP_M-TMSI.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_Additional-GUTI */
typedef struct S1AP_Additional_GUTI {
S1AP_GUMMEI_t gUMMEI;
S1AP_M_TMSI_t m_TMSI;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_Additional_GUTI_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_Additional_GUTI;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_Additional_GUTI_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,58 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AdditionalCSFallbackIndicator.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_AdditionalCSFallbackIndicator_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_AdditionalCSFallbackIndicator_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 */
};
static const asn_INTEGER_enum_map_t asn_MAP_S1AP_AdditionalCSFallbackIndicator_value2enum_1[] = {
{ 0, 14, "no-restriction" },
{ 1, 11, "restriction" }
/* This list is extensible */
};
static const unsigned int asn_MAP_S1AP_AdditionalCSFallbackIndicator_enum2value_1[] = {
0, /* no-restriction(0) */
1 /* restriction(1) */
/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_S1AP_AdditionalCSFallbackIndicator_specs_1 = {
asn_MAP_S1AP_AdditionalCSFallbackIndicator_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_AdditionalCSFallbackIndicator_enum2value_1, /* N => "tag"; sorted by N */
2, /* Number of elements in the maps */
3, /* Extensions before this member */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AdditionalCSFallbackIndicator = {
"AdditionalCSFallbackIndicator",
"AdditionalCSFallbackIndicator",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1,
sizeof(asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1)
/sizeof(asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1[0]), /* 1 */
asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1)
/sizeof(asn_DEF_S1AP_AdditionalCSFallbackIndicator_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_AdditionalCSFallbackIndicator_constr_1, &asn_PER_type_S1AP_AdditionalCSFallbackIndicator_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_AdditionalCSFallbackIndicator_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,54 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AdditionalCSFallbackIndicator_H_
#define _S1AP_AdditionalCSFallbackIndicator_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_AdditionalCSFallbackIndicator {
S1AP_AdditionalCSFallbackIndicator_no_restriction = 0,
S1AP_AdditionalCSFallbackIndicator_restriction = 1
/*
* Enumeration is extensible
*/
} e_S1AP_AdditionalCSFallbackIndicator;
/* S1AP_AdditionalCSFallbackIndicator */
typedef long S1AP_AdditionalCSFallbackIndicator_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AdditionalCSFallbackIndicator;
asn_struct_free_f S1AP_AdditionalCSFallbackIndicator_free;
asn_struct_print_f S1AP_AdditionalCSFallbackIndicator_print;
asn_constr_check_f S1AP_AdditionalCSFallbackIndicator_constraint;
ber_type_decoder_f S1AP_AdditionalCSFallbackIndicator_decode_ber;
der_type_encoder_f S1AP_AdditionalCSFallbackIndicator_encode_der;
xer_type_decoder_f S1AP_AdditionalCSFallbackIndicator_decode_xer;
xer_type_encoder_f S1AP_AdditionalCSFallbackIndicator_encode_xer;
oer_type_decoder_f S1AP_AdditionalCSFallbackIndicator_decode_oer;
oer_type_encoder_f S1AP_AdditionalCSFallbackIndicator_encode_oer;
per_type_decoder_f S1AP_AdditionalCSFallbackIndicator_decode_uper;
per_type_encoder_f S1AP_AdditionalCSFallbackIndicator_encode_uper;
per_type_decoder_f S1AP_AdditionalCSFallbackIndicator_decode_aper;
per_type_encoder_f S1AP_AdditionalCSFallbackIndicator_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AdditionalCSFallbackIndicator_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,83 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AllocationAndRetentionPriority.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_AllocationAndRetentionPriority_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AllocationAndRetentionPriority, priorityLevel),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PriorityLevel,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"priorityLevel"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AllocationAndRetentionPriority, pre_emptionCapability),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_Pre_emptionCapability,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pre-emptionCapability"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AllocationAndRetentionPriority, pre_emptionVulnerability),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_Pre_emptionVulnerability,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pre-emptionVulnerability"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_AllocationAndRetentionPriority, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P21,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_AllocationAndRetentionPriority_oms_1[] = { 3 };
static const ber_tlv_tag_t asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_AllocationAndRetentionPriority_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* priorityLevel */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* pre-emptionCapability */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* pre-emptionVulnerability */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_AllocationAndRetentionPriority_specs_1 = {
sizeof(struct S1AP_AllocationAndRetentionPriority),
offsetof(struct S1AP_AllocationAndRetentionPriority, _asn_ctx),
asn_MAP_S1AP_AllocationAndRetentionPriority_tag2el_1,
4, /* Count of tags in the map */
asn_MAP_S1AP_AllocationAndRetentionPriority_oms_1, /* Optional members */
1, 0, /* Root/Additions */
4, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AllocationAndRetentionPriority = {
"AllocationAndRetentionPriority",
"AllocationAndRetentionPriority",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1,
sizeof(asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1)
/sizeof(asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1[0]), /* 1 */
asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1)
/sizeof(asn_DEF_S1AP_AllocationAndRetentionPriority_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_AllocationAndRetentionPriority_1,
4, /* Elements count */
&asn_SPC_S1AP_AllocationAndRetentionPriority_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,52 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AllocationAndRetentionPriority_H_
#define _S1AP_AllocationAndRetentionPriority_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PriorityLevel.h"
#include "S1AP_Pre-emptionCapability.h"
#include "S1AP_Pre-emptionVulnerability.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_AllocationAndRetentionPriority */
typedef struct S1AP_AllocationAndRetentionPriority {
S1AP_PriorityLevel_t priorityLevel;
S1AP_Pre_emptionCapability_t pre_emptionCapability;
S1AP_Pre_emptionVulnerability_t pre_emptionVulnerability;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_AllocationAndRetentionPriority_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AllocationAndRetentionPriority;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_AllocationAndRetentionPriority_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_AllocationAndRetentionPriority_1[4];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AllocationAndRetentionPriority_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,88 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AreaScopeOfMDT.h"
#include "S1AP_CellBasedMDT.h"
#include "S1AP_TABasedMDT.h"
#include "S1AP_TAIBasedMDT.h"
static asn_oer_constraints_t asn_OER_type_S1AP_AreaScopeOfMDT_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
asn_per_constraints_t asn_PER_type_S1AP_AreaScopeOfMDT_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_S1AP_AreaScopeOfMDT_1[] = {
{ ATF_POINTER, 0, offsetof(struct S1AP_AreaScopeOfMDT, choice.cellBased),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CellBasedMDT,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cellBased"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_AreaScopeOfMDT, choice.tABased),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_TABasedMDT,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"tABased"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AreaScopeOfMDT, choice.pLMNWide),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_NULL,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pLMNWide"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_AreaScopeOfMDT, choice.tAIBased),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_TAIBasedMDT,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"tAIBased"
},
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_AreaScopeOfMDT_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellBased */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tABased */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* pLMNWide */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* tAIBased */
};
asn_CHOICE_specifics_t asn_SPC_S1AP_AreaScopeOfMDT_specs_1 = {
sizeof(struct S1AP_AreaScopeOfMDT),
offsetof(struct S1AP_AreaScopeOfMDT, _asn_ctx),
offsetof(struct S1AP_AreaScopeOfMDT, present),
sizeof(((struct S1AP_AreaScopeOfMDT *)0)->present),
asn_MAP_S1AP_AreaScopeOfMDT_tag2el_1,
4, /* Count of tags in the map */
0, 0,
3 /* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AreaScopeOfMDT = {
"AreaScopeOfMDT",
"AreaScopeOfMDT",
&asn_OP_CHOICE,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
{ &asn_OER_type_S1AP_AreaScopeOfMDT_constr_1, &asn_PER_type_S1AP_AreaScopeOfMDT_constr_1, CHOICE_constraint },
asn_MBR_S1AP_AreaScopeOfMDT_1,
4, /* Elements count */
&asn_SPC_S1AP_AreaScopeOfMDT_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,66 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AreaScopeOfMDT_H_
#define _S1AP_AreaScopeOfMDT_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NULL.h>
#include <constr_CHOICE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_AreaScopeOfMDT_PR {
AreaScopeOfMDT_PR_NOTHING, /* No components present */
AreaScopeOfMDT_PR_cellBased,
AreaScopeOfMDT_PR_tABased,
AreaScopeOfMDT_PR_pLMNWide,
/* Extensions may appear below */
AreaScopeOfMDT_PR_tAIBased
} S1AP_AreaScopeOfMDT_PR;
/* Forward declarations */
struct S1AP_CellBasedMDT;
struct S1AP_TABasedMDT;
struct S1AP_TAIBasedMDT;
/* S1AP_AreaScopeOfMDT */
typedef struct S1AP_AreaScopeOfMDT {
S1AP_AreaScopeOfMDT_PR present;
union S1AP_AreaScopeOfMDT_u {
struct S1AP_CellBasedMDT *cellBased;
struct S1AP_TABasedMDT *tABased;
NULL_t pLMNWide;
/*
* This type is extensible,
* possible extensions are below.
*/
struct S1AP_TAIBasedMDT *tAIBased;
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_AreaScopeOfMDT_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AreaScopeOfMDT;
extern asn_CHOICE_specifics_t asn_SPC_S1AP_AreaScopeOfMDT_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_AreaScopeOfMDT_1[4];
extern asn_per_constraints_t asn_PER_type_S1AP_AreaScopeOfMDT_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AreaScopeOfMDT_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,63 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AssistanceDataForCECapableUEs.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_AssistanceDataForCECapableUEs_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AssistanceDataForCECapableUEs, cellIdentifierAndCELevelForCECapableUEs),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CellIdentifierAndCELevelForCECapableUEs,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cellIdentifierAndCELevelForCECapableUEs"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_AssistanceDataForCECapableUEs, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P22,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_AssistanceDataForCECapableUEs_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_AssistanceDataForCECapableUEs_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellIdentifierAndCELevelForCECapableUEs */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_AssistanceDataForCECapableUEs_specs_1 = {
sizeof(struct S1AP_AssistanceDataForCECapableUEs),
offsetof(struct S1AP_AssistanceDataForCECapableUEs, _asn_ctx),
asn_MAP_S1AP_AssistanceDataForCECapableUEs_tag2el_1,
2, /* Count of tags in the map */
asn_MAP_S1AP_AssistanceDataForCECapableUEs_oms_1, /* Optional members */
1, 0, /* Root/Additions */
2, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForCECapableUEs = {
"AssistanceDataForCECapableUEs",
"AssistanceDataForCECapableUEs",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1,
sizeof(asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1[0]), /* 1 */
asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForCECapableUEs_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_AssistanceDataForCECapableUEs_1,
2, /* Elements count */
&asn_SPC_S1AP_AssistanceDataForCECapableUEs_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AssistanceDataForCECapableUEs_H_
#define _S1AP_AssistanceDataForCECapableUEs_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_CellIdentifierAndCELevelForCECapableUEs.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_AssistanceDataForCECapableUEs */
typedef struct S1AP_AssistanceDataForCECapableUEs {
S1AP_CellIdentifierAndCELevelForCECapableUEs_t cellIdentifierAndCELevelForCECapableUEs;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_AssistanceDataForCECapableUEs_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForCECapableUEs;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_AssistanceDataForCECapableUEs_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_AssistanceDataForCECapableUEs_1[2];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AssistanceDataForCECapableUEs_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,86 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AssistanceDataForPaging.h"
#include "S1AP_AssistanceDataForRecommendedCells.h"
#include "S1AP_AssistanceDataForCECapableUEs.h"
#include "S1AP_PagingAttemptInformation.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_AssistanceDataForPaging_1[] = {
{ ATF_POINTER, 4, offsetof(struct S1AP_AssistanceDataForPaging, assistanceDataForRecommendedCells),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_AssistanceDataForRecommendedCells,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"assistanceDataForRecommendedCells"
},
{ ATF_POINTER, 3, offsetof(struct S1AP_AssistanceDataForPaging, assistanceDataForCECapableUEs),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_AssistanceDataForCECapableUEs,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"assistanceDataForCECapableUEs"
},
{ ATF_POINTER, 2, offsetof(struct S1AP_AssistanceDataForPaging, pagingAttemptInformation),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PagingAttemptInformation,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pagingAttemptInformation"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_AssistanceDataForPaging, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P23,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_AssistanceDataForPaging_oms_1[] = { 0, 1, 2, 3 };
static const ber_tlv_tag_t asn_DEF_S1AP_AssistanceDataForPaging_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_AssistanceDataForPaging_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* assistanceDataForRecommendedCells */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* assistanceDataForCECapableUEs */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* pagingAttemptInformation */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_AssistanceDataForPaging_specs_1 = {
sizeof(struct S1AP_AssistanceDataForPaging),
offsetof(struct S1AP_AssistanceDataForPaging, _asn_ctx),
asn_MAP_S1AP_AssistanceDataForPaging_tag2el_1,
4, /* Count of tags in the map */
asn_MAP_S1AP_AssistanceDataForPaging_oms_1, /* Optional members */
4, 0, /* Root/Additions */
4, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForPaging = {
"AssistanceDataForPaging",
"AssistanceDataForPaging",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_AssistanceDataForPaging_tags_1,
sizeof(asn_DEF_S1AP_AssistanceDataForPaging_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForPaging_tags_1[0]), /* 1 */
asn_DEF_S1AP_AssistanceDataForPaging_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_AssistanceDataForPaging_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForPaging_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_AssistanceDataForPaging_1,
4, /* Elements count */
&asn_SPC_S1AP_AssistanceDataForPaging_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,50 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AssistanceDataForPaging_H_
#define _S1AP_AssistanceDataForPaging_H_
#include <asn_application.h>
/* Including external dependencies */
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_AssistanceDataForRecommendedCells;
struct S1AP_AssistanceDataForCECapableUEs;
struct S1AP_PagingAttemptInformation;
struct S1AP_ProtocolExtensionContainer;
/* S1AP_AssistanceDataForPaging */
typedef struct S1AP_AssistanceDataForPaging {
struct S1AP_AssistanceDataForRecommendedCells *assistanceDataForRecommendedCells; /* OPTIONAL */
struct S1AP_AssistanceDataForCECapableUEs *assistanceDataForCECapableUEs; /* OPTIONAL */
struct S1AP_PagingAttemptInformation *pagingAttemptInformation; /* OPTIONAL */
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_AssistanceDataForPaging_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForPaging;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AssistanceDataForPaging_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,63 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_AssistanceDataForRecommendedCells.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_AssistanceDataForRecommendedCells_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_AssistanceDataForRecommendedCells, recommendedCellsForPaging),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_RecommendedCellsForPaging,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"recommendedCellsForPaging"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_AssistanceDataForRecommendedCells, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P24,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_AssistanceDataForRecommendedCells_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_AssistanceDataForRecommendedCells_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* recommendedCellsForPaging */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_AssistanceDataForRecommendedCells_specs_1 = {
sizeof(struct S1AP_AssistanceDataForRecommendedCells),
offsetof(struct S1AP_AssistanceDataForRecommendedCells, _asn_ctx),
asn_MAP_S1AP_AssistanceDataForRecommendedCells_tag2el_1,
2, /* Count of tags in the map */
asn_MAP_S1AP_AssistanceDataForRecommendedCells_oms_1, /* Optional members */
1, 0, /* Root/Additions */
2, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForRecommendedCells = {
"AssistanceDataForRecommendedCells",
"AssistanceDataForRecommendedCells",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1,
sizeof(asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1[0]), /* 1 */
asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1)
/sizeof(asn_DEF_S1AP_AssistanceDataForRecommendedCells_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_AssistanceDataForRecommendedCells_1,
2, /* Elements count */
&asn_SPC_S1AP_AssistanceDataForRecommendedCells_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_AssistanceDataForRecommendedCells_H_
#define _S1AP_AssistanceDataForRecommendedCells_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_RecommendedCellsForPaging.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_AssistanceDataForRecommendedCells */
typedef struct S1AP_AssistanceDataForRecommendedCells {
S1AP_RecommendedCellsForPaging_t recommendedCellsForPaging;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_AssistanceDataForRecommendedCells_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_AssistanceDataForRecommendedCells;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_AssistanceDataForRecommendedCells_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_AssistanceDataForRecommendedCells_1[2];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_AssistanceDataForRecommendedCells_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,52 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_BPLMNs.h"
static asn_oer_constraints_t asn_OER_type_S1AP_BPLMNs_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1 /* (SIZE(1..6)) */};
asn_per_constraints_t asn_PER_type_S1AP_BPLMNs_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 3, 3, 1, 6 } /* (SIZE(1..6)) */,
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_S1AP_BPLMNs_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
0,
&asn_DEF_S1AP_PLMNidentity,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_S1AP_BPLMNs_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SET_OF_specifics_t asn_SPC_S1AP_BPLMNs_specs_1 = {
sizeof(struct S1AP_BPLMNs),
offsetof(struct S1AP_BPLMNs, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_BPLMNs = {
"BPLMNs",
"BPLMNs",
&asn_OP_SEQUENCE_OF,
asn_DEF_S1AP_BPLMNs_tags_1,
sizeof(asn_DEF_S1AP_BPLMNs_tags_1)
/sizeof(asn_DEF_S1AP_BPLMNs_tags_1[0]), /* 1 */
asn_DEF_S1AP_BPLMNs_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_BPLMNs_tags_1)
/sizeof(asn_DEF_S1AP_BPLMNs_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_BPLMNs_constr_1, &asn_PER_type_S1AP_BPLMNs_constr_1, SEQUENCE_OF_constraint },
asn_MBR_S1AP_BPLMNs_1,
1, /* Single element */
&asn_SPC_S1AP_BPLMNs_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,42 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_BPLMNs_H_
#define _S1AP_BPLMNs_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PLMNidentity.h"
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* S1AP_BPLMNs */
typedef struct S1AP_BPLMNs {
A_SEQUENCE_OF(S1AP_PLMNidentity_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_BPLMNs_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_BPLMNs;
extern asn_SET_OF_specifics_t asn_SPC_S1AP_BPLMNs_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_BPLMNs_1[1];
extern asn_per_constraints_t asn_PER_type_S1AP_BPLMNs_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_BPLMNs_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,56 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_BearerType.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_BearerType_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_BearerType_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 const asn_INTEGER_enum_map_t asn_MAP_S1AP_BearerType_value2enum_1[] = {
{ 0, 6, "non-IP" }
/* This list is extensible */
};
static const unsigned int asn_MAP_S1AP_BearerType_enum2value_1[] = {
0 /* non-IP(0) */
/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_S1AP_BearerType_specs_1 = {
asn_MAP_S1AP_BearerType_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_BearerType_enum2value_1, /* N => "tag"; sorted by N */
1, /* Number of elements in the maps */
2, /* Extensions before this member */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_BearerType_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_BearerType = {
"BearerType",
"BearerType",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_BearerType_tags_1,
sizeof(asn_DEF_S1AP_BearerType_tags_1)
/sizeof(asn_DEF_S1AP_BearerType_tags_1[0]), /* 1 */
asn_DEF_S1AP_BearerType_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_BearerType_tags_1)
/sizeof(asn_DEF_S1AP_BearerType_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_BearerType_constr_1, &asn_PER_type_S1AP_BearerType_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_BearerType_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_BearerType_H_
#define _S1AP_BearerType_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_BearerType {
S1AP_BearerType_non_IP = 0
/*
* Enumeration is extensible
*/
} e_S1AP_BearerType;
/* S1AP_BearerType */
typedef long S1AP_BearerType_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_BearerType;
asn_struct_free_f S1AP_BearerType_free;
asn_struct_print_f S1AP_BearerType_print;
asn_constr_check_f S1AP_BearerType_constraint;
ber_type_decoder_f S1AP_BearerType_decode_ber;
der_type_encoder_f S1AP_BearerType_encode_der;
xer_type_decoder_f S1AP_BearerType_decode_xer;
xer_type_encoder_f S1AP_BearerType_encode_xer;
oer_type_decoder_f S1AP_BearerType_decode_oer;
oer_type_encoder_f S1AP_BearerType_encode_oer;
per_type_decoder_f S1AP_BearerType_decode_uper;
per_type_encoder_f S1AP_BearerType_encode_uper;
per_type_decoder_f S1AP_BearerType_decode_aper;
per_type_encoder_f S1AP_BearerType_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_BearerType_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,93 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_Bearers-SubjectToStatusTransfer-Item.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_Bearers_SubjectToStatusTransfer_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, e_RAB_ID),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_E_RAB_ID,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"e-RAB-ID"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, uL_COUNTvalue),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_COUNTvalue,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"uL-COUNTvalue"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, dL_COUNTvalue),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_COUNTvalue,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"dL-COUNTvalue"
},
{ ATF_POINTER, 2, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, receiveStatusofULPDCPSDUs),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ReceiveStatusofULPDCPSDUs,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"receiveStatusofULPDCPSDUs"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P25,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_Bearers_SubjectToStatusTransfer_Item_oms_1[] = { 3, 4 };
static const ber_tlv_tag_t asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_Bearers_SubjectToStatusTransfer_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* e-RAB-ID */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* uL-COUNTvalue */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* dL-COUNTvalue */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* receiveStatusofULPDCPSDUs */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_Bearers_SubjectToStatusTransfer_Item_specs_1 = {
sizeof(struct S1AP_Bearers_SubjectToStatusTransfer_Item),
offsetof(struct S1AP_Bearers_SubjectToStatusTransfer_Item, _asn_ctx),
asn_MAP_S1AP_Bearers_SubjectToStatusTransfer_Item_tag2el_1,
5, /* Count of tags in the map */
asn_MAP_S1AP_Bearers_SubjectToStatusTransfer_Item_oms_1, /* Optional members */
2, 0, /* Root/Additions */
5, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item = {
"Bearers-SubjectToStatusTransfer-Item",
"Bearers-SubjectToStatusTransfer-Item",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1,
sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1)
/sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1[0]), /* 1 */
asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1)
/sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_Bearers_SubjectToStatusTransfer_Item_1,
5, /* Elements count */
&asn_SPC_S1AP_Bearers_SubjectToStatusTransfer_Item_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,51 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_Bearers_SubjectToStatusTransfer_Item_H_
#define _S1AP_Bearers_SubjectToStatusTransfer_Item_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_E-RAB-ID.h"
#include "S1AP_COUNTvalue.h"
#include "S1AP_ReceiveStatusofULPDCPSDUs.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_Bearers-SubjectToStatusTransfer-Item */
typedef struct S1AP_Bearers_SubjectToStatusTransfer_Item {
S1AP_E_RAB_ID_t e_RAB_ID;
S1AP_COUNTvalue_t uL_COUNTvalue;
S1AP_COUNTvalue_t dL_COUNTvalue;
S1AP_ReceiveStatusofULPDCPSDUs_t *receiveStatusofULPDCPSDUs; /* OPTIONAL */
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_Bearers_SubjectToStatusTransfer_Item_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_Bearers_SubjectToStatusTransfer_Item;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_Bearers_SubjectToStatusTransfer_Item_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_Bearers-SubjectToStatusTransferList.h"
#include "S1AP_ProtocolIE-SingleContainer.h"
static asn_oer_constraints_t asn_OER_type_S1AP_Bearers_SubjectToStatusTransferList_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1 /* (SIZE(1..256)) */};
asn_per_constraints_t asn_PER_type_S1AP_Bearers_SubjectToStatusTransferList_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 8, 8, 1, 256 } /* (SIZE(1..256)) */,
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_S1AP_Bearers_SubjectToStatusTransferList_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_S1AP_ProtocolIE_SingleContainer_6554P11,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SET_OF_specifics_t asn_SPC_S1AP_Bearers_SubjectToStatusTransferList_specs_1 = {
sizeof(struct S1AP_Bearers_SubjectToStatusTransferList),
offsetof(struct S1AP_Bearers_SubjectToStatusTransferList, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_Bearers_SubjectToStatusTransferList = {
"Bearers-SubjectToStatusTransferList",
"Bearers-SubjectToStatusTransferList",
&asn_OP_SEQUENCE_OF,
asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1,
sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1)
/sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1[0]), /* 1 */
asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1)
/sizeof(asn_DEF_S1AP_Bearers_SubjectToStatusTransferList_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_Bearers_SubjectToStatusTransferList_constr_1, &asn_PER_type_S1AP_Bearers_SubjectToStatusTransferList_constr_1, SEQUENCE_OF_constraint },
asn_MBR_S1AP_Bearers_SubjectToStatusTransferList_1,
1, /* Single element */
&asn_SPC_S1AP_Bearers_SubjectToStatusTransferList_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,44 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_Bearers_SubjectToStatusTransferList_H_
#define _S1AP_Bearers_SubjectToStatusTransferList_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolIE_SingleContainer;
/* S1AP_Bearers-SubjectToStatusTransferList */
typedef struct S1AP_Bearers_SubjectToStatusTransferList {
A_SEQUENCE_OF(struct S1AP_ProtocolIE_SingleContainer) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_Bearers_SubjectToStatusTransferList_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_Bearers_SubjectToStatusTransferList;
extern asn_SET_OF_specifics_t asn_SPC_S1AP_Bearers_SubjectToStatusTransferList_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_Bearers_SubjectToStatusTransferList_1[1];
extern asn_per_constraints_t asn_PER_type_S1AP_Bearers_SubjectToStatusTransferList_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_Bearers_SubjectToStatusTransferList_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,70 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_BitRate.h"
int
S1AP_BitRate_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 <= 10000000000)) {
/* 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_S1AP_BitRate_constr_1 CC_NOTUSED = {
{ 8, 1 } /* (0..10000000000) */,
-1};
asn_per_constraints_t asn_PER_type_S1AP_BitRate_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED, 34, -1, 0, 10000000000 } /* (0..10000000000) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static const ber_tlv_tag_t asn_DEF_S1AP_BitRate_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_BitRate = {
"BitRate",
"BitRate",
&asn_OP_INTEGER,
asn_DEF_S1AP_BitRate_tags_1,
sizeof(asn_DEF_S1AP_BitRate_tags_1)
/sizeof(asn_DEF_S1AP_BitRate_tags_1[0]), /* 1 */
asn_DEF_S1AP_BitRate_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_BitRate_tags_1)
/sizeof(asn_DEF_S1AP_BitRate_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_BitRate_constr_1, &asn_PER_type_S1AP_BitRate_constr_1, S1AP_BitRate_constraint },
0, 0, /* No members */
0 /* No specifics */
};

View File

@ -0,0 +1,46 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_BitRate_H_
#define _S1AP_BitRate_H_
#include <asn_application.h>
/* Including external dependencies */
#include <INTEGER.h>
#ifdef __cplusplus
extern "C" {
#endif
/* S1AP_BitRate */
typedef INTEGER_t S1AP_BitRate_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_S1AP_BitRate_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_S1AP_BitRate;
asn_struct_free_f S1AP_BitRate_free;
asn_struct_print_f S1AP_BitRate_print;
asn_constr_check_f S1AP_BitRate_constraint;
ber_type_decoder_f S1AP_BitRate_decode_ber;
der_type_encoder_f S1AP_BitRate_encode_der;
xer_type_decoder_f S1AP_BitRate_decode_xer;
xer_type_encoder_f S1AP_BitRate_encode_xer;
oer_type_decoder_f S1AP_BitRate_decode_oer;
oer_type_encoder_f S1AP_BitRate_encode_oer;
per_type_decoder_f S1AP_BitRate_decode_uper;
per_type_encoder_f S1AP_BitRate_encode_uper;
per_type_decoder_f S1AP_BitRate_decode_aper;
per_type_encoder_f S1AP_BitRate_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_BitRate_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,78 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_BroadcastCancelledAreaList.h"
#include "S1AP_CellID-Cancelled.h"
#include "S1AP_TAI-Cancelled.h"
#include "S1AP_EmergencyAreaID-Cancelled.h"
static asn_oer_constraints_t asn_OER_type_S1AP_BroadcastCancelledAreaList_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_BroadcastCancelledAreaList_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 asn_TYPE_member_t asn_MBR_S1AP_BroadcastCancelledAreaList_1[] = {
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCancelledAreaList, choice.cellID_Cancelled),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CellID_Cancelled,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cellID-Cancelled"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCancelledAreaList, choice.tAI_Cancelled),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_TAI_Cancelled,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"tAI-Cancelled"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCancelledAreaList, choice.emergencyAreaID_Cancelled),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_EmergencyAreaID_Cancelled,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"emergencyAreaID-Cancelled"
},
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_BroadcastCancelledAreaList_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellID-Cancelled */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tAI-Cancelled */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* emergencyAreaID-Cancelled */
};
static asn_CHOICE_specifics_t asn_SPC_S1AP_BroadcastCancelledAreaList_specs_1 = {
sizeof(struct S1AP_BroadcastCancelledAreaList),
offsetof(struct S1AP_BroadcastCancelledAreaList, _asn_ctx),
offsetof(struct S1AP_BroadcastCancelledAreaList, present),
sizeof(((struct S1AP_BroadcastCancelledAreaList *)0)->present),
asn_MAP_S1AP_BroadcastCancelledAreaList_tag2el_1,
3, /* Count of tags in the map */
0, 0,
3 /* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_BroadcastCancelledAreaList = {
"BroadcastCancelledAreaList",
"BroadcastCancelledAreaList",
&asn_OP_CHOICE,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
{ &asn_OER_type_S1AP_BroadcastCancelledAreaList_constr_1, &asn_PER_type_S1AP_BroadcastCancelledAreaList_constr_1, CHOICE_constraint },
asn_MBR_S1AP_BroadcastCancelledAreaList_1,
3, /* Elements count */
&asn_SPC_S1AP_BroadcastCancelledAreaList_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,61 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_BroadcastCancelledAreaList_H_
#define _S1AP_BroadcastCancelledAreaList_H_
#include <asn_application.h>
/* Including external dependencies */
#include <constr_CHOICE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_BroadcastCancelledAreaList_PR {
BroadcastCancelledAreaList_PR_NOTHING, /* No components present */
BroadcastCancelledAreaList_PR_cellID_Cancelled,
BroadcastCancelledAreaList_PR_tAI_Cancelled,
BroadcastCancelledAreaList_PR_emergencyAreaID_Cancelled
/* Extensions may appear below */
} S1AP_BroadcastCancelledAreaList_PR;
/* Forward declarations */
struct S1AP_CellID_Cancelled;
struct S1AP_TAI_Cancelled;
struct S1AP_EmergencyAreaID_Cancelled;
/* S1AP_BroadcastCancelledAreaList */
typedef struct S1AP_BroadcastCancelledAreaList {
S1AP_BroadcastCancelledAreaList_PR present;
union S1AP_BroadcastCancelledAreaList_u {
struct S1AP_CellID_Cancelled *cellID_Cancelled;
struct S1AP_TAI_Cancelled *tAI_Cancelled;
struct S1AP_EmergencyAreaID_Cancelled *emergencyAreaID_Cancelled;
/*
* This type is extensible,
* possible extensions are below.
*/
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_BroadcastCancelledAreaList_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_BroadcastCancelledAreaList;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_BroadcastCancelledAreaList_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,78 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_BroadcastCompletedAreaList.h"
#include "S1AP_CellID-Broadcast.h"
#include "S1AP_TAI-Broadcast.h"
#include "S1AP_EmergencyAreaID-Broadcast.h"
static asn_oer_constraints_t asn_OER_type_S1AP_BroadcastCompletedAreaList_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_BroadcastCompletedAreaList_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 asn_TYPE_member_t asn_MBR_S1AP_BroadcastCompletedAreaList_1[] = {
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCompletedAreaList, choice.cellID_Broadcast),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CellID_Broadcast,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cellID-Broadcast"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCompletedAreaList, choice.tAI_Broadcast),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_TAI_Broadcast,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"tAI-Broadcast"
},
{ ATF_POINTER, 0, offsetof(struct S1AP_BroadcastCompletedAreaList, choice.emergencyAreaID_Broadcast),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_EmergencyAreaID_Broadcast,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"emergencyAreaID-Broadcast"
},
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_BroadcastCompletedAreaList_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cellID-Broadcast */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* tAI-Broadcast */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* emergencyAreaID-Broadcast */
};
static asn_CHOICE_specifics_t asn_SPC_S1AP_BroadcastCompletedAreaList_specs_1 = {
sizeof(struct S1AP_BroadcastCompletedAreaList),
offsetof(struct S1AP_BroadcastCompletedAreaList, _asn_ctx),
offsetof(struct S1AP_BroadcastCompletedAreaList, present),
sizeof(((struct S1AP_BroadcastCompletedAreaList *)0)->present),
asn_MAP_S1AP_BroadcastCompletedAreaList_tag2el_1,
3, /* Count of tags in the map */
0, 0,
3 /* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_BroadcastCompletedAreaList = {
"BroadcastCompletedAreaList",
"BroadcastCompletedAreaList",
&asn_OP_CHOICE,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
{ &asn_OER_type_S1AP_BroadcastCompletedAreaList_constr_1, &asn_PER_type_S1AP_BroadcastCompletedAreaList_constr_1, CHOICE_constraint },
asn_MBR_S1AP_BroadcastCompletedAreaList_1,
3, /* Elements count */
&asn_SPC_S1AP_BroadcastCompletedAreaList_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,61 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_BroadcastCompletedAreaList_H_
#define _S1AP_BroadcastCompletedAreaList_H_
#include <asn_application.h>
/* Including external dependencies */
#include <constr_CHOICE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_BroadcastCompletedAreaList_PR {
BroadcastCompletedAreaList_PR_NOTHING, /* No components present */
BroadcastCompletedAreaList_PR_cellID_Broadcast,
BroadcastCompletedAreaList_PR_tAI_Broadcast,
BroadcastCompletedAreaList_PR_emergencyAreaID_Broadcast
/* Extensions may appear below */
} S1AP_BroadcastCompletedAreaList_PR;
/* Forward declarations */
struct S1AP_CellID_Broadcast;
struct S1AP_TAI_Broadcast;
struct S1AP_EmergencyAreaID_Broadcast;
/* S1AP_BroadcastCompletedAreaList */
typedef struct S1AP_BroadcastCompletedAreaList {
S1AP_BroadcastCompletedAreaList_PR present;
union S1AP_BroadcastCompletedAreaList_u {
struct S1AP_CellID_Broadcast *cellID_Broadcast;
struct S1AP_TAI_Broadcast *tAI_Broadcast;
struct S1AP_EmergencyAreaID_Broadcast *emergencyAreaID_Broadcast;
/*
* This type is extensible,
* possible extensions are below.
*/
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_BroadcastCompletedAreaList_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_BroadcastCompletedAreaList;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_BroadcastCompletedAreaList_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,56 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CE-mode-B-SupportIndicator.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_CE_mode_B_SupportIndicator_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_CE_mode_B_SupportIndicator_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 const asn_INTEGER_enum_map_t asn_MAP_S1AP_CE_mode_B_SupportIndicator_value2enum_1[] = {
{ 0, 9, "supported" }
/* This list is extensible */
};
static const unsigned int asn_MAP_S1AP_CE_mode_B_SupportIndicator_enum2value_1[] = {
0 /* supported(0) */
/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_S1AP_CE_mode_B_SupportIndicator_specs_1 = {
asn_MAP_S1AP_CE_mode_B_SupportIndicator_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_CE_mode_B_SupportIndicator_enum2value_1, /* N => "tag"; sorted by N */
1, /* Number of elements in the maps */
2, /* Extensions before this member */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CE_mode_B_SupportIndicator = {
"CE-mode-B-SupportIndicator",
"CE-mode-B-SupportIndicator",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1,
sizeof(asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1)
/sizeof(asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1[0]), /* 1 */
asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1)
/sizeof(asn_DEF_S1AP_CE_mode_B_SupportIndicator_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CE_mode_B_SupportIndicator_constr_1, &asn_PER_type_S1AP_CE_mode_B_SupportIndicator_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_CE_mode_B_SupportIndicator_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CE_mode_B_SupportIndicator_H_
#define _S1AP_CE_mode_B_SupportIndicator_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_CE_mode_B_SupportIndicator {
S1AP_CE_mode_B_SupportIndicator_supported = 0
/*
* Enumeration is extensible
*/
} e_S1AP_CE_mode_B_SupportIndicator;
/* S1AP_CE-mode-B-SupportIndicator */
typedef long S1AP_CE_mode_B_SupportIndicator_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CE_mode_B_SupportIndicator;
asn_struct_free_f S1AP_CE_mode_B_SupportIndicator_free;
asn_struct_print_f S1AP_CE_mode_B_SupportIndicator_print;
asn_constr_check_f S1AP_CE_mode_B_SupportIndicator_constraint;
ber_type_decoder_f S1AP_CE_mode_B_SupportIndicator_decode_ber;
der_type_encoder_f S1AP_CE_mode_B_SupportIndicator_encode_der;
xer_type_decoder_f S1AP_CE_mode_B_SupportIndicator_decode_xer;
xer_type_encoder_f S1AP_CE_mode_B_SupportIndicator_encode_xer;
oer_type_decoder_f S1AP_CE_mode_B_SupportIndicator_decode_oer;
oer_type_encoder_f S1AP_CE_mode_B_SupportIndicator_encode_oer;
per_type_decoder_f S1AP_CE_mode_B_SupportIndicator_decode_uper;
per_type_encoder_f S1AP_CE_mode_B_SupportIndicator_encode_uper;
per_type_decoder_f S1AP_CE_mode_B_SupportIndicator_decode_aper;
per_type_encoder_f S1AP_CE_mode_B_SupportIndicator_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CE_mode_B_SupportIndicator_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,31 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CELevel.h"
/*
* This type is implemented using OCTET_STRING,
* so here we adjust the DEF accordingly.
*/
static const ber_tlv_tag_t asn_DEF_S1AP_CELevel_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CELevel = {
"CELevel",
"CELevel",
&asn_OP_OCTET_STRING,
asn_DEF_S1AP_CELevel_tags_1,
sizeof(asn_DEF_S1AP_CELevel_tags_1)
/sizeof(asn_DEF_S1AP_CELevel_tags_1[0]), /* 1 */
asn_DEF_S1AP_CELevel_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CELevel_tags_1)
/sizeof(asn_DEF_S1AP_CELevel_tags_1[0]), /* 1 */
{ 0, 0, OCTET_STRING_constraint },
0, 0, /* No members */
&asn_SPC_OCTET_STRING_specs /* Additional specs */
};

View File

@ -0,0 +1,45 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CELevel_H_
#define _S1AP_CELevel_H_
#include <asn_application.h>
/* Including external dependencies */
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
/* S1AP_CELevel */
typedef OCTET_STRING_t S1AP_CELevel_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CELevel;
asn_struct_free_f S1AP_CELevel_free;
asn_struct_print_f S1AP_CELevel_print;
asn_constr_check_f S1AP_CELevel_constraint;
ber_type_decoder_f S1AP_CELevel_decode_ber;
der_type_encoder_f S1AP_CELevel_encode_der;
xer_type_decoder_f S1AP_CELevel_decode_xer;
xer_type_encoder_f S1AP_CELevel_encode_xer;
oer_type_decoder_f S1AP_CELevel_decode_oer;
oer_type_encoder_f S1AP_CELevel_encode_oer;
per_type_decoder_f S1AP_CELevel_decode_uper;
per_type_encoder_f S1AP_CELevel_encode_uper;
per_type_decoder_f S1AP_CELevel_decode_aper;
per_type_encoder_f S1AP_CELevel_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CELevel_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,93 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CGI.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_CGI_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CGI, pLMNidentity),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PLMNidentity,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pLMNidentity"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CGI, lAC),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_LAC,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"lAC"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CGI, cI),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cI"
},
{ ATF_POINTER, 2, offsetof(struct S1AP_CGI, rAC),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_RAC,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"rAC"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CGI, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P34,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CGI_oms_1[] = { 3, 4 };
static const ber_tlv_tag_t asn_DEF_S1AP_CGI_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CGI_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pLMNidentity */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* lAC */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* cI */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* rAC */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_CGI_specs_1 = {
sizeof(struct S1AP_CGI),
offsetof(struct S1AP_CGI, _asn_ctx),
asn_MAP_S1AP_CGI_tag2el_1,
5, /* Count of tags in the map */
asn_MAP_S1AP_CGI_oms_1, /* Optional members */
2, 0, /* Root/Additions */
5, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CGI = {
"CGI",
"CGI",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CGI_tags_1,
sizeof(asn_DEF_S1AP_CGI_tags_1)
/sizeof(asn_DEF_S1AP_CGI_tags_1[0]), /* 1 */
asn_DEF_S1AP_CGI_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CGI_tags_1)
/sizeof(asn_DEF_S1AP_CGI_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CGI_1,
5, /* Elements count */
&asn_SPC_S1AP_CGI_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,54 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CGI_H_
#define _S1AP_CGI_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PLMNidentity.h"
#include "S1AP_LAC.h"
#include "S1AP_CI.h"
#include "S1AP_RAC.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_CGI */
typedef struct S1AP_CGI {
S1AP_PLMNidentity_t pLMNidentity;
S1AP_LAC_t lAC;
S1AP_CI_t cI;
S1AP_RAC_t *rAC; /* OPTIONAL */
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CGI_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CGI;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_CGI_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CGI_1[5];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CGI_H_ */
#include <asn_internal.h>

65
lib/s1ap3/asn1c/S1AP_CI.c Normal file
View File

@ -0,0 +1,65 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CI.h"
int
S1AP_CI_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_S1AP_CI_constr_1 CC_NOTUSED = {
{ 0, 0 },
2 /* (SIZE(2..2)) */};
asn_per_constraints_t asn_PER_type_S1AP_CI_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_S1AP_CI_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CI = {
"CI",
"CI",
&asn_OP_OCTET_STRING,
asn_DEF_S1AP_CI_tags_1,
sizeof(asn_DEF_S1AP_CI_tags_1)
/sizeof(asn_DEF_S1AP_CI_tags_1[0]), /* 1 */
asn_DEF_S1AP_CI_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CI_tags_1)
/sizeof(asn_DEF_S1AP_CI_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CI_constr_1, &asn_PER_type_S1AP_CI_constr_1, S1AP_CI_constraint },
0, 0, /* No members */
&asn_SPC_OCTET_STRING_specs /* Additional specs */
};

46
lib/s1ap3/asn1c/S1AP_CI.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CI_H_
#define _S1AP_CI_H_
#include <asn_application.h>
/* Including external dependencies */
#include <OCTET_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
/* S1AP_CI */
typedef OCTET_STRING_t S1AP_CI_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_S1AP_CI_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CI;
asn_struct_free_f S1AP_CI_free;
asn_struct_print_f S1AP_CI_print;
asn_constr_check_f S1AP_CI_constraint;
ber_type_decoder_f S1AP_CI_decode_ber;
der_type_encoder_f S1AP_CI_encode_der;
xer_type_decoder_f S1AP_CI_decode_xer;
xer_type_encoder_f S1AP_CI_encode_xer;
oer_type_decoder_f S1AP_CI_decode_oer;
oer_type_encoder_f S1AP_CI_encode_oer;
per_type_decoder_f S1AP_CI_decode_uper;
per_type_encoder_f S1AP_CI_encode_uper;
per_type_decoder_f S1AP_CI_decode_aper;
per_type_encoder_f S1AP_CI_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CI_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,56 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CNDomain.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_CNDomain_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_CNDomain_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static const asn_INTEGER_enum_map_t asn_MAP_S1AP_CNDomain_value2enum_1[] = {
{ 0, 2, "ps" },
{ 1, 2, "cs" }
};
static const unsigned int asn_MAP_S1AP_CNDomain_enum2value_1[] = {
1, /* cs(1) */
0 /* ps(0) */
};
static const asn_INTEGER_specifics_t asn_SPC_S1AP_CNDomain_specs_1 = {
asn_MAP_S1AP_CNDomain_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_CNDomain_enum2value_1, /* N => "tag"; sorted by N */
2, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_CNDomain_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CNDomain = {
"CNDomain",
"CNDomain",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_CNDomain_tags_1,
sizeof(asn_DEF_S1AP_CNDomain_tags_1)
/sizeof(asn_DEF_S1AP_CNDomain_tags_1[0]), /* 1 */
asn_DEF_S1AP_CNDomain_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CNDomain_tags_1)
/sizeof(asn_DEF_S1AP_CNDomain_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CNDomain_constr_1, &asn_PER_type_S1AP_CNDomain_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_CNDomain_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,51 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CNDomain_H_
#define _S1AP_CNDomain_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_CNDomain {
S1AP_CNDomain_ps = 0,
S1AP_CNDomain_cs = 1
} e_S1AP_CNDomain;
/* S1AP_CNDomain */
typedef long S1AP_CNDomain_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CNDomain;
asn_struct_free_f S1AP_CNDomain_free;
asn_struct_print_f S1AP_CNDomain_print;
asn_constr_check_f S1AP_CNDomain_constraint;
ber_type_decoder_f S1AP_CNDomain_decode_ber;
der_type_encoder_f S1AP_CNDomain_encode_der;
xer_type_decoder_f S1AP_CNDomain_decode_xer;
xer_type_encoder_f S1AP_CNDomain_encode_xer;
oer_type_decoder_f S1AP_CNDomain_decode_oer;
oer_type_encoder_f S1AP_CNDomain_encode_oer;
per_type_decoder_f S1AP_CNDomain_decode_uper;
per_type_encoder_f S1AP_CNDomain_encode_uper;
per_type_decoder_f S1AP_CNDomain_decode_aper;
per_type_encoder_f S1AP_CNDomain_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CNDomain_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_COUNTValueExtended.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_COUNTValueExtended_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTValueExtended, pDCP_SNExtended),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PDCP_SNExtended,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pDCP-SNExtended"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTValueExtended, hFNModified),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_HFNModified,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"hFNModified"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_COUNTValueExtended, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P37,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_COUNTValueExtended_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_COUNTValueExtended_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_COUNTValueExtended_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pDCP-SNExtended */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* hFNModified */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_COUNTValueExtended_specs_1 = {
sizeof(struct S1AP_COUNTValueExtended),
offsetof(struct S1AP_COUNTValueExtended, _asn_ctx),
asn_MAP_S1AP_COUNTValueExtended_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_COUNTValueExtended_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTValueExtended = {
"COUNTValueExtended",
"COUNTValueExtended",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_COUNTValueExtended_tags_1,
sizeof(asn_DEF_S1AP_COUNTValueExtended_tags_1)
/sizeof(asn_DEF_S1AP_COUNTValueExtended_tags_1[0]), /* 1 */
asn_DEF_S1AP_COUNTValueExtended_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_COUNTValueExtended_tags_1)
/sizeof(asn_DEF_S1AP_COUNTValueExtended_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_COUNTValueExtended_1,
3, /* Elements count */
&asn_SPC_S1AP_COUNTValueExtended_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_COUNTValueExtended_H_
#define _S1AP_COUNTValueExtended_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PDCP-SNExtended.h"
#include "S1AP_HFNModified.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_COUNTValueExtended */
typedef struct S1AP_COUNTValueExtended {
S1AP_PDCP_SNExtended_t pDCP_SNExtended;
S1AP_HFNModified_t hFNModified;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_COUNTValueExtended_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTValueExtended;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_COUNTValueExtended_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_COUNTvalue.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_COUNTvalue_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTvalue, pDCP_SN),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PDCP_SN,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pDCP-SN"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTvalue, hFN),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_HFN,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"hFN"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_COUNTvalue, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P36,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_COUNTvalue_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_COUNTvalue_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_COUNTvalue_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pDCP-SN */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* hFN */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_COUNTvalue_specs_1 = {
sizeof(struct S1AP_COUNTvalue),
offsetof(struct S1AP_COUNTvalue, _asn_ctx),
asn_MAP_S1AP_COUNTvalue_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_COUNTvalue_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTvalue = {
"COUNTvalue",
"COUNTvalue",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_COUNTvalue_tags_1,
sizeof(asn_DEF_S1AP_COUNTvalue_tags_1)
/sizeof(asn_DEF_S1AP_COUNTvalue_tags_1[0]), /* 1 */
asn_DEF_S1AP_COUNTvalue_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_COUNTvalue_tags_1)
/sizeof(asn_DEF_S1AP_COUNTvalue_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_COUNTvalue_1,
3, /* Elements count */
&asn_SPC_S1AP_COUNTvalue_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,50 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_COUNTvalue_H_
#define _S1AP_COUNTvalue_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PDCP-SN.h"
#include "S1AP_HFN.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_COUNTvalue */
typedef struct S1AP_COUNTvalue {
S1AP_PDCP_SN_t pDCP_SN;
S1AP_HFN_t hFN;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_COUNTvalue_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTvalue;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_COUNTvalue_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_COUNTvalue_1[3];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_COUNTvalue_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_COUNTvaluePDCP-SNlength18.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_COUNTvaluePDCP_SNlength18_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTvaluePDCP_SNlength18, pDCP_SNlength18),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PDCP_SNlength18,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pDCP-SNlength18"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_COUNTvaluePDCP_SNlength18, hFNforPDCP_SNlength18),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_HFNforPDCP_SNlength18,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"hFNforPDCP-SNlength18"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_COUNTvaluePDCP_SNlength18, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P38,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_COUNTvaluePDCP_SNlength18_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_COUNTvaluePDCP_SNlength18_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* pDCP-SNlength18 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* hFNforPDCP-SNlength18 */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_COUNTvaluePDCP_SNlength18_specs_1 = {
sizeof(struct S1AP_COUNTvaluePDCP_SNlength18),
offsetof(struct S1AP_COUNTvaluePDCP_SNlength18, _asn_ctx),
asn_MAP_S1AP_COUNTvaluePDCP_SNlength18_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_COUNTvaluePDCP_SNlength18_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTvaluePDCP_SNlength18 = {
"COUNTvaluePDCP-SNlength18",
"COUNTvaluePDCP-SNlength18",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1,
sizeof(asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1)
/sizeof(asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1[0]), /* 1 */
asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1)
/sizeof(asn_DEF_S1AP_COUNTvaluePDCP_SNlength18_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_COUNTvaluePDCP_SNlength18_1,
3, /* Elements count */
&asn_SPC_S1AP_COUNTvaluePDCP_SNlength18_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_COUNTvaluePDCP_SNlength18_H_
#define _S1AP_COUNTvaluePDCP_SNlength18_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_PDCP-SNlength18.h"
#include "S1AP_HFNforPDCP-SNlength18.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_COUNTvaluePDCP-SNlength18 */
typedef struct S1AP_COUNTvaluePDCP_SNlength18 {
S1AP_PDCP_SNlength18_t pDCP_SNlength18;
S1AP_HFNforPDCP_SNlength18_t hFNforPDCP_SNlength18;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_COUNTvaluePDCP_SNlength18_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_COUNTvaluePDCP_SNlength18;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_COUNTvaluePDCP_SNlength18_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,58 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSFallbackIndicator.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_CSFallbackIndicator_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
static asn_per_constraints_t asn_PER_type_S1AP_CSFallbackIndicator_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 const asn_INTEGER_enum_map_t asn_MAP_S1AP_CSFallbackIndicator_value2enum_1[] = {
{ 0, 20, "cs-fallback-required" },
{ 1, 25, "cs-fallback-high-priority" }
/* This list is extensible */
};
static const unsigned int asn_MAP_S1AP_CSFallbackIndicator_enum2value_1[] = {
1, /* cs-fallback-high-priority(1) */
0 /* cs-fallback-required(0) */
/* This list is extensible */
};
static const asn_INTEGER_specifics_t asn_SPC_S1AP_CSFallbackIndicator_specs_1 = {
asn_MAP_S1AP_CSFallbackIndicator_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_CSFallbackIndicator_enum2value_1, /* N => "tag"; sorted by N */
2, /* Number of elements in the maps */
2, /* Extensions before this member */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_CSFallbackIndicator_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSFallbackIndicator = {
"CSFallbackIndicator",
"CSFallbackIndicator",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_CSFallbackIndicator_tags_1,
sizeof(asn_DEF_S1AP_CSFallbackIndicator_tags_1)
/sizeof(asn_DEF_S1AP_CSFallbackIndicator_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSFallbackIndicator_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSFallbackIndicator_tags_1)
/sizeof(asn_DEF_S1AP_CSFallbackIndicator_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CSFallbackIndicator_constr_1, &asn_PER_type_S1AP_CSFallbackIndicator_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_CSFallbackIndicator_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,54 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSFallbackIndicator_H_
#define _S1AP_CSFallbackIndicator_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_CSFallbackIndicator {
S1AP_CSFallbackIndicator_cs_fallback_required = 0,
/*
* Enumeration is extensible
*/
S1AP_CSFallbackIndicator_cs_fallback_high_priority = 1
} e_S1AP_CSFallbackIndicator;
/* S1AP_CSFallbackIndicator */
typedef long S1AP_CSFallbackIndicator_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSFallbackIndicator;
asn_struct_free_f S1AP_CSFallbackIndicator_free;
asn_struct_print_f S1AP_CSFallbackIndicator_print;
asn_constr_check_f S1AP_CSFallbackIndicator_constraint;
ber_type_decoder_f S1AP_CSFallbackIndicator_decode_ber;
der_type_encoder_f S1AP_CSFallbackIndicator_encode_der;
xer_type_decoder_f S1AP_CSFallbackIndicator_decode_xer;
xer_type_encoder_f S1AP_CSFallbackIndicator_encode_xer;
oer_type_decoder_f S1AP_CSFallbackIndicator_decode_oer;
oer_type_encoder_f S1AP_CSFallbackIndicator_encode_oer;
per_type_decoder_f S1AP_CSFallbackIndicator_decode_uper;
per_type_encoder_f S1AP_CSFallbackIndicator_encode_uper;
per_type_decoder_f S1AP_CSFallbackIndicator_decode_aper;
per_type_encoder_f S1AP_CSFallbackIndicator_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSFallbackIndicator_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,70 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSG-Id.h"
int
S1AP_CSG_Id_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 == 27)) {
/* 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_S1AP_CSG_Id_constr_1 CC_NOTUSED = {
{ 0, 0 },
27 /* (SIZE(27..27)) */};
asn_per_constraints_t asn_PER_type_S1AP_CSG_Id_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 0, 0, 27, 27 } /* (SIZE(27..27)) */,
0, 0 /* No PER value map */
};
static const ber_tlv_tag_t asn_DEF_S1AP_CSG_Id_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_Id = {
"CSG-Id",
"CSG-Id",
&asn_OP_BIT_STRING,
asn_DEF_S1AP_CSG_Id_tags_1,
sizeof(asn_DEF_S1AP_CSG_Id_tags_1)
/sizeof(asn_DEF_S1AP_CSG_Id_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSG_Id_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSG_Id_tags_1)
/sizeof(asn_DEF_S1AP_CSG_Id_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CSG_Id_constr_1, &asn_PER_type_S1AP_CSG_Id_constr_1, S1AP_CSG_Id_constraint },
0, 0, /* No members */
&asn_SPC_BIT_STRING_specs /* Additional specs */
};

View File

@ -0,0 +1,46 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSG_Id_H_
#define _S1AP_CSG_Id_H_
#include <asn_application.h>
/* Including external dependencies */
#include <BIT_STRING.h>
#ifdef __cplusplus
extern "C" {
#endif
/* S1AP_CSG-Id */
typedef BIT_STRING_t S1AP_CSG_Id_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_S1AP_CSG_Id_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_Id;
asn_struct_free_f S1AP_CSG_Id_free;
asn_struct_print_f S1AP_CSG_Id_print;
asn_constr_check_f S1AP_CSG_Id_constraint;
ber_type_decoder_f S1AP_CSG_Id_decode_ber;
der_type_encoder_f S1AP_CSG_Id_encode_der;
xer_type_decoder_f S1AP_CSG_Id_decode_xer;
xer_type_encoder_f S1AP_CSG_Id_encode_xer;
oer_type_decoder_f S1AP_CSG_Id_decode_oer;
oer_type_encoder_f S1AP_CSG_Id_encode_oer;
per_type_decoder_f S1AP_CSG_Id_decode_uper;
per_type_encoder_f S1AP_CSG_Id_encode_uper;
per_type_decoder_f S1AP_CSG_Id_decode_aper;
per_type_encoder_f S1AP_CSG_Id_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSG_Id_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,63 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSG-IdList-Item.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_CSG_IdList_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CSG_IdList_Item, cSG_Id),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CSG_Id,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cSG-Id"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CSG_IdList_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P35,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CSG_IdList_Item_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_S1AP_CSG_IdList_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CSG_IdList_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cSG-Id */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_CSG_IdList_Item_specs_1 = {
sizeof(struct S1AP_CSG_IdList_Item),
offsetof(struct S1AP_CSG_IdList_Item, _asn_ctx),
asn_MAP_S1AP_CSG_IdList_Item_tag2el_1,
2, /* Count of tags in the map */
asn_MAP_S1AP_CSG_IdList_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
2, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_IdList_Item = {
"CSG-IdList-Item",
"CSG-IdList-Item",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CSG_IdList_Item_tags_1,
sizeof(asn_DEF_S1AP_CSG_IdList_Item_tags_1)
/sizeof(asn_DEF_S1AP_CSG_IdList_Item_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSG_IdList_Item_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSG_IdList_Item_tags_1)
/sizeof(asn_DEF_S1AP_CSG_IdList_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CSG_IdList_Item_1,
2, /* Elements count */
&asn_SPC_S1AP_CSG_IdList_Item_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,48 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSG_IdList_Item_H_
#define _S1AP_CSG_IdList_Item_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_CSG-Id.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_CSG-IdList-Item */
typedef struct S1AP_CSG_IdList_Item {
S1AP_CSG_Id_t cSG_Id;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CSG_IdList_Item_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_IdList_Item;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_CSG_IdList_Item_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CSG_IdList_Item_1[2];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSG_IdList_Item_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSG-IdList.h"
#include "S1AP_CSG-IdList-Item.h"
static asn_oer_constraints_t asn_OER_type_S1AP_CSG_IdList_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1 /* (SIZE(1..256)) */};
static asn_per_constraints_t asn_PER_type_S1AP_CSG_IdList_constr_1 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_S1AP_CSG_IdList_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_S1AP_CSG_IdList_Item,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_S1AP_CSG_IdList_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_S1AP_CSG_IdList_specs_1 = {
sizeof(struct S1AP_CSG_IdList),
offsetof(struct S1AP_CSG_IdList, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_IdList = {
"CSG-IdList",
"CSG-IdList",
&asn_OP_SEQUENCE_OF,
asn_DEF_S1AP_CSG_IdList_tags_1,
sizeof(asn_DEF_S1AP_CSG_IdList_tags_1)
/sizeof(asn_DEF_S1AP_CSG_IdList_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSG_IdList_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSG_IdList_tags_1)
/sizeof(asn_DEF_S1AP_CSG_IdList_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CSG_IdList_constr_1, &asn_PER_type_S1AP_CSG_IdList_constr_1, SEQUENCE_OF_constraint },
asn_MBR_S1AP_CSG_IdList_1,
1, /* Single element */
&asn_SPC_S1AP_CSG_IdList_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,41 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSG_IdList_H_
#define _S1AP_CSG_IdList_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_CSG_IdList_Item;
/* S1AP_CSG-IdList */
typedef struct S1AP_CSG_IdList {
A_SEQUENCE_OF(struct S1AP_CSG_IdList_Item) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CSG_IdList_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSG_IdList;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSG_IdList_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,93 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-PDU-Contents"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSGMembershipInfo.h"
#include "S1AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_S1AP_CSGMembershipInfo_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CSGMembershipInfo, cSGMembershipStatus),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CSGMembershipStatus,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cSGMembershipStatus"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CSGMembershipInfo, cSG_Id),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CSG_Id,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cSG-Id"
},
{ ATF_POINTER, 3, offsetof(struct S1AP_CSGMembershipInfo, cellAccessMode),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CellAccessMode,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cellAccessMode"
},
{ ATF_POINTER, 2, offsetof(struct S1AP_CSGMembershipInfo, pLMNidentity),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_PLMNidentity,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"pLMNidentity"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CSGMembershipInfo, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P16,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CSGMembershipInfo_oms_1[] = { 2, 3, 4 };
static const ber_tlv_tag_t asn_DEF_S1AP_CSGMembershipInfo_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CSGMembershipInfo_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cSGMembershipStatus */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* cSG-Id */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* cellAccessMode */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* pLMNidentity */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_S1AP_CSGMembershipInfo_specs_1 = {
sizeof(struct S1AP_CSGMembershipInfo),
offsetof(struct S1AP_CSGMembershipInfo, _asn_ctx),
asn_MAP_S1AP_CSGMembershipInfo_tag2el_1,
5, /* Count of tags in the map */
asn_MAP_S1AP_CSGMembershipInfo_oms_1, /* Optional members */
3, 0, /* Root/Additions */
5, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSGMembershipInfo = {
"CSGMembershipInfo",
"CSGMembershipInfo",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CSGMembershipInfo_tags_1,
sizeof(asn_DEF_S1AP_CSGMembershipInfo_tags_1)
/sizeof(asn_DEF_S1AP_CSGMembershipInfo_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSGMembershipInfo_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSGMembershipInfo_tags_1)
/sizeof(asn_DEF_S1AP_CSGMembershipInfo_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CSGMembershipInfo_1,
5, /* Elements count */
&asn_SPC_S1AP_CSGMembershipInfo_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,52 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-PDU-Contents"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSGMembershipInfo_H_
#define _S1AP_CSGMembershipInfo_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_CSGMembershipStatus.h"
#include "S1AP_CSG-Id.h"
#include "S1AP_CellAccessMode.h"
#include "S1AP_PLMNidentity.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_CSGMembershipInfo */
typedef struct S1AP_CSGMembershipInfo {
S1AP_CSGMembershipStatus_t cSGMembershipStatus;
S1AP_CSG_Id_t cSG_Id;
S1AP_CellAccessMode_t *cellAccessMode; /* OPTIONAL */
S1AP_PLMNidentity_t *pLMNidentity; /* OPTIONAL */
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CSGMembershipInfo_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSGMembershipInfo;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSGMembershipInfo_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,56 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CSGMembershipStatus.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_CSGMembershipStatus_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
asn_per_constraints_t asn_PER_type_S1AP_CSGMembershipStatus_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static const asn_INTEGER_enum_map_t asn_MAP_S1AP_CSGMembershipStatus_value2enum_1[] = {
{ 0, 6, "member" },
{ 1, 10, "not-member" }
};
static const unsigned int asn_MAP_S1AP_CSGMembershipStatus_enum2value_1[] = {
0, /* member(0) */
1 /* not-member(1) */
};
const asn_INTEGER_specifics_t asn_SPC_S1AP_CSGMembershipStatus_specs_1 = {
asn_MAP_S1AP_CSGMembershipStatus_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_CSGMembershipStatus_enum2value_1, /* N => "tag"; sorted by N */
2, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_CSGMembershipStatus_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CSGMembershipStatus = {
"CSGMembershipStatus",
"CSGMembershipStatus",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_CSGMembershipStatus_tags_1,
sizeof(asn_DEF_S1AP_CSGMembershipStatus_tags_1)
/sizeof(asn_DEF_S1AP_CSGMembershipStatus_tags_1[0]), /* 1 */
asn_DEF_S1AP_CSGMembershipStatus_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CSGMembershipStatus_tags_1)
/sizeof(asn_DEF_S1AP_CSGMembershipStatus_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CSGMembershipStatus_constr_1, &asn_PER_type_S1AP_CSGMembershipStatus_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_CSGMembershipStatus_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CSGMembershipStatus_H_
#define _S1AP_CSGMembershipStatus_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_CSGMembershipStatus {
S1AP_CSGMembershipStatus_member = 0,
S1AP_CSGMembershipStatus_not_member = 1
} e_S1AP_CSGMembershipStatus;
/* S1AP_CSGMembershipStatus */
typedef long S1AP_CSGMembershipStatus_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_S1AP_CSGMembershipStatus_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CSGMembershipStatus;
extern const asn_INTEGER_specifics_t asn_SPC_CSGMembershipStatus_specs_1;
asn_struct_free_f CSGMembershipStatus_free;
asn_struct_print_f CSGMembershipStatus_print;
asn_constr_check_f CSGMembershipStatus_constraint;
ber_type_decoder_f CSGMembershipStatus_decode_ber;
der_type_encoder_f CSGMembershipStatus_encode_der;
xer_type_decoder_f CSGMembershipStatus_decode_xer;
xer_type_encoder_f CSGMembershipStatus_encode_xer;
oer_type_decoder_f CSGMembershipStatus_decode_oer;
oer_type_encoder_f CSGMembershipStatus_encode_oer;
per_type_decoder_f CSGMembershipStatus_decode_uper;
per_type_encoder_f CSGMembershipStatus_encode_uper;
per_type_decoder_f CSGMembershipStatus_decode_aper;
per_type_encoder_f CSGMembershipStatus_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CSGMembershipStatus_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CancelledCellinEAI-Item.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinEAI_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinEAI_Item, eCGI),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_EUTRAN_CGI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"eCGI"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinEAI_Item, numberOfBroadcasts),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_NumberOfBroadcasts,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"numberOfBroadcasts"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CancelledCellinEAI_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P26,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CancelledCellinEAI_Item_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CancelledCellinEAI_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* eCGI */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* numberOfBroadcasts */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_CancelledCellinEAI_Item_specs_1 = {
sizeof(struct S1AP_CancelledCellinEAI_Item),
offsetof(struct S1AP_CancelledCellinEAI_Item, _asn_ctx),
asn_MAP_S1AP_CancelledCellinEAI_Item_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_CancelledCellinEAI_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinEAI_Item = {
"CancelledCellinEAI-Item",
"CancelledCellinEAI-Item",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1,
sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[0]), /* 1 */
asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CancelledCellinEAI_Item_1,
3, /* Elements count */
&asn_SPC_S1AP_CancelledCellinEAI_Item_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,50 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CancelledCellinEAI_Item_H_
#define _S1AP_CancelledCellinEAI_Item_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_EUTRAN-CGI.h"
#include "S1AP_NumberOfBroadcasts.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_CancelledCellinEAI-Item */
typedef struct S1AP_CancelledCellinEAI_Item {
S1AP_EUTRAN_CGI_t eCGI;
S1AP_NumberOfBroadcasts_t numberOfBroadcasts;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CancelledCellinEAI_Item_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinEAI_Item;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_CancelledCellinEAI_Item_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinEAI_Item_1[3];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CancelledCellinEAI_Item_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CancelledCellinEAI.h"
#include "S1AP_CancelledCellinEAI-Item.h"
static asn_oer_constraints_t asn_OER_type_S1AP_CancelledCellinEAI_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1 /* (SIZE(1..65535)) */};
asn_per_constraints_t asn_PER_type_S1AP_CancelledCellinEAI_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 16, 16, 1, 65535 } /* (SIZE(1..65535)) */,
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinEAI_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_S1AP_CancelledCellinEAI_Item,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_S1AP_CancelledCellinEAI_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SET_OF_specifics_t asn_SPC_S1AP_CancelledCellinEAI_specs_1 = {
sizeof(struct S1AP_CancelledCellinEAI),
offsetof(struct S1AP_CancelledCellinEAI, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinEAI = {
"CancelledCellinEAI",
"CancelledCellinEAI",
&asn_OP_SEQUENCE_OF,
asn_DEF_S1AP_CancelledCellinEAI_tags_1,
sizeof(asn_DEF_S1AP_CancelledCellinEAI_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_tags_1[0]), /* 1 */
asn_DEF_S1AP_CancelledCellinEAI_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CancelledCellinEAI_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinEAI_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CancelledCellinEAI_constr_1, &asn_PER_type_S1AP_CancelledCellinEAI_constr_1, SEQUENCE_OF_constraint },
asn_MBR_S1AP_CancelledCellinEAI_1,
1, /* Single element */
&asn_SPC_S1AP_CancelledCellinEAI_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,44 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CancelledCellinEAI_H_
#define _S1AP_CancelledCellinEAI_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_CancelledCellinEAI_Item;
/* S1AP_CancelledCellinEAI */
typedef struct S1AP_CancelledCellinEAI {
A_SEQUENCE_OF(struct S1AP_CancelledCellinEAI_Item) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CancelledCellinEAI_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinEAI;
extern asn_SET_OF_specifics_t asn_SPC_S1AP_CancelledCellinEAI_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinEAI_1[1];
extern asn_per_constraints_t asn_PER_type_S1AP_CancelledCellinEAI_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CancelledCellinEAI_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,73 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CancelledCellinTAI-Item.h"
#include "S1AP_ProtocolExtensionContainer.h"
asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinTAI_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinTAI_Item, eCGI),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_EUTRAN_CGI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"eCGI"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_CancelledCellinTAI_Item, numberOfBroadcasts),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_NumberOfBroadcasts,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"numberOfBroadcasts"
},
{ ATF_POINTER, 1, offsetof(struct S1AP_CancelledCellinTAI_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_ProtocolExtensionContainer_6602P27,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_S1AP_CancelledCellinTAI_Item_oms_1[] = { 2 };
static const ber_tlv_tag_t asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_CancelledCellinTAI_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* eCGI */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* numberOfBroadcasts */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* iE-Extensions */
};
asn_SEQUENCE_specifics_t asn_SPC_S1AP_CancelledCellinTAI_Item_specs_1 = {
sizeof(struct S1AP_CancelledCellinTAI_Item),
offsetof(struct S1AP_CancelledCellinTAI_Item, _asn_ctx),
asn_MAP_S1AP_CancelledCellinTAI_Item_tag2el_1,
3, /* Count of tags in the map */
asn_MAP_S1AP_CancelledCellinTAI_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
3, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinTAI_Item = {
"CancelledCellinTAI-Item",
"CancelledCellinTAI-Item",
&asn_OP_SEQUENCE,
asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1,
sizeof(asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1[0]), /* 1 */
asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinTAI_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_S1AP_CancelledCellinTAI_Item_1,
3, /* Elements count */
&asn_SPC_S1AP_CancelledCellinTAI_Item_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,50 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CancelledCellinTAI_Item_H_
#define _S1AP_CancelledCellinTAI_Item_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_EUTRAN-CGI.h"
#include "S1AP_NumberOfBroadcasts.h"
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_ProtocolExtensionContainer;
/* S1AP_CancelledCellinTAI-Item */
typedef struct S1AP_CancelledCellinTAI_Item {
S1AP_EUTRAN_CGI_t eCGI;
S1AP_NumberOfBroadcasts_t numberOfBroadcasts;
struct S1AP_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CancelledCellinTAI_Item_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinTAI_Item;
extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_CancelledCellinTAI_Item_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinTAI_Item_1[3];
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CancelledCellinTAI_Item_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,53 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CancelledCellinTAI.h"
#include "S1AP_CancelledCellinTAI-Item.h"
static asn_oer_constraints_t asn_OER_type_S1AP_CancelledCellinTAI_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1 /* (SIZE(1..65535)) */};
asn_per_constraints_t asn_PER_type_S1AP_CancelledCellinTAI_constr_1 CC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 16, 16, 1, 65535 } /* (SIZE(1..65535)) */,
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinTAI_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_S1AP_CancelledCellinTAI_Item,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
""
},
};
static const ber_tlv_tag_t asn_DEF_S1AP_CancelledCellinTAI_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_SET_OF_specifics_t asn_SPC_S1AP_CancelledCellinTAI_specs_1 = {
sizeof(struct S1AP_CancelledCellinTAI),
offsetof(struct S1AP_CancelledCellinTAI, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinTAI = {
"CancelledCellinTAI",
"CancelledCellinTAI",
&asn_OP_SEQUENCE_OF,
asn_DEF_S1AP_CancelledCellinTAI_tags_1,
sizeof(asn_DEF_S1AP_CancelledCellinTAI_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinTAI_tags_1[0]), /* 1 */
asn_DEF_S1AP_CancelledCellinTAI_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CancelledCellinTAI_tags_1)
/sizeof(asn_DEF_S1AP_CancelledCellinTAI_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CancelledCellinTAI_constr_1, &asn_PER_type_S1AP_CancelledCellinTAI_constr_1, SEQUENCE_OF_constraint },
asn_MBR_S1AP_CancelledCellinTAI_1,
1, /* Single element */
&asn_SPC_S1AP_CancelledCellinTAI_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,44 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CancelledCellinTAI_H_
#define _S1AP_CancelledCellinTAI_H_
#include <asn_application.h>
/* Including external dependencies */
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct S1AP_CancelledCellinTAI_Item;
/* S1AP_CancelledCellinTAI */
typedef struct S1AP_CancelledCellinTAI {
A_SEQUENCE_OF(struct S1AP_CancelledCellinTAI_Item) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_CancelledCellinTAI_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CancelledCellinTAI;
extern asn_SET_OF_specifics_t asn_SPC_S1AP_CancelledCellinTAI_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_CancelledCellinTAI_1[1];
extern asn_per_constraints_t asn_PER_type_S1AP_CancelledCellinTAI_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CancelledCellinTAI_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,95 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_Cause.h"
static asn_oer_constraints_t asn_OER_type_S1AP_Cause_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
asn_per_constraints_t asn_PER_type_S1AP_Cause_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 4 } /* (0..4,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
asn_TYPE_member_t asn_MBR_S1AP_Cause_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Cause, choice.radioNetwork),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CauseRadioNetwork,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"radioNetwork"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Cause, choice.transport),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CauseTransport,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"transport"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Cause, choice.nas),
(ASN_TAG_CLASS_CONTEXT | (2 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CauseNas,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"nas"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Cause, choice.protocol),
(ASN_TAG_CLASS_CONTEXT | (3 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CauseProtocol,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"protocol"
},
{ ATF_NOFLAGS, 0, offsetof(struct S1AP_Cause, choice.misc),
(ASN_TAG_CLASS_CONTEXT | (4 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_S1AP_CauseMisc,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"misc"
},
};
static const asn_TYPE_tag2member_t asn_MAP_S1AP_Cause_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* radioNetwork */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* transport */
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* nas */
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* protocol */
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* misc */
};
asn_CHOICE_specifics_t asn_SPC_S1AP_Cause_specs_1 = {
sizeof(struct S1AP_Cause),
offsetof(struct S1AP_Cause, _asn_ctx),
offsetof(struct S1AP_Cause, present),
sizeof(((struct S1AP_Cause *)0)->present),
asn_MAP_S1AP_Cause_tag2el_1,
5, /* Count of tags in the map */
0, 0,
5 /* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_S1AP_Cause = {
"Cause",
"Cause",
&asn_OP_CHOICE,
0, /* No effective tags (pointer) */
0, /* No effective tags (count) */
0, /* No tags (pointer) */
0, /* No tags (count) */
{ &asn_OER_type_S1AP_Cause_constr_1, &asn_PER_type_S1AP_Cause_constr_1, CHOICE_constraint },
asn_MBR_S1AP_Cause_1,
5, /* Elements count */
&asn_SPC_S1AP_Cause_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,68 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_Cause_H_
#define _S1AP_Cause_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_CauseRadioNetwork.h"
#include "S1AP_CauseTransport.h"
#include "S1AP_CauseNas.h"
#include "S1AP_CauseProtocol.h"
#include "S1AP_CauseMisc.h"
#include <constr_CHOICE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_Cause_PR {
Cause_PR_NOTHING, /* No components present */
Cause_PR_radioNetwork,
Cause_PR_transport,
Cause_PR_nas,
Cause_PR_protocol,
Cause_PR_misc
/* Extensions may appear below */
} S1AP_Cause_PR;
/* S1AP_Cause */
typedef struct S1AP_Cause {
S1AP_Cause_PR present;
union S1AP_Cause_u {
S1AP_CauseRadioNetwork_t radioNetwork;
S1AP_CauseTransport_t transport;
S1AP_CauseNas_t nas;
S1AP_CauseProtocol_t protocol;
S1AP_CauseMisc_t misc;
/*
* This type is extensible,
* possible extensions are below.
*/
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_Cause_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_Cause;
extern asn_CHOICE_specifics_t asn_SPC_S1AP_Cause_specs_1;
extern asn_TYPE_member_t asn_MBR_S1AP_Cause_1[5];
extern asn_per_constraints_t asn_PER_type_S1AP_Cause_constr_1;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_Cause_H_ */
#include <asn_internal.h>

View File

@ -0,0 +1,66 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#include "S1AP_CauseMisc.h"
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static asn_oer_constraints_t asn_OER_type_S1AP_CauseMisc_constr_1 CC_NOTUSED = {
{ 0, 0 },
-1};
asn_per_constraints_t asn_PER_type_S1AP_CauseMisc_constr_1 CC_NOTUSED = {
{ APC_CONSTRAINED | APC_EXTENSIBLE, 3, 3, 0, 5 } /* (0..5,...) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static const asn_INTEGER_enum_map_t asn_MAP_S1AP_CauseMisc_value2enum_1[] = {
{ 0, 27, "control-processing-overload" },
{ 1, 42, "not-enough-user-plane-processing-resources" },
{ 2, 16, "hardware-failure" },
{ 3, 15, "om-intervention" },
{ 4, 11, "unspecified" },
{ 5, 12, "unknown-PLMN" }
/* This list is extensible */
};
static const unsigned int asn_MAP_S1AP_CauseMisc_enum2value_1[] = {
0, /* control-processing-overload(0) */
2, /* hardware-failure(2) */
1, /* not-enough-user-plane-processing-resources(1) */
3, /* om-intervention(3) */
5, /* unknown-PLMN(5) */
4 /* unspecified(4) */
/* This list is extensible */
};
const asn_INTEGER_specifics_t asn_SPC_S1AP_CauseMisc_specs_1 = {
asn_MAP_S1AP_CauseMisc_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_S1AP_CauseMisc_enum2value_1, /* N => "tag"; sorted by N */
6, /* Number of elements in the maps */
7, /* Extensions before this member */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_S1AP_CauseMisc_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_S1AP_CauseMisc = {
"CauseMisc",
"CauseMisc",
&asn_OP_NativeEnumerated,
asn_DEF_S1AP_CauseMisc_tags_1,
sizeof(asn_DEF_S1AP_CauseMisc_tags_1)
/sizeof(asn_DEF_S1AP_CauseMisc_tags_1[0]), /* 1 */
asn_DEF_S1AP_CauseMisc_tags_1, /* Same as above */
sizeof(asn_DEF_S1AP_CauseMisc_tags_1)
/sizeof(asn_DEF_S1AP_CauseMisc_tags_1[0]), /* 1 */
{ &asn_OER_type_S1AP_CauseMisc_constr_1, &asn_PER_type_S1AP_CauseMisc_constr_1, NativeEnumerated_constraint },
0, 0, /* Defined elsewhere */
&asn_SPC_S1AP_CauseMisc_specs_1 /* Additional specs */
};

View File

@ -0,0 +1,60 @@
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/r14.4.0/36413-e40.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_CauseMisc_H_
#define _S1AP_CauseMisc_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeEnumerated.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_CauseMisc {
S1AP_CauseMisc_control_processing_overload = 0,
S1AP_CauseMisc_not_enough_user_plane_processing_resources = 1,
S1AP_CauseMisc_hardware_failure = 2,
S1AP_CauseMisc_om_intervention = 3,
S1AP_CauseMisc_unspecified = 4,
S1AP_CauseMisc_unknown_PLMN = 5
/*
* Enumeration is extensible
*/
} e_S1AP_CauseMisc;
/* S1AP_CauseMisc */
typedef long S1AP_CauseMisc_t;
/* Implementation */
extern asn_per_constraints_t asn_PER_type_S1AP_CauseMisc_constr_1;
extern asn_TYPE_descriptor_t asn_DEF_S1AP_CauseMisc;
extern const asn_INTEGER_specifics_t asn_SPC_CauseMisc_specs_1;
asn_struct_free_f CauseMisc_free;
asn_struct_print_f CauseMisc_print;
asn_constr_check_f CauseMisc_constraint;
ber_type_decoder_f CauseMisc_decode_ber;
der_type_encoder_f CauseMisc_encode_der;
xer_type_decoder_f CauseMisc_decode_xer;
xer_type_encoder_f CauseMisc_encode_xer;
oer_type_decoder_f CauseMisc_decode_oer;
oer_type_encoder_f CauseMisc_encode_oer;
per_type_decoder_f CauseMisc_decode_uper;
per_type_encoder_f CauseMisc_encode_uper;
per_type_decoder_f CauseMisc_decode_aper;
per_type_encoder_f CauseMisc_encode_aper;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_CauseMisc_H_ */
#include <asn_internal.h>

Some files were not shown because too many files have changed in this diff Show More