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" |
| 5 | * `asn1c -gen-PER -fnative-types` |
| 6 | */ |
| 7 | |
| 8 | #include "LAC.h" |
| 9 | |
| 10 | int |
| 11 | LAC_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 12 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
| 13 | const OCTET_STRING_t *st = (const OCTET_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 | size = st->size; |
| 24 | |
| 25 | if((size == 2l)) { |
| 26 | /* Constraint check succeeded */ |
| 27 | return 0; |
| 28 | } else { |
| 29 | _ASN_CTFAIL(app_key, td, sptr, |
| 30 | "%s: constraint failed (%s:%d)", |
| 31 | td->name, __FILE__, __LINE__); |
| 32 | return -1; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /* |
| 37 | * This type is implemented using OCTET_STRING, |
| 38 | * so here we adjust the DEF accordingly. |
| 39 | */ |
| 40 | static void |
| 41 | LAC_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
| 42 | td->free_struct = asn_DEF_OCTET_STRING.free_struct; |
| 43 | td->print_struct = asn_DEF_OCTET_STRING.print_struct; |
| 44 | td->check_constraints = asn_DEF_OCTET_STRING.check_constraints; |
| 45 | td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; |
| 46 | td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; |
| 47 | td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; |
| 48 | td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; |
| 49 | td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; |
| 50 | td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; |
| 51 | td->aper_decoder = asn_DEF_OCTET_STRING.aper_decoder; |
| 52 | td->aper_encoder = asn_DEF_OCTET_STRING.aper_encoder; |
| 53 | if(!td->per_constraints) |
| 54 | td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; |
| 55 | td->elements = asn_DEF_OCTET_STRING.elements; |
| 56 | td->elements_count = asn_DEF_OCTET_STRING.elements_count; |
| 57 | td->specifics = asn_DEF_OCTET_STRING.specifics; |
| 58 | } |
| 59 | |
| 60 | void |
| 61 | LAC_free(asn_TYPE_descriptor_t *td, |
| 62 | void *struct_ptr, int contents_only) { |
| 63 | LAC_1_inherit_TYPE_descriptor(td); |
| 64 | td->free_struct(td, struct_ptr, contents_only); |
| 65 | } |
| 66 | |
| 67 | int |
| 68 | LAC_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 69 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
| 70 | LAC_1_inherit_TYPE_descriptor(td); |
| 71 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 72 | } |
| 73 | |
| 74 | asn_dec_rval_t |
| 75 | LAC_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 76 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
| 77 | LAC_1_inherit_TYPE_descriptor(td); |
| 78 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 79 | } |
| 80 | |
| 81 | asn_enc_rval_t |
| 82 | LAC_encode_der(asn_TYPE_descriptor_t *td, |
| 83 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 84 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 85 | LAC_1_inherit_TYPE_descriptor(td); |
| 86 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 87 | } |
| 88 | |
| 89 | asn_dec_rval_t |
| 90 | LAC_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 91 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
| 92 | LAC_1_inherit_TYPE_descriptor(td); |
| 93 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 94 | } |
| 95 | |
| 96 | asn_enc_rval_t |
| 97 | LAC_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 98 | int ilevel, enum xer_encoder_flags_e flags, |
| 99 | asn_app_consume_bytes_f *cb, void *app_key) { |
| 100 | LAC_1_inherit_TYPE_descriptor(td); |
| 101 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 102 | } |
| 103 | |
| 104 | asn_dec_rval_t |
| 105 | LAC_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 106 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 107 | LAC_1_inherit_TYPE_descriptor(td); |
| 108 | return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 109 | } |
| 110 | |
| 111 | asn_enc_rval_t |
| 112 | LAC_encode_uper(asn_TYPE_descriptor_t *td, |
| 113 | asn_per_constraints_t *constraints, |
| 114 | void *structure, asn_per_outp_t *per_out) { |
| 115 | LAC_1_inherit_TYPE_descriptor(td); |
| 116 | return td->uper_encoder(td, constraints, structure, per_out); |
| 117 | } |
| 118 | |
| 119 | asn_enc_rval_t |
| 120 | LAC_encode_aper(asn_TYPE_descriptor_t *td, |
| 121 | asn_per_constraints_t *constraints, |
| 122 | void *structure, asn_per_outp_t *per_out) { |
| 123 | LAC_1_inherit_TYPE_descriptor(td); |
| 124 | return td->aper_encoder(td, constraints, structure, per_out); |
| 125 | } |
| 126 | |
| 127 | asn_dec_rval_t |
| 128 | LAC_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
| 129 | asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { |
| 130 | LAC_1_inherit_TYPE_descriptor(td); |
| 131 | return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); |
| 132 | } |
| 133 | |
| 134 | static asn_per_constraints_t asn_PER_type_LAC_constr_1 GCC_NOTUSED = { |
| 135 | { APC_UNCONSTRAINED, -1, -1, 0, 0 }, |
| 136 | { APC_CONSTRAINED, 0, 0, 2l, 2l } /* (SIZE(2..2)) */, |
| 137 | 0, 0 /* No PER value map */ |
| 138 | }; |
| 139 | static const ber_tlv_tag_t asn_DEF_LAC_tags_1[] = { |
| 140 | (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) |
| 141 | }; |
| 142 | asn_TYPE_descriptor_t asn_DEF_LAC = { |
| 143 | "LAC", |
| 144 | "LAC", |
| 145 | LAC_free, |
| 146 | LAC_print, |
| 147 | LAC_constraint, |
| 148 | LAC_decode_ber, |
| 149 | LAC_encode_der, |
| 150 | LAC_decode_xer, |
| 151 | LAC_encode_xer, |
| 152 | LAC_decode_uper, |
| 153 | LAC_encode_uper, |
| 154 | LAC_decode_aper, |
| 155 | LAC_encode_aper, |
| 156 | 0, /* Use generic outmost tag fetcher */ |
| 157 | asn_DEF_LAC_tags_1, |
| 158 | sizeof(asn_DEF_LAC_tags_1) |
| 159 | /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ |
| 160 | asn_DEF_LAC_tags_1, /* Same as above */ |
| 161 | sizeof(asn_DEF_LAC_tags_1) |
| 162 | /sizeof(asn_DEF_LAC_tags_1[0]), /* 1 */ |
| 163 | &asn_PER_type_LAC_constr_1, |
| 164 | 0, 0, /* No members */ |
| 165 | 0 /* No specifics */ |
| 166 | }; |
| 167 | |