2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
4 * Redistribution and modifications are permitted subject to BSD license.
6 #include <asn_internal.h>
7 #include <NativeEnumerated.h>
10 NativeEnumerated_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr,
11 int ilevel, enum jer_encoder_flags_e flags,
12 asn_app_consume_bytes_f *cb, void *app_key) {
13 const asn_INTEGER_specifics_t *specs =
14 (const asn_INTEGER_specifics_t *)td->specifics;
15 asn_enc_rval_t er = {0,0,0};
16 const long *native = (const long *)sptr;
17 const asn_INTEGER_enum_map_t *el;
22 if(!native) ASN__ENCODE_FAILED;
24 el = INTEGER_map_value2enum(specs, *native);
27 asn__format_to_callback(cb, app_key, "\"%s\"", el->enum_name);
28 if(er.encoded < 0) ASN__ENCODE_FAILED;
32 "ASN.1 forbids dealing with "
33 "unknown value of ENUMERATED type");