Harald Welte | d523a69 | 2015-08-30 23:11:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Generated by asn1c-0.9.28 (http://lionet.info/asn1c) |
| 3 | * From ASN.1 module "HNBAP-IEs" |
| 4 | * found in "../../asn1/hnbap/HNBAP-IEs.asn" |
Harald Welte | ff4750f | 2015-08-31 09:55:28 +0200 | [diff] [blame] | 5 | * `asn1c -gen-PER` |
Harald Welte | d523a69 | 2015-08-30 23:11:19 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include "S-RNTIPrefix.h" |
| 9 | |
| 10 | int |
| 11 | S_RNTIPrefix_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 12 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 13 | const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; |
| 14 | size_t size; |
| 15 | |
| 16 | if(!sptr) { |
| 17 | _ASN_CTFAIL(app_key, td, sptr, |
| 18 | "%s: value not given (%s:%d)", |
| 19 | td->name, __FILE__, __LINE__); |
| 20 | return -1; |
| 21 | } |
| 22 | |
| 23 | if(st->size > 0) { |
| 24 | /* Size in bits */ |
| 25 | size = 8 * st->size - (st->bits_unused & 0x07); |
| 26 | } else { |
| 27 | size = 0; |
| 28 | } |
| 29 | |
| 30 | if((size >= 1l && size <= 16l)) { |
| 31 | /* Constraint check succeeded */ |
| 32 | return 0; |
| 33 | } else { |
| 34 | _ASN_CTFAIL(app_key, td, sptr, |
| 35 | "%s: constraint failed (%s:%d)", |
| 36 | td->name, __FILE__, __LINE__); |
| 37 | return -1; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * This type is implemented using BIT_STRING, |
| 43 | * so here we adjust the DEF accordingly. |
| 44 | */ |
| 45 | static void |
| 46 | S_RNTIPrefix_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 47 | td->free_struct = asn_DEF_BIT_STRING.free_struct; |
| 48 | td->print_struct = asn_DEF_BIT_STRING.print_struct; |
| 49 | td->check_constraints = asn_DEF_BIT_STRING.check_constraints; |
| 50 | td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; |
| 51 | td->der_encoder = asn_DEF_BIT_STRING.der_encoder; |
| 52 | td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; |
| 53 | td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; |
| 54 | td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; |
| 55 | td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; |
| 56 | td->aper_decoder = asn_DEF_BIT_STRING.aper_decoder; |
| 57 | td->aper_encoder = asn_DEF_BIT_STRING.aper_encoder; |
| 58 | if(!td->per_constraints) |
| 59 | td->per_constraints = asn_DEF_BIT_STRING.per_constraints; |
| 60 | td->elements = asn_DEF_BIT_STRING.elements; |
| 61 | td->elements_count = asn_DEF_BIT_STRING.elements_count; |
| 62 | td->specifics = asn_DEF_BIT_STRING.specifics; |
| 63 | } |
| 64 | |
| 65 | void |
| 66 | S_RNTIPrefix_free(asn_TYPE_descriptor_t *td, |
| 67 | void *struct_ptr, int contents_only) { |
| 68 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 69 | td->free_struct(td, struct_ptr, contents_only); |
| 70 | } |
| 71 | |
| 72 | int |
| 73 | S_RNTIPrefix_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 74 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 75 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 76 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 77 | } |
| 78 | |
| 79 | asn_dec_rval_t |
| 80 | S_RNTIPrefix_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 81 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 82 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 83 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 84 | } |
| 85 | |
| 86 | asn_enc_rval_t |
| 87 | S_RNTIPrefix_encode_der(asn_TYPE_descriptor_t *td, |
| 88 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 89 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 90 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 91 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 92 | } |
| 93 | |
| 94 | asn_dec_rval_t |
| 95 | S_RNTIPrefix_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 96 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 97 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 98 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 99 | } |
| 100 | |
| 101 | asn_enc_rval_t |
| 102 | S_RNTIPrefix_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 103 | int ilevel, enum xer_encoder_flags_e flags, |
| 104 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 105 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 106 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 107 | } |
| 108 | |
| 109 | asn_dec_rval_t |
| 110 | S_RNTIPrefix_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 111 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 112 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 113 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 114 | } |
| 115 | |
| 116 | asn_enc_rval_t |
| 117 | S_RNTIPrefix_encode_uper(asn_TYPE_descriptor_t *td, |
| 118 | asn_per_constraints_t *constraints, |
| 119 | void *structure, asn_per_outp_t *per_out) { |
| 120 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 121 | return td->uper_encoder(td, constraints, structure, per_out); |
| 122 | } |
| 123 | |
| 124 | asn_enc_rval_t |
| 125 | S_RNTIPrefix_encode_aper(asn_TYPE_descriptor_t *td, |
| 126 | asn_per_constraints_t *constraints, |
| 127 | void *structure, asn_per_outp_t *per_out) { |
| 128 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 129 | return td->aper_encoder(td, constraints, structure, per_out); |
| 130 | } |
| 131 | |
| 132 | asn_dec_rval_t |
| 133 | S_RNTIPrefix_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 134 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 135 | S_RNTIPrefix_1_inherit_TYPE_descriptor(td); |
| 136 | return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 137 | } |
| 138 | |
| 139 | static asn_per_constraints_t asn_PER_type_S_RNTIPrefix_constr_1 GCC_NOTUSED = { |
| 140 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 141 | { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1l, 16l } /* (SIZE(1..16,...)) */, |
| 142 | 0, 0 /* No PER value map */ |
| 143 | }; |
| 144 | static const ber_tlv_tag_t asn_DEF_S_RNTIPrefix_tags_1[] = { |
| 145 | (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) |
| 146 | }; |
| 147 | asn_TYPE_descriptor_t asn_DEF_S_RNTIPrefix = { |
| 148 | "S-RNTIPrefix", |
| 149 | "S-RNTIPrefix", |
| 150 | S_RNTIPrefix_free, |
| 151 | S_RNTIPrefix_print, |
| 152 | S_RNTIPrefix_constraint, |
| 153 | S_RNTIPrefix_decode_ber, |
| 154 | S_RNTIPrefix_encode_der, |
| 155 | S_RNTIPrefix_decode_xer, |
| 156 | S_RNTIPrefix_encode_xer, |
| 157 | S_RNTIPrefix_decode_uper, |
| 158 | S_RNTIPrefix_encode_uper, |
| 159 | S_RNTIPrefix_decode_aper, |
| 160 | S_RNTIPrefix_encode_aper, |
| 161 | 0, /* Use generic outmost tag fetcher */ |
| 162 | asn_DEF_S_RNTIPrefix_tags_1, |
| 163 | sizeof(asn_DEF_S_RNTIPrefix_tags_1) |
| 164 | /sizeof(asn_DEF_S_RNTIPrefix_tags_1[0]), /* 1 */ |
| 165 | asn_DEF_S_RNTIPrefix_tags_1, /* Same as above */ |
| 166 | sizeof(asn_DEF_S_RNTIPrefix_tags_1) |
| 167 | /sizeof(asn_DEF_S_RNTIPrefix_tags_1[0]), /* 1 */ |
| 168 | &asn_PER_type_S_RNTIPrefix_constr_1, |
| 169 | 0, 0, /* No members */ |
| 170 | 0 /* No specifics */ |
| 171 | }; |
| 172 | |