49 const long *native = (
const long *)sptr;
60 char *src = (
char *)alloca(srcsize);
62 er.encoded = snprintf(src, srcsize,
"<%s/>", el->
enum_name);
63 assert(er.encoded > 0 && (
size_t)er.encoded < srcsize);
68 "unknown value of ENUMERATED type");
79 long *native = (
long *)*sptr;
85 if(constraints) ct = &constraints->value;
86 else if(td->per_constraints) ct = &td->per_constraints->value;
91 native = (
long *)(*sptr =
CALLOC(1,
sizeof(*native)));
95 ASN_DEBUG(
"Decoding %s as NativeEnumerated", td->name);
97 if(ct->
flags & APC_EXTENSIBLE) {
106 if(value >= (specs->extension
107 ? specs->extension - 1 : specs->map_count))
110 if(!specs->extension)
117 value += specs->extension - 1;
118 if(value >= specs->map_count)
122 *native = specs->value2enum[value].nat_value;
123 ASN_DEBUG(
"Decoded %s = %ld", td->name, *native);
153 if(constraints) ct = &constraints->
value;
161 native = *(
long *)sptr;
164 key.nat_value = native;
168 ASN_DEBUG(
"No element corresponds to %ld", native);
179 if(ct->
flags & APC_EXTENSIBLE) {
199 ASN_DEBUG(
"value = %ld, ext = %d, inext = %d, res = %ld",
201 value - (inext ? (specs->
extension - 1) : 0));
static int NativeEnumerated__compar_value2enum(const void *ap, const void *bp)
#define _ASN_DECODE_STARVED
enum asn_per_constraint_s::asn_per_constraint_flags flags
xer_type_decoder_f NativeInteger_decode_xer
int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits)
const asn_INTEGER_enum_map_t * INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value)
asn_constr_check_f asn_generic_no_constraint
int uper_put_nsnnwn(asn_per_outp_t *po, int n)
asn_per_constraint_t value
#define CALLOC(nmemb, size)
#define _ASN_ENCODED_OK(rval)
static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[]
ber_type_decoder_f NativeInteger_decode_ber
#define _ASN_ENCODE_FAILED
asn_enc_rval_t NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key)
asn_TYPE_descriptor_t asn_DEF_NativeEnumerated
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
asn_dec_rval_t NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd)
int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits)
static void ASN_DEBUG(const char *fmt,...)
asn_struct_print_f NativeInteger_print
ssize_t uper_get_nsnnwn(asn_per_data_t *pd)
asn_per_constraints_t * per_constraints
der_type_encoder_f NativeInteger_encode_der
asn_INTEGER_enum_map_t * value2enum
asn_struct_free_f NativeInteger_free
asn_enc_rval_t NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po)
#define _ASN_DECODE_FAILED