vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Int1] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [Int1] >>> ***/ |
| 7 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 8 | typedef INTEGER_t Int1_t; |
| 9 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 10 | /*** <<< FUNC-DECLS [Int1] >>> ***/ |
| 11 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 12 | extern asn_TYPE_descriptor_t asn_DEF_Int1; |
| 13 | asn_struct_free_f Int1_free; |
| 14 | asn_struct_print_f Int1_print; |
| 15 | asn_constr_check_f Int1_constraint; |
| 16 | ber_type_decoder_f Int1_decode_ber; |
| 17 | der_type_encoder_f Int1_encode_der; |
| 18 | xer_type_decoder_f Int1_decode_xer; |
| 19 | xer_type_encoder_f Int1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 20 | |
| 21 | /*** <<< CODE [Int1] >>> ***/ |
| 22 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 23 | int |
| 24 | Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 25 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 26 | /* Replace with underlying type checker */ |
| 27 | td->check_constraints = asn_DEF_INTEGER.check_constraints; |
| 28 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 29 | } |
| 30 | |
| 31 | /* |
| 32 | * This type is implemented using INTEGER, |
| 33 | * so here we adjust the DEF accordingly. |
| 34 | */ |
| 35 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 36 | Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 37 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 38 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 39 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 40 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 41 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 42 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 43 | td->elements = asn_DEF_INTEGER.elements; |
| 44 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 45 | td->specifics = asn_DEF_INTEGER.specifics; |
| 46 | } |
| 47 | |
| 48 | void |
| 49 | Int1_free(asn_TYPE_descriptor_t *td, |
| 50 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 51 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 52 | td->free_struct(td, struct_ptr, contents_only); |
| 53 | } |
| 54 | |
| 55 | int |
| 56 | Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 57 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 58 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 59 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 60 | } |
| 61 | |
| 62 | asn_dec_rval_t |
| 63 | Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 64 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 65 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 66 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 67 | } |
| 68 | |
| 69 | asn_enc_rval_t |
| 70 | Int1_encode_der(asn_TYPE_descriptor_t *td, |
| 71 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 72 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 73 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 74 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 75 | } |
| 76 | |
| 77 | asn_dec_rval_t |
| 78 | Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 79 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 80 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 81 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 82 | } |
| 83 | |
| 84 | asn_enc_rval_t |
| 85 | Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 86 | int ilevel, enum xer_encoder_flags_e flags, |
| 87 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 88 | Int1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 89 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /*** <<< STAT-DEFS [Int1] >>> ***/ |
| 94 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 95 | static ber_tlv_tag_t asn_DEF_Int1_1_tags[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 96 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 97 | }; |
| 98 | asn_TYPE_descriptor_t asn_DEF_Int1 = { |
| 99 | "Int1", |
| 100 | "Int1", |
| 101 | Int1_free, |
| 102 | Int1_print, |
| 103 | Int1_constraint, |
| 104 | Int1_decode_ber, |
| 105 | Int1_encode_der, |
| 106 | Int1_decode_xer, |
| 107 | Int1_encode_xer, |
| 108 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 109 | asn_DEF_Int1_1_tags, |
| 110 | sizeof(asn_DEF_Int1_1_tags) |
| 111 | /sizeof(asn_DEF_Int1_1_tags[0]), /* 1 */ |
| 112 | asn_DEF_Int1_1_tags, /* Same as above */ |
| 113 | sizeof(asn_DEF_Int1_1_tags) |
| 114 | /sizeof(asn_DEF_Int1_1_tags[0]), /* 1 */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 115 | 0, 0, /* No members */ |
| 116 | 0 /* No specifics */ |
| 117 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 118 | |
| 119 | |
| 120 | /*** <<< INCLUDES [Int2] >>> ***/ |
| 121 | |
| 122 | #include <Int1.h> |
| 123 | |
| 124 | /*** <<< TYPE-DECLS [Int2] >>> ***/ |
| 125 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 126 | typedef Int1_t Int2_t; |
| 127 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 128 | /*** <<< FUNC-DECLS [Int2] >>> ***/ |
| 129 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 130 | extern asn_TYPE_descriptor_t asn_DEF_Int2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 131 | asn_struct_free_f Int2_free; |
| 132 | asn_struct_print_f Int2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 133 | asn_constr_check_f Int2_constraint; |
| 134 | ber_type_decoder_f Int2_decode_ber; |
| 135 | der_type_encoder_f Int2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 136 | xer_type_decoder_f Int2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 137 | xer_type_encoder_f Int2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 138 | |
| 139 | /*** <<< CODE [Int2] >>> ***/ |
| 140 | |
| 141 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 142 | Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 143 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 144 | const Int1_t *st = (const Int1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 145 | long value; |
| 146 | |
| 147 | if(!sptr) { |
| 148 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 149 | "%s: value not given (%s:%d)", |
| 150 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 151 | return -1; |
| 152 | } |
| 153 | |
vlm | 34ce8ad | 2004-09-07 06:43:57 +0000 | [diff] [blame] | 154 | /* Check if the sign bit is present */ |
| 155 | value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 156 | |
| 157 | if((value >= 0)) { |
| 158 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 159 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 160 | } else { |
| 161 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 162 | "%s: constraint failed (%s:%d)", |
| 163 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 164 | return -1; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | * This type is implemented using Int1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 170 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 171 | */ |
| 172 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 173 | Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 174 | td->free_struct = asn_DEF_Int1.free_struct; |
| 175 | td->print_struct = asn_DEF_Int1.print_struct; |
| 176 | td->ber_decoder = asn_DEF_Int1.ber_decoder; |
| 177 | td->der_encoder = asn_DEF_Int1.der_encoder; |
| 178 | td->xer_decoder = asn_DEF_Int1.xer_decoder; |
| 179 | td->xer_encoder = asn_DEF_Int1.xer_encoder; |
| 180 | td->elements = asn_DEF_Int1.elements; |
| 181 | td->elements_count = asn_DEF_Int1.elements_count; |
| 182 | td->specifics = asn_DEF_Int1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 183 | } |
| 184 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 185 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 186 | Int2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 187 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 188 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 189 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 193 | Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 194 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 195 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 196 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 197 | } |
| 198 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 199 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 200 | Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 201 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 202 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 203 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 207 | Int2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 208 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 209 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 210 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 211 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 212 | } |
| 213 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 214 | asn_dec_rval_t |
| 215 | Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 216 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 217 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 218 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 219 | } |
| 220 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 221 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 222 | Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 223 | int ilevel, enum xer_encoder_flags_e flags, |
| 224 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 225 | Int2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 226 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | |
| 230 | /*** <<< STAT-DEFS [Int2] >>> ***/ |
| 231 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 232 | static ber_tlv_tag_t asn_DEF_Int2_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 233 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 234 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 235 | asn_TYPE_descriptor_t asn_DEF_Int2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 236 | "Int2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 237 | "Int2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 238 | Int2_free, |
| 239 | Int2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 240 | Int2_constraint, |
| 241 | Int2_decode_ber, |
| 242 | Int2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 243 | Int2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 244 | Int2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 245 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 246 | asn_DEF_Int2_1_tags, |
| 247 | sizeof(asn_DEF_Int2_1_tags) |
| 248 | /sizeof(asn_DEF_Int2_1_tags[0]), /* 1 */ |
| 249 | asn_DEF_Int2_1_tags, /* Same as above */ |
| 250 | sizeof(asn_DEF_Int2_1_tags) |
| 251 | /sizeof(asn_DEF_Int2_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 252 | 0, 0, /* No members */ |
| 253 | 0 /* No specifics */ |
| 254 | }; |
| 255 | |
| 256 | |
| 257 | /*** <<< INCLUDES [Int3] >>> ***/ |
| 258 | |
| 259 | #include <Int2.h> |
| 260 | |
| 261 | /*** <<< TYPE-DECLS [Int3] >>> ***/ |
| 262 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 263 | typedef Int2_t Int3_t; |
| 264 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 265 | /*** <<< FUNC-DECLS [Int3] >>> ***/ |
| 266 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 267 | extern asn_TYPE_descriptor_t asn_DEF_Int3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 268 | asn_struct_free_f Int3_free; |
| 269 | asn_struct_print_f Int3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 270 | asn_constr_check_f Int3_constraint; |
| 271 | ber_type_decoder_f Int3_decode_ber; |
| 272 | der_type_encoder_f Int3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 273 | xer_type_decoder_f Int3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 274 | xer_type_encoder_f Int3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 275 | |
| 276 | /*** <<< CODE [Int3] >>> ***/ |
| 277 | |
| 278 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 279 | Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 280 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 281 | const Int2_t *st = (const Int2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 282 | long value; |
| 283 | |
| 284 | if(!sptr) { |
| 285 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 286 | "%s: value not given (%s:%d)", |
| 287 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 288 | return -1; |
| 289 | } |
| 290 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 291 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 292 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 293 | "%s: value too large (%s:%d)", |
| 294 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 295 | return -1; |
| 296 | } |
| 297 | |
| 298 | if((value >= 0 && value <= 10)) { |
| 299 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 300 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 301 | } else { |
| 302 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 303 | "%s: constraint failed (%s:%d)", |
| 304 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 305 | return -1; |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | /* |
| 310 | * This type is implemented using Int2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 311 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 312 | */ |
| 313 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 314 | Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 315 | td->free_struct = asn_DEF_Int2.free_struct; |
| 316 | td->print_struct = asn_DEF_Int2.print_struct; |
| 317 | td->ber_decoder = asn_DEF_Int2.ber_decoder; |
| 318 | td->der_encoder = asn_DEF_Int2.der_encoder; |
| 319 | td->xer_decoder = asn_DEF_Int2.xer_decoder; |
| 320 | td->xer_encoder = asn_DEF_Int2.xer_encoder; |
| 321 | td->elements = asn_DEF_Int2.elements; |
| 322 | td->elements_count = asn_DEF_Int2.elements_count; |
| 323 | td->specifics = asn_DEF_Int2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 324 | } |
| 325 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 326 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 327 | Int3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 328 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 329 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 330 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 334 | Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 335 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 336 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 337 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 338 | } |
| 339 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 340 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 341 | Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 342 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 343 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 344 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 348 | Int3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 349 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 350 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 351 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 352 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 353 | } |
| 354 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 355 | asn_dec_rval_t |
| 356 | Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 357 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 358 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 359 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 360 | } |
| 361 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 362 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 363 | Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 364 | int ilevel, enum xer_encoder_flags_e flags, |
| 365 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 366 | Int3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 367 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | |
| 371 | /*** <<< STAT-DEFS [Int3] >>> ***/ |
| 372 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 373 | static ber_tlv_tag_t asn_DEF_Int3_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 374 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 375 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 376 | asn_TYPE_descriptor_t asn_DEF_Int3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 377 | "Int3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 378 | "Int3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 379 | Int3_free, |
| 380 | Int3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 381 | Int3_constraint, |
| 382 | Int3_decode_ber, |
| 383 | Int3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 384 | Int3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 385 | Int3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 386 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 387 | asn_DEF_Int3_1_tags, |
| 388 | sizeof(asn_DEF_Int3_1_tags) |
| 389 | /sizeof(asn_DEF_Int3_1_tags[0]), /* 1 */ |
| 390 | asn_DEF_Int3_1_tags, /* Same as above */ |
| 391 | sizeof(asn_DEF_Int3_1_tags) |
| 392 | /sizeof(asn_DEF_Int3_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 393 | 0, 0, /* No members */ |
| 394 | 0 /* No specifics */ |
| 395 | }; |
| 396 | |
| 397 | |
| 398 | /*** <<< INCLUDES [Int4] >>> ***/ |
| 399 | |
| 400 | #include <Int3.h> |
| 401 | |
| 402 | /*** <<< TYPE-DECLS [Int4] >>> ***/ |
| 403 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 404 | typedef Int3_t Int4_t; |
| 405 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 406 | /*** <<< FUNC-DECLS [Int4] >>> ***/ |
| 407 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 408 | extern asn_TYPE_descriptor_t asn_DEF_Int4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 409 | asn_struct_free_f Int4_free; |
| 410 | asn_struct_print_f Int4_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 411 | asn_constr_check_f Int4_constraint; |
| 412 | ber_type_decoder_f Int4_decode_ber; |
| 413 | der_type_encoder_f Int4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 414 | xer_type_decoder_f Int4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 415 | xer_type_encoder_f Int4_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 416 | |
| 417 | /*** <<< CODE [Int4] >>> ***/ |
| 418 | |
| 419 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 420 | Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 421 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 422 | const Int3_t *st = (const Int3_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 423 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 424 | |
| 425 | if(!sptr) { |
| 426 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 427 | "%s: value not given (%s:%d)", |
| 428 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 429 | return -1; |
| 430 | } |
| 431 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 432 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 433 | _ASN_ERRLOG(app_errlog, app_key, |
| 434 | "%s: value too large (%s:%d)", |
| 435 | td->name, __FILE__, __LINE__); |
| 436 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 437 | } |
| 438 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 439 | if((value >= 1 && value <= 10)) { |
| 440 | /* Constraint check succeeded */ |
| 441 | return 0; |
| 442 | } else { |
| 443 | _ASN_ERRLOG(app_errlog, app_key, |
| 444 | "%s: constraint failed (%s:%d)", |
| 445 | td->name, __FILE__, __LINE__); |
| 446 | return -1; |
| 447 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | /* |
| 451 | * This type is implemented using Int3, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 452 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 453 | */ |
| 454 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 455 | Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 456 | td->free_struct = asn_DEF_Int3.free_struct; |
| 457 | td->print_struct = asn_DEF_Int3.print_struct; |
| 458 | td->ber_decoder = asn_DEF_Int3.ber_decoder; |
| 459 | td->der_encoder = asn_DEF_Int3.der_encoder; |
| 460 | td->xer_decoder = asn_DEF_Int3.xer_decoder; |
| 461 | td->xer_encoder = asn_DEF_Int3.xer_encoder; |
| 462 | td->elements = asn_DEF_Int3.elements; |
| 463 | td->elements_count = asn_DEF_Int3.elements_count; |
| 464 | td->specifics = asn_DEF_Int3.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 465 | } |
| 466 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 467 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 468 | Int4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 469 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 470 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 471 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 475 | Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 476 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 477 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 478 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 479 | } |
| 480 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 481 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 482 | Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 483 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 484 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 485 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 486 | } |
| 487 | |
| 488 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 489 | Int4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 490 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 491 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 492 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 493 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 494 | } |
| 495 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 496 | asn_dec_rval_t |
| 497 | Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 498 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 499 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 500 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 501 | } |
| 502 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 503 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 504 | Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 505 | int ilevel, enum xer_encoder_flags_e flags, |
| 506 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 507 | Int4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 508 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | |
| 512 | /*** <<< STAT-DEFS [Int4] >>> ***/ |
| 513 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 514 | static ber_tlv_tag_t asn_DEF_Int4_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 515 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 516 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 517 | asn_TYPE_descriptor_t asn_DEF_Int4 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 518 | "Int4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 519 | "Int4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 520 | Int4_free, |
| 521 | Int4_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 522 | Int4_constraint, |
| 523 | Int4_decode_ber, |
| 524 | Int4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 525 | Int4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 526 | Int4_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 527 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 528 | asn_DEF_Int4_1_tags, |
| 529 | sizeof(asn_DEF_Int4_1_tags) |
| 530 | /sizeof(asn_DEF_Int4_1_tags[0]), /* 1 */ |
| 531 | asn_DEF_Int4_1_tags, /* Same as above */ |
| 532 | sizeof(asn_DEF_Int4_1_tags) |
| 533 | /sizeof(asn_DEF_Int4_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 534 | 0, 0, /* No members */ |
| 535 | 0 /* No specifics */ |
| 536 | }; |
| 537 | |
| 538 | |
| 539 | /*** <<< INCLUDES [Int5] >>> ***/ |
| 540 | |
| 541 | #include <Int4.h> |
| 542 | |
| 543 | /*** <<< TYPE-DECLS [Int5] >>> ***/ |
| 544 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 545 | typedef Int4_t Int5_t; |
| 546 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 547 | /*** <<< FUNC-DECLS [Int5] >>> ***/ |
| 548 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 549 | extern asn_TYPE_descriptor_t asn_DEF_Int5; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 550 | asn_struct_free_f Int5_free; |
| 551 | asn_struct_print_f Int5_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 552 | asn_constr_check_f Int5_constraint; |
| 553 | ber_type_decoder_f Int5_decode_ber; |
| 554 | der_type_encoder_f Int5_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 555 | xer_type_decoder_f Int5_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 556 | xer_type_encoder_f Int5_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 557 | |
| 558 | /*** <<< CODE [Int5] >>> ***/ |
| 559 | |
| 560 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 561 | Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 562 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 563 | const Int4_t *st = (const Int4_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 564 | long value; |
| 565 | |
| 566 | if(!sptr) { |
| 567 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 568 | "%s: value not given (%s:%d)", |
| 569 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 570 | return -1; |
| 571 | } |
| 572 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 573 | if(asn_INTEGER2long(st, &value)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 574 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 575 | "%s: value too large (%s:%d)", |
| 576 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 577 | return -1; |
| 578 | } |
| 579 | |
| 580 | if((value == 5)) { |
| 581 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 582 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 583 | } else { |
| 584 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 585 | "%s: constraint failed (%s:%d)", |
| 586 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 587 | return -1; |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | /* |
| 592 | * This type is implemented using Int4, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 593 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 594 | */ |
| 595 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 596 | Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 597 | td->free_struct = asn_DEF_Int4.free_struct; |
| 598 | td->print_struct = asn_DEF_Int4.print_struct; |
| 599 | td->ber_decoder = asn_DEF_Int4.ber_decoder; |
| 600 | td->der_encoder = asn_DEF_Int4.der_encoder; |
| 601 | td->xer_decoder = asn_DEF_Int4.xer_decoder; |
| 602 | td->xer_encoder = asn_DEF_Int4.xer_encoder; |
| 603 | td->elements = asn_DEF_Int4.elements; |
| 604 | td->elements_count = asn_DEF_Int4.elements_count; |
| 605 | td->specifics = asn_DEF_Int4.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 606 | } |
| 607 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 608 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 609 | Int5_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 610 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 611 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 612 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 613 | } |
| 614 | |
| 615 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 616 | Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 617 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 618 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 619 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 620 | } |
| 621 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 622 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 623 | Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 624 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 625 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 626 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 630 | Int5_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 631 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 632 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 633 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 634 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 635 | } |
| 636 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 637 | asn_dec_rval_t |
| 638 | Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 639 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 640 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 641 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 642 | } |
| 643 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 644 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 645 | Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 646 | int ilevel, enum xer_encoder_flags_e flags, |
| 647 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 648 | Int5_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 649 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | |
| 653 | /*** <<< STAT-DEFS [Int5] >>> ***/ |
| 654 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 655 | static ber_tlv_tag_t asn_DEF_Int5_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 656 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 657 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 658 | asn_TYPE_descriptor_t asn_DEF_Int5 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 659 | "Int5", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 660 | "Int5", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 661 | Int5_free, |
| 662 | Int5_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 663 | Int5_constraint, |
| 664 | Int5_decode_ber, |
| 665 | Int5_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 666 | Int5_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 667 | Int5_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 668 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 669 | asn_DEF_Int5_1_tags, |
| 670 | sizeof(asn_DEF_Int5_1_tags) |
| 671 | /sizeof(asn_DEF_Int5_1_tags[0]), /* 1 */ |
| 672 | asn_DEF_Int5_1_tags, /* Same as above */ |
| 673 | sizeof(asn_DEF_Int5_1_tags) |
| 674 | /sizeof(asn_DEF_Int5_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 675 | 0, 0, /* No members */ |
| 676 | 0 /* No specifics */ |
| 677 | }; |
| 678 | |
| 679 | |
| 680 | /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ |
| 681 | |
| 682 | #include <INTEGER.h> |
| 683 | |
| 684 | /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ |
| 685 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 686 | typedef INTEGER_t ExtensibleExtensions_t; |
| 687 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 688 | /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ |
| 689 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 690 | extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 691 | asn_struct_free_f ExtensibleExtensions_free; |
| 692 | asn_struct_print_f ExtensibleExtensions_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 693 | asn_constr_check_f ExtensibleExtensions_constraint; |
| 694 | ber_type_decoder_f ExtensibleExtensions_decode_ber; |
| 695 | der_type_encoder_f ExtensibleExtensions_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 696 | xer_type_decoder_f ExtensibleExtensions_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 697 | xer_type_encoder_f ExtensibleExtensions_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 698 | |
| 699 | /*** <<< CODE [ExtensibleExtensions] >>> ***/ |
| 700 | |
| 701 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 702 | ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 703 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 704 | const INTEGER_t *st = (const INTEGER_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 705 | long value; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 706 | |
| 707 | if(!sptr) { |
| 708 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 709 | "%s: value not given (%s:%d)", |
| 710 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 711 | return -1; |
| 712 | } |
| 713 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 714 | if(asn_INTEGER2long(st, &value)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 715 | _ASN_ERRLOG(app_errlog, app_key, |
| 716 | "%s: value too large (%s:%d)", |
| 717 | td->name, __FILE__, __LINE__); |
| 718 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 719 | } |
| 720 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 721 | if((value >= 1 && value <= 256)) { |
| 722 | /* Constraint check succeeded */ |
| 723 | return 0; |
| 724 | } else { |
| 725 | _ASN_ERRLOG(app_errlog, app_key, |
| 726 | "%s: constraint failed (%s:%d)", |
| 727 | td->name, __FILE__, __LINE__); |
| 728 | return -1; |
| 729 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 730 | } |
| 731 | |
| 732 | /* |
| 733 | * This type is implemented using INTEGER, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 734 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 735 | */ |
| 736 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 737 | ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 738 | td->free_struct = asn_DEF_INTEGER.free_struct; |
| 739 | td->print_struct = asn_DEF_INTEGER.print_struct; |
| 740 | td->ber_decoder = asn_DEF_INTEGER.ber_decoder; |
| 741 | td->der_encoder = asn_DEF_INTEGER.der_encoder; |
| 742 | td->xer_decoder = asn_DEF_INTEGER.xer_decoder; |
| 743 | td->xer_encoder = asn_DEF_INTEGER.xer_encoder; |
| 744 | td->elements = asn_DEF_INTEGER.elements; |
| 745 | td->elements_count = asn_DEF_INTEGER.elements_count; |
| 746 | td->specifics = asn_DEF_INTEGER.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 747 | } |
| 748 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 749 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 750 | ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 751 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 752 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 753 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 757 | ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 758 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 759 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 760 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 761 | } |
| 762 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 763 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 764 | ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 765 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 766 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 767 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 771 | ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 772 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 773 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 774 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 775 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 776 | } |
| 777 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 778 | asn_dec_rval_t |
| 779 | ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 780 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 781 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 782 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 783 | } |
| 784 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 785 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 786 | ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 787 | int ilevel, enum xer_encoder_flags_e flags, |
| 788 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 789 | ExtensibleExtensions_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 790 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 791 | } |
| 792 | |
| 793 | |
| 794 | /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ |
| 795 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 796 | static ber_tlv_tag_t asn_DEF_ExtensibleExtensions_1_tags[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 797 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 798 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 799 | asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 800 | "ExtensibleExtensions", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 801 | "ExtensibleExtensions", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 802 | ExtensibleExtensions_free, |
| 803 | ExtensibleExtensions_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 804 | ExtensibleExtensions_constraint, |
| 805 | ExtensibleExtensions_decode_ber, |
| 806 | ExtensibleExtensions_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 807 | ExtensibleExtensions_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 808 | ExtensibleExtensions_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 809 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 810 | asn_DEF_ExtensibleExtensions_1_tags, |
| 811 | sizeof(asn_DEF_ExtensibleExtensions_1_tags) |
| 812 | /sizeof(asn_DEF_ExtensibleExtensions_1_tags[0]), /* 1 */ |
| 813 | asn_DEF_ExtensibleExtensions_1_tags, /* Same as above */ |
| 814 | sizeof(asn_DEF_ExtensibleExtensions_1_tags) |
| 815 | /sizeof(asn_DEF_ExtensibleExtensions_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 816 | 0, 0, /* No members */ |
| 817 | 0 /* No specifics */ |
| 818 | }; |
| 819 | |
| 820 | |
| 821 | /*** <<< INCLUDES [Str1] >>> ***/ |
| 822 | |
| 823 | #include <IA5String.h> |
| 824 | |
| 825 | /*** <<< TYPE-DECLS [Str1] >>> ***/ |
| 826 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 827 | typedef IA5String_t Str1_t; |
| 828 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 829 | /*** <<< FUNC-DECLS [Str1] >>> ***/ |
| 830 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 831 | extern asn_TYPE_descriptor_t asn_DEF_Str1; |
| 832 | asn_struct_free_f Str1_free; |
| 833 | asn_struct_print_f Str1_print; |
| 834 | asn_constr_check_f Str1_constraint; |
| 835 | ber_type_decoder_f Str1_decode_ber; |
| 836 | der_type_encoder_f Str1_encode_der; |
| 837 | xer_type_decoder_f Str1_decode_xer; |
| 838 | xer_type_encoder_f Str1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 839 | |
| 840 | /*** <<< CODE [Str1] >>> ***/ |
| 841 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 842 | int |
| 843 | Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 844 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 845 | /* Replace with underlying type checker */ |
| 846 | td->check_constraints = asn_DEF_IA5String.check_constraints; |
| 847 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 848 | } |
| 849 | |
| 850 | /* |
| 851 | * This type is implemented using IA5String, |
| 852 | * so here we adjust the DEF accordingly. |
| 853 | */ |
| 854 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 855 | Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 856 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 857 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 858 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 859 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 860 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 861 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 862 | td->elements = asn_DEF_IA5String.elements; |
| 863 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 864 | td->specifics = asn_DEF_IA5String.specifics; |
| 865 | } |
| 866 | |
| 867 | void |
| 868 | Str1_free(asn_TYPE_descriptor_t *td, |
| 869 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 870 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 871 | td->free_struct(td, struct_ptr, contents_only); |
| 872 | } |
| 873 | |
| 874 | int |
| 875 | Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 876 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 877 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 878 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 879 | } |
| 880 | |
| 881 | asn_dec_rval_t |
| 882 | Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 883 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 884 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 885 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 886 | } |
| 887 | |
| 888 | asn_enc_rval_t |
| 889 | Str1_encode_der(asn_TYPE_descriptor_t *td, |
| 890 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 891 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 892 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 893 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 894 | } |
| 895 | |
| 896 | asn_dec_rval_t |
| 897 | Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 898 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 899 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 900 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 901 | } |
| 902 | |
| 903 | asn_enc_rval_t |
| 904 | Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 905 | int ilevel, enum xer_encoder_flags_e flags, |
| 906 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 907 | Str1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 908 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 909 | } |
| 910 | |
| 911 | |
| 912 | /*** <<< STAT-DEFS [Str1] >>> ***/ |
| 913 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 914 | static ber_tlv_tag_t asn_DEF_Str1_1_tags[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 915 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 916 | }; |
| 917 | asn_TYPE_descriptor_t asn_DEF_Str1 = { |
| 918 | "Str1", |
| 919 | "Str1", |
| 920 | Str1_free, |
| 921 | Str1_print, |
| 922 | Str1_constraint, |
| 923 | Str1_decode_ber, |
| 924 | Str1_encode_der, |
| 925 | Str1_decode_xer, |
| 926 | Str1_encode_xer, |
| 927 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 928 | asn_DEF_Str1_1_tags, |
| 929 | sizeof(asn_DEF_Str1_1_tags) |
| 930 | /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */ |
| 931 | asn_DEF_Str1_1_tags, /* Same as above */ |
| 932 | sizeof(asn_DEF_Str1_1_tags) |
| 933 | /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 934 | 0, 0, /* No members */ |
| 935 | 0 /* No specifics */ |
| 936 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 937 | |
| 938 | |
| 939 | /*** <<< INCLUDES [Str2] >>> ***/ |
| 940 | |
| 941 | #include <Str1.h> |
| 942 | |
| 943 | /*** <<< TYPE-DECLS [Str2] >>> ***/ |
| 944 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 945 | typedef Str1_t Str2_t; |
| 946 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 947 | /*** <<< FUNC-DECLS [Str2] >>> ***/ |
| 948 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 949 | extern asn_TYPE_descriptor_t asn_DEF_Str2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 950 | asn_struct_free_f Str2_free; |
| 951 | asn_struct_print_f Str2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 952 | asn_constr_check_f Str2_constraint; |
| 953 | ber_type_decoder_f Str2_decode_ber; |
| 954 | der_type_encoder_f Str2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 955 | xer_type_decoder_f Str2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 956 | xer_type_encoder_f Str2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 957 | |
| 958 | /*** <<< CTABLES [Str2] >>> ***/ |
| 959 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 960 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 961 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 962 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 963 | const uint8_t *ch = st->buf; |
| 964 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 965 | |
| 966 | for(; ch < end; ch++) { |
| 967 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 968 | if(!(cv <= 127)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 969 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 970 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 971 | } |
| 972 | |
| 973 | |
| 974 | /*** <<< CODE [Str2] >>> ***/ |
| 975 | |
| 976 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 977 | Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 978 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 979 | const Str1_t *st = (const Str1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 980 | size_t size; |
| 981 | |
| 982 | if(!sptr) { |
| 983 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 984 | "%s: value not given (%s:%d)", |
| 985 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 986 | return -1; |
| 987 | } |
| 988 | |
| 989 | size = st->size; |
| 990 | |
| 991 | if(((size <= 20) || (size >= 25 && size <= 30)) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 992 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 993 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 994 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 995 | } else { |
| 996 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 997 | "%s: constraint failed (%s:%d)", |
| 998 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 999 | return -1; |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | /* |
| 1004 | * This type is implemented using Str1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1005 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1006 | */ |
| 1007 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1008 | Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1009 | td->free_struct = asn_DEF_Str1.free_struct; |
| 1010 | td->print_struct = asn_DEF_Str1.print_struct; |
| 1011 | td->ber_decoder = asn_DEF_Str1.ber_decoder; |
| 1012 | td->der_encoder = asn_DEF_Str1.der_encoder; |
| 1013 | td->xer_decoder = asn_DEF_Str1.xer_decoder; |
| 1014 | td->xer_encoder = asn_DEF_Str1.xer_encoder; |
| 1015 | td->elements = asn_DEF_Str1.elements; |
| 1016 | td->elements_count = asn_DEF_Str1.elements_count; |
| 1017 | td->specifics = asn_DEF_Str1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1018 | } |
| 1019 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1020 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1021 | Str2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1022 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1023 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1024 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1028 | Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1029 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1030 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1031 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1032 | } |
| 1033 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1034 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1035 | Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1036 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1037 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1038 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1039 | } |
| 1040 | |
| 1041 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1042 | Str2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1043 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1044 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1045 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1046 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1047 | } |
| 1048 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1049 | asn_dec_rval_t |
| 1050 | Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1051 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1052 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1053 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1054 | } |
| 1055 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1056 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1057 | Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1058 | int ilevel, enum xer_encoder_flags_e flags, |
| 1059 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1060 | Str2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1061 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
| 1064 | |
| 1065 | /*** <<< STAT-DEFS [Str2] >>> ***/ |
| 1066 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1067 | static ber_tlv_tag_t asn_DEF_Str2_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1068 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1069 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1070 | asn_TYPE_descriptor_t asn_DEF_Str2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1071 | "Str2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1072 | "Str2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1073 | Str2_free, |
| 1074 | Str2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1075 | Str2_constraint, |
| 1076 | Str2_decode_ber, |
| 1077 | Str2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1078 | Str2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1079 | Str2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1080 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1081 | asn_DEF_Str2_1_tags, |
| 1082 | sizeof(asn_DEF_Str2_1_tags) |
| 1083 | /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */ |
| 1084 | asn_DEF_Str2_1_tags, /* Same as above */ |
| 1085 | sizeof(asn_DEF_Str2_1_tags) |
| 1086 | /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1087 | 0, 0, /* No members */ |
| 1088 | 0 /* No specifics */ |
| 1089 | }; |
| 1090 | |
| 1091 | |
| 1092 | /*** <<< INCLUDES [Str3] >>> ***/ |
| 1093 | |
| 1094 | #include <Str2.h> |
| 1095 | |
| 1096 | /*** <<< TYPE-DECLS [Str3] >>> ***/ |
| 1097 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1098 | typedef Str2_t Str3_t; |
| 1099 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1100 | /*** <<< FUNC-DECLS [Str3] >>> ***/ |
| 1101 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1102 | extern asn_TYPE_descriptor_t asn_DEF_Str3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1103 | asn_struct_free_f Str3_free; |
| 1104 | asn_struct_print_f Str3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1105 | asn_constr_check_f Str3_constraint; |
| 1106 | ber_type_decoder_f Str3_decode_ber; |
| 1107 | der_type_encoder_f Str3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1108 | xer_type_decoder_f Str3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1109 | xer_type_encoder_f Str3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1110 | |
| 1111 | /*** <<< CTABLES [Str3] >>> ***/ |
| 1112 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1113 | static int permitted_alphabet_table_1[256] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1114 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1115 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1116 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1117 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1118 | 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */ |
| 1119 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 1120 | 0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */ |
| 1121 | }; |
| 1122 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1123 | static int check_permitted_alphabet_1(const void *sptr) { |
| 1124 | int *table = permitted_alphabet_table_1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1125 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1126 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1127 | const uint8_t *ch = st->buf; |
| 1128 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1129 | |
| 1130 | for(; ch < end; ch++) { |
| 1131 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1132 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1133 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1134 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1135 | } |
| 1136 | |
| 1137 | |
| 1138 | /*** <<< CODE [Str3] >>> ***/ |
| 1139 | |
| 1140 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1141 | Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1142 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1143 | const Str2_t *st = (const Str2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1144 | size_t size; |
| 1145 | |
| 1146 | if(!sptr) { |
| 1147 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1148 | "%s: value not given (%s:%d)", |
| 1149 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1150 | return -1; |
| 1151 | } |
| 1152 | |
| 1153 | size = st->size; |
| 1154 | |
| 1155 | if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1156 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1157 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1158 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1159 | } else { |
| 1160 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1161 | "%s: constraint failed (%s:%d)", |
| 1162 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1163 | return -1; |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 1167 | /* |
| 1168 | * This type is implemented using Str2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1169 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1170 | */ |
| 1171 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1172 | Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1173 | td->free_struct = asn_DEF_Str2.free_struct; |
| 1174 | td->print_struct = asn_DEF_Str2.print_struct; |
| 1175 | td->ber_decoder = asn_DEF_Str2.ber_decoder; |
| 1176 | td->der_encoder = asn_DEF_Str2.der_encoder; |
| 1177 | td->xer_decoder = asn_DEF_Str2.xer_decoder; |
| 1178 | td->xer_encoder = asn_DEF_Str2.xer_encoder; |
| 1179 | td->elements = asn_DEF_Str2.elements; |
| 1180 | td->elements_count = asn_DEF_Str2.elements_count; |
| 1181 | td->specifics = asn_DEF_Str2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1182 | } |
| 1183 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1184 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1185 | Str3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1186 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1187 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1188 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1189 | } |
| 1190 | |
| 1191 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1192 | Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1193 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1194 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1195 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1196 | } |
| 1197 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1198 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1199 | Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1200 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1201 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1202 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1203 | } |
| 1204 | |
| 1205 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1206 | Str3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1207 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1208 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1209 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1210 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1211 | } |
| 1212 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1213 | asn_dec_rval_t |
| 1214 | Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1215 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1216 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1217 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1218 | } |
| 1219 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1220 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1221 | Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1222 | int ilevel, enum xer_encoder_flags_e flags, |
| 1223 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1224 | Str3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1225 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1226 | } |
| 1227 | |
| 1228 | |
| 1229 | /*** <<< STAT-DEFS [Str3] >>> ***/ |
| 1230 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1231 | static ber_tlv_tag_t asn_DEF_Str3_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1232 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1233 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1234 | asn_TYPE_descriptor_t asn_DEF_Str3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1235 | "Str3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1236 | "Str3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1237 | Str3_free, |
| 1238 | Str3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1239 | Str3_constraint, |
| 1240 | Str3_decode_ber, |
| 1241 | Str3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1242 | Str3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1243 | Str3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1244 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1245 | asn_DEF_Str3_1_tags, |
| 1246 | sizeof(asn_DEF_Str3_1_tags) |
| 1247 | /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */ |
| 1248 | asn_DEF_Str3_1_tags, /* Same as above */ |
| 1249 | sizeof(asn_DEF_Str3_1_tags) |
| 1250 | /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1251 | 0, 0, /* No members */ |
| 1252 | 0 /* No specifics */ |
| 1253 | }; |
| 1254 | |
| 1255 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1256 | /*** <<< INCLUDES [Str4] >>> ***/ |
| 1257 | |
| 1258 | #include <IA5String.h> |
| 1259 | |
| 1260 | /*** <<< TYPE-DECLS [Str4] >>> ***/ |
| 1261 | |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1262 | typedef IA5String_t Str4_t; |
| 1263 | |
| 1264 | /*** <<< FUNC-DECLS [Str4] >>> ***/ |
| 1265 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1266 | extern asn_TYPE_descriptor_t asn_DEF_Str4; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1267 | asn_struct_free_f Str4_free; |
| 1268 | asn_struct_print_f Str4_print; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1269 | asn_constr_check_f Str4_constraint; |
| 1270 | ber_type_decoder_f Str4_decode_ber; |
| 1271 | der_type_encoder_f Str4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1272 | xer_type_decoder_f Str4_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1273 | xer_type_encoder_f Str4_encode_xer; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1274 | |
| 1275 | /*** <<< CTABLES [Str4] >>> ***/ |
| 1276 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1277 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1278 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1279 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1280 | const uint8_t *ch = st->buf; |
| 1281 | const uint8_t *end = ch + st->size; |
| 1282 | |
| 1283 | for(; ch < end; ch++) { |
| 1284 | uint8_t cv = *ch; |
| 1285 | if(!(cv <= 127)) return -1; |
| 1286 | } |
| 1287 | return 0; |
| 1288 | } |
| 1289 | |
| 1290 | |
| 1291 | /*** <<< CODE [Str4] >>> ***/ |
| 1292 | |
| 1293 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1294 | Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1295 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1296 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1297 | |
| 1298 | if(!sptr) { |
| 1299 | _ASN_ERRLOG(app_errlog, app_key, |
| 1300 | "%s: value not given (%s:%d)", |
| 1301 | td->name, __FILE__, __LINE__); |
| 1302 | return -1; |
| 1303 | } |
| 1304 | |
| 1305 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1306 | if(!check_permitted_alphabet_1(st)) { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1307 | /* Constraint check succeeded */ |
| 1308 | return 0; |
| 1309 | } else { |
| 1310 | _ASN_ERRLOG(app_errlog, app_key, |
| 1311 | "%s: constraint failed (%s:%d)", |
| 1312 | td->name, __FILE__, __LINE__); |
| 1313 | return -1; |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | /* |
| 1318 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1319 | * so here we adjust the DEF accordingly. |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1320 | */ |
| 1321 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1322 | Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1323 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1324 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1325 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1326 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1327 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1328 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1329 | td->elements = asn_DEF_IA5String.elements; |
| 1330 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1331 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1332 | } |
| 1333 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1334 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1335 | Str4_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1336 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1337 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1338 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1339 | } |
| 1340 | |
| 1341 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1342 | Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1343 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1344 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1345 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1346 | } |
| 1347 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1348 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1349 | Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1350 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1351 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1352 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1353 | } |
| 1354 | |
| 1355 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1356 | Str4_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1357 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1358 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1359 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1360 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1361 | } |
| 1362 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1363 | asn_dec_rval_t |
| 1364 | Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1365 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1366 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1367 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1368 | } |
| 1369 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1370 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1371 | Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1372 | int ilevel, enum xer_encoder_flags_e flags, |
| 1373 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1374 | Str4_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1375 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1376 | } |
| 1377 | |
| 1378 | |
| 1379 | /*** <<< STAT-DEFS [Str4] >>> ***/ |
| 1380 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1381 | static ber_tlv_tag_t asn_DEF_Str4_1_tags[] = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1382 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1383 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1384 | asn_TYPE_descriptor_t asn_DEF_Str4 = { |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1385 | "Str4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1386 | "Str4", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1387 | Str4_free, |
| 1388 | Str4_print, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1389 | Str4_constraint, |
| 1390 | Str4_decode_ber, |
| 1391 | Str4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1392 | Str4_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1393 | Str4_encode_xer, |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1394 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1395 | asn_DEF_Str4_1_tags, |
| 1396 | sizeof(asn_DEF_Str4_1_tags) |
| 1397 | /sizeof(asn_DEF_Str4_1_tags[0]), /* 1 */ |
| 1398 | asn_DEF_Str4_1_tags, /* Same as above */ |
| 1399 | sizeof(asn_DEF_Str4_1_tags) |
| 1400 | /sizeof(asn_DEF_Str4_1_tags[0]), /* 1 */ |
vlm | 25e1293 | 2004-09-10 06:07:39 +0000 | [diff] [blame] | 1401 | 0, 0, /* No members */ |
| 1402 | 0 /* No specifics */ |
| 1403 | }; |
| 1404 | |
| 1405 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1406 | /*** <<< INCLUDES [PER-Visible] >>> ***/ |
| 1407 | |
| 1408 | #include <IA5String.h> |
| 1409 | |
| 1410 | /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ |
| 1411 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1412 | typedef IA5String_t PER_Visible_t; |
| 1413 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1414 | /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ |
| 1415 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1416 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1417 | asn_struct_free_f PER_Visible_free; |
| 1418 | asn_struct_print_f PER_Visible_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1419 | asn_constr_check_f PER_Visible_constraint; |
| 1420 | ber_type_decoder_f PER_Visible_decode_ber; |
| 1421 | der_type_encoder_f PER_Visible_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1422 | xer_type_decoder_f PER_Visible_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1423 | xer_type_encoder_f PER_Visible_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1424 | |
| 1425 | /*** <<< CTABLES [PER-Visible] >>> ***/ |
| 1426 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1427 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1428 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1429 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1430 | const uint8_t *ch = st->buf; |
| 1431 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1432 | |
| 1433 | for(; ch < end; ch++) { |
| 1434 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1435 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1436 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1437 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1438 | } |
| 1439 | |
| 1440 | |
| 1441 | /*** <<< CODE [PER-Visible] >>> ***/ |
| 1442 | |
| 1443 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1444 | PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1445 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1446 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1447 | |
| 1448 | if(!sptr) { |
| 1449 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1450 | "%s: value not given (%s:%d)", |
| 1451 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1452 | return -1; |
| 1453 | } |
| 1454 | |
| 1455 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1456 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1457 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1458 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1459 | } else { |
| 1460 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1461 | "%s: constraint failed (%s:%d)", |
| 1462 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1463 | return -1; |
| 1464 | } |
| 1465 | } |
| 1466 | |
| 1467 | /* |
| 1468 | * This type is implemented using IA5String, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1469 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1470 | */ |
| 1471 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1472 | PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1473 | td->free_struct = asn_DEF_IA5String.free_struct; |
| 1474 | td->print_struct = asn_DEF_IA5String.print_struct; |
| 1475 | td->ber_decoder = asn_DEF_IA5String.ber_decoder; |
| 1476 | td->der_encoder = asn_DEF_IA5String.der_encoder; |
| 1477 | td->xer_decoder = asn_DEF_IA5String.xer_decoder; |
| 1478 | td->xer_encoder = asn_DEF_IA5String.xer_encoder; |
| 1479 | td->elements = asn_DEF_IA5String.elements; |
| 1480 | td->elements_count = asn_DEF_IA5String.elements_count; |
| 1481 | td->specifics = asn_DEF_IA5String.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1482 | } |
| 1483 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1484 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1485 | PER_Visible_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1486 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1487 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1488 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1489 | } |
| 1490 | |
| 1491 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1492 | PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1493 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1494 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1495 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1496 | } |
| 1497 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1498 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1499 | PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1500 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1501 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1502 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1503 | } |
| 1504 | |
| 1505 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1506 | PER_Visible_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1507 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1508 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1509 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1510 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1511 | } |
| 1512 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1513 | asn_dec_rval_t |
| 1514 | PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1515 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1516 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1517 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1518 | } |
| 1519 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1520 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1521 | PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1522 | int ilevel, enum xer_encoder_flags_e flags, |
| 1523 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1524 | PER_Visible_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1525 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1526 | } |
| 1527 | |
| 1528 | |
| 1529 | /*** <<< STAT-DEFS [PER-Visible] >>> ***/ |
| 1530 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1531 | static ber_tlv_tag_t asn_DEF_PER_Visible_1_tags[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1532 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
| 1533 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1534 | asn_TYPE_descriptor_t asn_DEF_PER_Visible = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1535 | "PER-Visible", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1536 | "PER-Visible", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1537 | PER_Visible_free, |
| 1538 | PER_Visible_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1539 | PER_Visible_constraint, |
| 1540 | PER_Visible_decode_ber, |
| 1541 | PER_Visible_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1542 | PER_Visible_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1543 | PER_Visible_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1544 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1545 | asn_DEF_PER_Visible_1_tags, |
| 1546 | sizeof(asn_DEF_PER_Visible_1_tags) |
| 1547 | /sizeof(asn_DEF_PER_Visible_1_tags[0]), /* 1 */ |
| 1548 | asn_DEF_PER_Visible_1_tags, /* Same as above */ |
| 1549 | sizeof(asn_DEF_PER_Visible_1_tags) |
| 1550 | /sizeof(asn_DEF_PER_Visible_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1551 | 0, 0, /* No members */ |
| 1552 | 0 /* No specifics */ |
| 1553 | }; |
| 1554 | |
| 1555 | |
| 1556 | /*** <<< INCLUDES [PER-Visible-2] >>> ***/ |
| 1557 | |
| 1558 | #include <PER-Visible.h> |
| 1559 | |
| 1560 | /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ |
| 1561 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1562 | typedef PER_Visible_t PER_Visible_2_t; |
| 1563 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1564 | /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ |
| 1565 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1566 | extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1567 | asn_struct_free_f PER_Visible_2_free; |
| 1568 | asn_struct_print_f PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1569 | asn_constr_check_f PER_Visible_2_constraint; |
| 1570 | ber_type_decoder_f PER_Visible_2_decode_ber; |
| 1571 | der_type_encoder_f PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1572 | xer_type_decoder_f PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1573 | xer_type_encoder_f PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1574 | |
| 1575 | /*** <<< CTABLES [PER-Visible-2] >>> ***/ |
| 1576 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1577 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1578 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1579 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1580 | const uint8_t *ch = st->buf; |
| 1581 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1582 | |
| 1583 | for(; ch < end; ch++) { |
| 1584 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1585 | if(!(cv >= 69 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1586 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1587 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1588 | } |
| 1589 | |
| 1590 | |
| 1591 | /*** <<< CODE [PER-Visible-2] >>> ***/ |
| 1592 | |
| 1593 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1594 | PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1595 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1596 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1597 | |
| 1598 | if(!sptr) { |
| 1599 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1600 | "%s: value not given (%s:%d)", |
| 1601 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1602 | return -1; |
| 1603 | } |
| 1604 | |
| 1605 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1606 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1607 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1608 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1609 | } else { |
| 1610 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1611 | "%s: constraint failed (%s:%d)", |
| 1612 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1613 | return -1; |
| 1614 | } |
| 1615 | } |
| 1616 | |
| 1617 | /* |
| 1618 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1619 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1620 | */ |
| 1621 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1622 | PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1623 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1624 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1625 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1626 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1627 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1628 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1629 | td->elements = asn_DEF_PER_Visible.elements; |
| 1630 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1631 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1632 | } |
| 1633 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1634 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1635 | PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1636 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1637 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1638 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1642 | PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1643 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1644 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1645 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1646 | } |
| 1647 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1648 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1649 | PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1650 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1651 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1652 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1653 | } |
| 1654 | |
| 1655 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1656 | PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1657 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1658 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1659 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1660 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1661 | } |
| 1662 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1663 | asn_dec_rval_t |
| 1664 | PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1665 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1666 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1667 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1668 | } |
| 1669 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1670 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1671 | PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1672 | int ilevel, enum xer_encoder_flags_e flags, |
| 1673 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1674 | PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1675 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1676 | } |
| 1677 | |
| 1678 | |
| 1679 | /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ |
| 1680 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1681 | static ber_tlv_tag_t asn_DEF_PER_Visible_2_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1682 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1683 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1684 | asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1685 | "PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1686 | "PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1687 | PER_Visible_2_free, |
| 1688 | PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1689 | PER_Visible_2_constraint, |
| 1690 | PER_Visible_2_decode_ber, |
| 1691 | PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1692 | PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1693 | PER_Visible_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1694 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1695 | asn_DEF_PER_Visible_2_1_tags, |
| 1696 | sizeof(asn_DEF_PER_Visible_2_1_tags) |
| 1697 | /sizeof(asn_DEF_PER_Visible_2_1_tags[0]), /* 1 */ |
| 1698 | asn_DEF_PER_Visible_2_1_tags, /* Same as above */ |
| 1699 | sizeof(asn_DEF_PER_Visible_2_1_tags) |
| 1700 | /sizeof(asn_DEF_PER_Visible_2_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1701 | 0, 0, /* No members */ |
| 1702 | 0 /* No specifics */ |
| 1703 | }; |
| 1704 | |
| 1705 | |
| 1706 | /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ |
| 1707 | |
| 1708 | #include <PER-Visible.h> |
| 1709 | |
| 1710 | /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1711 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1712 | typedef PER_Visible_t Not_PER_Visible_1_t; |
| 1713 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1714 | /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ |
| 1715 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1716 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1717 | asn_struct_free_f Not_PER_Visible_1_free; |
| 1718 | asn_struct_print_f Not_PER_Visible_1_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1719 | asn_constr_check_f Not_PER_Visible_1_constraint; |
| 1720 | ber_type_decoder_f Not_PER_Visible_1_decode_ber; |
| 1721 | der_type_encoder_f Not_PER_Visible_1_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1722 | xer_type_decoder_f Not_PER_Visible_1_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1723 | xer_type_encoder_f Not_PER_Visible_1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1724 | |
| 1725 | /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ |
| 1726 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1727 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1728 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1729 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 1730 | const uint8_t *ch = st->buf; |
| 1731 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1732 | |
| 1733 | for(; ch < end; ch++) { |
| 1734 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1735 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1736 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1737 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1738 | } |
| 1739 | |
| 1740 | |
| 1741 | /*** <<< CODE [Not-PER-Visible-1] >>> ***/ |
| 1742 | |
| 1743 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1744 | Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1745 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1746 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1747 | |
| 1748 | if(!sptr) { |
| 1749 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1750 | "%s: value not given (%s:%d)", |
| 1751 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1752 | return -1; |
| 1753 | } |
| 1754 | |
| 1755 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1756 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1757 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 1758 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1759 | } else { |
| 1760 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1761 | "%s: constraint failed (%s:%d)", |
| 1762 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1763 | return -1; |
| 1764 | } |
| 1765 | } |
| 1766 | |
| 1767 | /* |
| 1768 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1769 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1770 | */ |
| 1771 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1772 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1773 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1774 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1775 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1776 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1777 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1778 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1779 | td->elements = asn_DEF_PER_Visible.elements; |
| 1780 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1781 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1782 | } |
| 1783 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1784 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1785 | Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1786 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1787 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1788 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1789 | } |
| 1790 | |
| 1791 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1792 | Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1793 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1794 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1795 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1796 | } |
| 1797 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1798 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1799 | Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1800 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1801 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1802 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1803 | } |
| 1804 | |
| 1805 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1806 | Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1807 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1808 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1809 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1810 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1811 | } |
| 1812 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1813 | asn_dec_rval_t |
| 1814 | Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1815 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1816 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1817 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1818 | } |
| 1819 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1820 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1821 | Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1822 | int ilevel, enum xer_encoder_flags_e flags, |
| 1823 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1824 | Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1825 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1826 | } |
| 1827 | |
| 1828 | |
| 1829 | /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ |
| 1830 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1831 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1832 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1833 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1834 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1835 | "Not-PER-Visible-1", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1836 | "Not-PER-Visible-1", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1837 | Not_PER_Visible_1_free, |
| 1838 | Not_PER_Visible_1_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1839 | Not_PER_Visible_1_constraint, |
| 1840 | Not_PER_Visible_1_decode_ber, |
| 1841 | Not_PER_Visible_1_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1842 | Not_PER_Visible_1_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1843 | Not_PER_Visible_1_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1844 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1845 | asn_DEF_Not_PER_Visible_1_1_tags, |
| 1846 | sizeof(asn_DEF_Not_PER_Visible_1_1_tags) |
| 1847 | /sizeof(asn_DEF_Not_PER_Visible_1_1_tags[0]), /* 1 */ |
| 1848 | asn_DEF_Not_PER_Visible_1_1_tags, /* Same as above */ |
| 1849 | sizeof(asn_DEF_Not_PER_Visible_1_1_tags) |
| 1850 | /sizeof(asn_DEF_Not_PER_Visible_1_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1851 | 0, 0, /* No members */ |
| 1852 | 0 /* No specifics */ |
| 1853 | }; |
| 1854 | |
| 1855 | |
| 1856 | /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ |
| 1857 | |
| 1858 | #include <PER-Visible.h> |
| 1859 | |
| 1860 | /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1861 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1862 | typedef PER_Visible_t Not_PER_Visible_2_t; |
| 1863 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1864 | /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ |
| 1865 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1866 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1867 | asn_struct_free_f Not_PER_Visible_2_free; |
| 1868 | asn_struct_print_f Not_PER_Visible_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1869 | asn_constr_check_f Not_PER_Visible_2_constraint; |
| 1870 | ber_type_decoder_f Not_PER_Visible_2_decode_ber; |
| 1871 | der_type_encoder_f Not_PER_Visible_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1872 | xer_type_decoder_f Not_PER_Visible_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1873 | xer_type_encoder_f Not_PER_Visible_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1874 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1875 | /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ |
| 1876 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1877 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1878 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1879 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1880 | const uint8_t *ch = st->buf; |
| 1881 | const uint8_t *end = ch + st->size; |
| 1882 | |
| 1883 | for(; ch < end; ch++) { |
| 1884 | uint8_t cv = *ch; |
| 1885 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 1886 | } |
| 1887 | return 0; |
| 1888 | } |
| 1889 | |
| 1890 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1891 | /*** <<< CODE [Not-PER-Visible-2] >>> ***/ |
| 1892 | |
| 1893 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1894 | Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1895 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 1896 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1897 | |
| 1898 | if(!sptr) { |
| 1899 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 1900 | "%s: value not given (%s:%d)", |
| 1901 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1902 | return -1; |
| 1903 | } |
| 1904 | |
| 1905 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1906 | if(!check_permitted_alphabet_1(st)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 1907 | /* Constraint check succeeded */ |
| 1908 | return 0; |
| 1909 | } else { |
| 1910 | _ASN_ERRLOG(app_errlog, app_key, |
| 1911 | "%s: constraint failed (%s:%d)", |
| 1912 | td->name, __FILE__, __LINE__); |
| 1913 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1914 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1915 | } |
| 1916 | |
| 1917 | /* |
| 1918 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 1919 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1920 | */ |
| 1921 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1922 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1923 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 1924 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 1925 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 1926 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 1927 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 1928 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 1929 | td->elements = asn_DEF_PER_Visible.elements; |
| 1930 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 1931 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1932 | } |
| 1933 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1934 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1935 | Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1936 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1937 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1938 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1939 | } |
| 1940 | |
| 1941 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1942 | Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1943 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1944 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1945 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 1946 | } |
| 1947 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1948 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1949 | Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1950 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1951 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1952 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1953 | } |
| 1954 | |
| 1955 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1956 | Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1957 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 1958 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1959 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1960 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 1961 | } |
| 1962 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1963 | asn_dec_rval_t |
| 1964 | Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 1965 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1966 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1967 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 1968 | } |
| 1969 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1970 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1971 | Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1972 | int ilevel, enum xer_encoder_flags_e flags, |
| 1973 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1974 | Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1975 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1976 | } |
| 1977 | |
| 1978 | |
| 1979 | /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ |
| 1980 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1981 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 1982 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1983 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 1984 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1985 | "Not-PER-Visible-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 1986 | "Not-PER-Visible-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1987 | Not_PER_Visible_2_free, |
| 1988 | Not_PER_Visible_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1989 | Not_PER_Visible_2_constraint, |
| 1990 | Not_PER_Visible_2_decode_ber, |
| 1991 | Not_PER_Visible_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 1992 | Not_PER_Visible_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 1993 | Not_PER_Visible_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1994 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 1995 | asn_DEF_Not_PER_Visible_2_1_tags, |
| 1996 | sizeof(asn_DEF_Not_PER_Visible_2_1_tags) |
| 1997 | /sizeof(asn_DEF_Not_PER_Visible_2_1_tags[0]), /* 1 */ |
| 1998 | asn_DEF_Not_PER_Visible_2_1_tags, /* Same as above */ |
| 1999 | sizeof(asn_DEF_Not_PER_Visible_2_1_tags) |
| 2000 | /sizeof(asn_DEF_Not_PER_Visible_2_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2001 | 0, 0, /* No members */ |
| 2002 | 0 /* No specifics */ |
| 2003 | }; |
| 2004 | |
| 2005 | |
| 2006 | /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ |
| 2007 | |
| 2008 | #include <PER-Visible.h> |
| 2009 | |
| 2010 | /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2011 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2012 | typedef PER_Visible_t Not_PER_Visible_3_t; |
| 2013 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2014 | /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ |
| 2015 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2016 | extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2017 | asn_struct_free_f Not_PER_Visible_3_free; |
| 2018 | asn_struct_print_f Not_PER_Visible_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2019 | asn_constr_check_f Not_PER_Visible_3_constraint; |
| 2020 | ber_type_decoder_f Not_PER_Visible_3_decode_ber; |
| 2021 | der_type_encoder_f Not_PER_Visible_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2022 | xer_type_decoder_f Not_PER_Visible_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2023 | xer_type_encoder_f Not_PER_Visible_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2024 | |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2025 | /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ |
| 2026 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2027 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2028 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2029 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2030 | const uint8_t *ch = st->buf; |
| 2031 | const uint8_t *end = ch + st->size; |
| 2032 | |
| 2033 | for(; ch < end; ch++) { |
| 2034 | uint8_t cv = *ch; |
| 2035 | if(!(cv >= 65 && cv <= 66)) return -1; |
| 2036 | } |
| 2037 | return 0; |
| 2038 | } |
| 2039 | |
| 2040 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2041 | /*** <<< CODE [Not-PER-Visible-3] >>> ***/ |
| 2042 | |
| 2043 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2044 | Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2045 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2046 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2047 | |
| 2048 | if(!sptr) { |
| 2049 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2050 | "%s: value not given (%s:%d)", |
| 2051 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2052 | return -1; |
| 2053 | } |
| 2054 | |
| 2055 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2056 | if(!check_permitted_alphabet_1(st)) { |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2057 | /* Constraint check succeeded */ |
| 2058 | return 0; |
| 2059 | } else { |
| 2060 | _ASN_ERRLOG(app_errlog, app_key, |
| 2061 | "%s: constraint failed (%s:%d)", |
| 2062 | td->name, __FILE__, __LINE__); |
| 2063 | return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2064 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2065 | } |
| 2066 | |
| 2067 | /* |
| 2068 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2069 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2070 | */ |
| 2071 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2072 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2073 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2074 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2075 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2076 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2077 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2078 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2079 | td->elements = asn_DEF_PER_Visible.elements; |
| 2080 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2081 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2082 | } |
| 2083 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2084 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2085 | Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2086 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2087 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2088 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2089 | } |
| 2090 | |
| 2091 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2092 | Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2093 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2094 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2095 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2096 | } |
| 2097 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2098 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2099 | Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2100 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2101 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2102 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2103 | } |
| 2104 | |
| 2105 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2106 | Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2107 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2108 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2109 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2110 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2111 | } |
| 2112 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2113 | asn_dec_rval_t |
| 2114 | Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2115 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2116 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2117 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2118 | } |
| 2119 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2120 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2121 | Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2122 | int ilevel, enum xer_encoder_flags_e flags, |
| 2123 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2124 | Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2125 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2126 | } |
| 2127 | |
| 2128 | |
| 2129 | /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ |
| 2130 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2131 | static ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2132 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2133 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2134 | asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2135 | "Not-PER-Visible-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2136 | "Not-PER-Visible-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2137 | Not_PER_Visible_3_free, |
| 2138 | Not_PER_Visible_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2139 | Not_PER_Visible_3_constraint, |
| 2140 | Not_PER_Visible_3_decode_ber, |
| 2141 | Not_PER_Visible_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2142 | Not_PER_Visible_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2143 | Not_PER_Visible_3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2144 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2145 | asn_DEF_Not_PER_Visible_3_1_tags, |
| 2146 | sizeof(asn_DEF_Not_PER_Visible_3_1_tags) |
| 2147 | /sizeof(asn_DEF_Not_PER_Visible_3_1_tags[0]), /* 1 */ |
| 2148 | asn_DEF_Not_PER_Visible_3_1_tags, /* Same as above */ |
| 2149 | sizeof(asn_DEF_Not_PER_Visible_3_1_tags) |
| 2150 | /sizeof(asn_DEF_Not_PER_Visible_3_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2151 | 0, 0, /* No members */ |
| 2152 | 0 /* No specifics */ |
| 2153 | }; |
| 2154 | |
| 2155 | |
| 2156 | /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ |
| 2157 | |
| 2158 | #include <PER-Visible.h> |
| 2159 | |
| 2160 | /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2161 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2162 | typedef PER_Visible_t SIZE_but_not_FROM_t; |
| 2163 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2164 | /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ |
| 2165 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2166 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2167 | asn_struct_free_f SIZE_but_not_FROM_free; |
| 2168 | asn_struct_print_f SIZE_but_not_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2169 | asn_constr_check_f SIZE_but_not_FROM_constraint; |
| 2170 | ber_type_decoder_f SIZE_but_not_FROM_decode_ber; |
| 2171 | der_type_encoder_f SIZE_but_not_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2172 | xer_type_decoder_f SIZE_but_not_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2173 | xer_type_encoder_f SIZE_but_not_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2174 | |
| 2175 | /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ |
| 2176 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2177 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2178 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2179 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2180 | const uint8_t *ch = st->buf; |
| 2181 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2182 | |
| 2183 | for(; ch < end; ch++) { |
| 2184 | uint8_t cv = *ch; |
vlm | 26afd20 | 2004-08-25 02:08:08 +0000 | [diff] [blame] | 2185 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2186 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2187 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2188 | } |
| 2189 | |
| 2190 | |
| 2191 | /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ |
| 2192 | |
| 2193 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2194 | SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2195 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2196 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2197 | size_t size; |
| 2198 | |
| 2199 | if(!sptr) { |
| 2200 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2201 | "%s: value not given (%s:%d)", |
| 2202 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2203 | return -1; |
| 2204 | } |
| 2205 | |
| 2206 | size = st->size; |
| 2207 | |
| 2208 | if((size >= 1 && size <= 4) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2209 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2210 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2211 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2212 | } else { |
| 2213 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2214 | "%s: constraint failed (%s:%d)", |
| 2215 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2216 | return -1; |
| 2217 | } |
| 2218 | } |
| 2219 | |
| 2220 | /* |
| 2221 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2222 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2223 | */ |
| 2224 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2225 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2226 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2227 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2228 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2229 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2230 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2231 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2232 | td->elements = asn_DEF_PER_Visible.elements; |
| 2233 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2234 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2235 | } |
| 2236 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2237 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2238 | SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2239 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2240 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2241 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2242 | } |
| 2243 | |
| 2244 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2245 | SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2246 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2247 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2248 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2249 | } |
| 2250 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2251 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2252 | SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2253 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2254 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2255 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2256 | } |
| 2257 | |
| 2258 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2259 | SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2260 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2261 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2262 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2263 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2264 | } |
| 2265 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2266 | asn_dec_rval_t |
| 2267 | SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2268 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2269 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2270 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2271 | } |
| 2272 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2273 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2274 | SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2275 | int ilevel, enum xer_encoder_flags_e flags, |
| 2276 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2277 | SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2278 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2279 | } |
| 2280 | |
| 2281 | |
| 2282 | /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ |
| 2283 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2284 | static ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2285 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2286 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2287 | asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2288 | "SIZE-but-not-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2289 | "SIZE-but-not-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2290 | SIZE_but_not_FROM_free, |
| 2291 | SIZE_but_not_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2292 | SIZE_but_not_FROM_constraint, |
| 2293 | SIZE_but_not_FROM_decode_ber, |
| 2294 | SIZE_but_not_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2295 | SIZE_but_not_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2296 | SIZE_but_not_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2297 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2298 | asn_DEF_SIZE_but_not_FROM_1_tags, |
| 2299 | sizeof(asn_DEF_SIZE_but_not_FROM_1_tags) |
| 2300 | /sizeof(asn_DEF_SIZE_but_not_FROM_1_tags[0]), /* 1 */ |
| 2301 | asn_DEF_SIZE_but_not_FROM_1_tags, /* Same as above */ |
| 2302 | sizeof(asn_DEF_SIZE_but_not_FROM_1_tags) |
| 2303 | /sizeof(asn_DEF_SIZE_but_not_FROM_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2304 | 0, 0, /* No members */ |
| 2305 | 0 /* No specifics */ |
| 2306 | }; |
| 2307 | |
| 2308 | |
| 2309 | /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ |
| 2310 | |
| 2311 | #include <PER-Visible.h> |
| 2312 | |
| 2313 | /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ |
| 2314 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2315 | typedef PER_Visible_t SIZE_and_FROM_t; |
| 2316 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2317 | /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ |
| 2318 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2319 | extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2320 | asn_struct_free_f SIZE_and_FROM_free; |
| 2321 | asn_struct_print_f SIZE_and_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2322 | asn_constr_check_f SIZE_and_FROM_constraint; |
| 2323 | ber_type_decoder_f SIZE_and_FROM_decode_ber; |
| 2324 | der_type_encoder_f SIZE_and_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2325 | xer_type_decoder_f SIZE_and_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2326 | xer_type_encoder_f SIZE_and_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2327 | |
| 2328 | /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ |
| 2329 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2330 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2331 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2332 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2333 | const uint8_t *ch = st->buf; |
| 2334 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2335 | |
| 2336 | for(; ch < end; ch++) { |
| 2337 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2338 | if(!(cv >= 65 && cv <= 68)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2339 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2340 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2341 | } |
| 2342 | |
| 2343 | |
| 2344 | /*** <<< CODE [SIZE-and-FROM] >>> ***/ |
| 2345 | |
| 2346 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2347 | SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2348 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2349 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2350 | size_t size; |
| 2351 | |
| 2352 | if(!sptr) { |
| 2353 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2354 | "%s: value not given (%s:%d)", |
| 2355 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2356 | return -1; |
| 2357 | } |
| 2358 | |
| 2359 | size = st->size; |
| 2360 | |
| 2361 | if((size >= 1 && size <= 4) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2362 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2363 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2364 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2365 | } else { |
| 2366 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2367 | "%s: constraint failed (%s:%d)", |
| 2368 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2369 | return -1; |
| 2370 | } |
| 2371 | } |
| 2372 | |
| 2373 | /* |
| 2374 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2375 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2376 | */ |
| 2377 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2378 | SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2379 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2380 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2381 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2382 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2383 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2384 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2385 | td->elements = asn_DEF_PER_Visible.elements; |
| 2386 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2387 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2388 | } |
| 2389 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2390 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2391 | SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2392 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2393 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2394 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2395 | } |
| 2396 | |
| 2397 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2398 | SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2399 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2400 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2401 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2402 | } |
| 2403 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2404 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2405 | SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2406 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2407 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2408 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2409 | } |
| 2410 | |
| 2411 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2412 | SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2413 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2414 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2415 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2416 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2417 | } |
| 2418 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2419 | asn_dec_rval_t |
| 2420 | SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2421 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2422 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2423 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2424 | } |
| 2425 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2426 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2427 | SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2428 | int ilevel, enum xer_encoder_flags_e flags, |
| 2429 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2430 | SIZE_and_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2431 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2432 | } |
| 2433 | |
| 2434 | |
| 2435 | /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ |
| 2436 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2437 | static ber_tlv_tag_t asn_DEF_SIZE_and_FROM_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2438 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2439 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2440 | asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2441 | "SIZE-and-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2442 | "SIZE-and-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2443 | SIZE_and_FROM_free, |
| 2444 | SIZE_and_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2445 | SIZE_and_FROM_constraint, |
| 2446 | SIZE_and_FROM_decode_ber, |
| 2447 | SIZE_and_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2448 | SIZE_and_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2449 | SIZE_and_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2450 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2451 | asn_DEF_SIZE_and_FROM_1_tags, |
| 2452 | sizeof(asn_DEF_SIZE_and_FROM_1_tags) |
| 2453 | /sizeof(asn_DEF_SIZE_and_FROM_1_tags[0]), /* 1 */ |
| 2454 | asn_DEF_SIZE_and_FROM_1_tags, /* Same as above */ |
| 2455 | sizeof(asn_DEF_SIZE_and_FROM_1_tags) |
| 2456 | /sizeof(asn_DEF_SIZE_and_FROM_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2457 | 0, 0, /* No members */ |
| 2458 | 0 /* No specifics */ |
| 2459 | }; |
| 2460 | |
| 2461 | |
| 2462 | /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2463 | |
| 2464 | #include <PER-Visible.h> |
| 2465 | |
| 2466 | /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2467 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2468 | typedef PER_Visible_t Neither_SIZE_nor_FROM_t; |
| 2469 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2470 | /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2471 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2472 | extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2473 | asn_struct_free_f Neither_SIZE_nor_FROM_free; |
| 2474 | asn_struct_print_f Neither_SIZE_nor_FROM_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2475 | asn_constr_check_f Neither_SIZE_nor_FROM_constraint; |
| 2476 | ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; |
| 2477 | der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2478 | xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2479 | xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2480 | |
| 2481 | /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ |
| 2482 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2483 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2484 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2485 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2486 | const uint8_t *ch = st->buf; |
| 2487 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2488 | |
| 2489 | for(; ch < end; ch++) { |
| 2490 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2491 | if(!(cv >= 65 && cv <= 70)) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2492 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2493 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | |
| 2497 | /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ |
| 2498 | |
| 2499 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2500 | Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2501 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2502 | const PER_Visible_t *st = (const PER_Visible_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2503 | |
| 2504 | if(!sptr) { |
| 2505 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2506 | "%s: value not given (%s:%d)", |
| 2507 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2508 | return -1; |
| 2509 | } |
| 2510 | |
| 2511 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2512 | if(!check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2513 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2514 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2515 | } else { |
| 2516 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2517 | "%s: constraint failed (%s:%d)", |
| 2518 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2519 | return -1; |
| 2520 | } |
| 2521 | } |
| 2522 | |
| 2523 | /* |
| 2524 | * This type is implemented using PER_Visible, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2525 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2526 | */ |
| 2527 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2528 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2529 | td->free_struct = asn_DEF_PER_Visible.free_struct; |
| 2530 | td->print_struct = asn_DEF_PER_Visible.print_struct; |
| 2531 | td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; |
| 2532 | td->der_encoder = asn_DEF_PER_Visible.der_encoder; |
| 2533 | td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; |
| 2534 | td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; |
| 2535 | td->elements = asn_DEF_PER_Visible.elements; |
| 2536 | td->elements_count = asn_DEF_PER_Visible.elements_count; |
| 2537 | td->specifics = asn_DEF_PER_Visible.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2538 | } |
| 2539 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2540 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2541 | Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2542 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2543 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2544 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2545 | } |
| 2546 | |
| 2547 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2548 | Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2549 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2550 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2551 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2552 | } |
| 2553 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2554 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2555 | Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2556 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2557 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2558 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2559 | } |
| 2560 | |
| 2561 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2562 | Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2563 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2564 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2565 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2566 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2567 | } |
| 2568 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2569 | asn_dec_rval_t |
| 2570 | Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2571 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2572 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2573 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2574 | } |
| 2575 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2576 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2577 | Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2578 | int ilevel, enum xer_encoder_flags_e flags, |
| 2579 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2580 | Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2581 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2582 | } |
| 2583 | |
| 2584 | |
| 2585 | /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ |
| 2586 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2587 | static ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2588 | (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2589 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2590 | asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2591 | "Neither-SIZE-nor-FROM", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2592 | "Neither-SIZE-nor-FROM", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2593 | Neither_SIZE_nor_FROM_free, |
| 2594 | Neither_SIZE_nor_FROM_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2595 | Neither_SIZE_nor_FROM_constraint, |
| 2596 | Neither_SIZE_nor_FROM_decode_ber, |
| 2597 | Neither_SIZE_nor_FROM_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2598 | Neither_SIZE_nor_FROM_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2599 | Neither_SIZE_nor_FROM_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2600 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2601 | asn_DEF_Neither_SIZE_nor_FROM_1_tags, |
| 2602 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags) |
| 2603 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags[0]), /* 1 */ |
| 2604 | asn_DEF_Neither_SIZE_nor_FROM_1_tags, /* Same as above */ |
| 2605 | sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags) |
| 2606 | /sizeof(asn_DEF_Neither_SIZE_nor_FROM_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2607 | 0, 0, /* No members */ |
| 2608 | 0 /* No specifics */ |
| 2609 | }; |
| 2610 | |
| 2611 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2612 | /*** <<< INCLUDES [Utf8-4] >>> ***/ |
| 2613 | |
| 2614 | #include <UTF8String.h> |
| 2615 | |
| 2616 | /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ |
| 2617 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2618 | typedef UTF8String_t Utf8_4_t; |
| 2619 | |
| 2620 | /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ |
| 2621 | |
| 2622 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; |
| 2623 | asn_struct_free_f Utf8_4_free; |
| 2624 | asn_struct_print_f Utf8_4_print; |
| 2625 | asn_constr_check_f Utf8_4_constraint; |
| 2626 | ber_type_decoder_f Utf8_4_decode_ber; |
| 2627 | der_type_encoder_f Utf8_4_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2628 | xer_type_decoder_f Utf8_4_decode_xer; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2629 | xer_type_encoder_f Utf8_4_encode_xer; |
| 2630 | |
| 2631 | /*** <<< CTABLES [Utf8-4] >>> ***/ |
| 2632 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2633 | static int check_permitted_alphabet_1(const void *sptr) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2634 | if(UTF8String_length((const UTF8String_t *)sptr) < 0) |
| 2635 | return -1; /* Alphabet (sic!) test failed. */ |
| 2636 | |
| 2637 | return 0; |
| 2638 | } |
| 2639 | |
| 2640 | |
| 2641 | /*** <<< CODE [Utf8-4] >>> ***/ |
| 2642 | |
| 2643 | int |
| 2644 | Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 2645 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2646 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2647 | |
| 2648 | if(!sptr) { |
| 2649 | _ASN_ERRLOG(app_errlog, app_key, |
| 2650 | "%s: value not given (%s:%d)", |
| 2651 | td->name, __FILE__, __LINE__); |
| 2652 | return -1; |
| 2653 | } |
| 2654 | |
| 2655 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2656 | if(!check_permitted_alphabet_1(st)) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2657 | /* Constraint check succeeded */ |
| 2658 | return 0; |
| 2659 | } else { |
| 2660 | _ASN_ERRLOG(app_errlog, app_key, |
| 2661 | "%s: constraint failed (%s:%d)", |
| 2662 | td->name, __FILE__, __LINE__); |
| 2663 | return -1; |
| 2664 | } |
| 2665 | } |
| 2666 | |
| 2667 | /* |
| 2668 | * This type is implemented using UTF8String, |
| 2669 | * so here we adjust the DEF accordingly. |
| 2670 | */ |
| 2671 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2672 | Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2673 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 2674 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 2675 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 2676 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 2677 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 2678 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 2679 | td->elements = asn_DEF_UTF8String.elements; |
| 2680 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 2681 | td->specifics = asn_DEF_UTF8String.specifics; |
| 2682 | } |
| 2683 | |
| 2684 | void |
| 2685 | Utf8_4_free(asn_TYPE_descriptor_t *td, |
| 2686 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2687 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2688 | td->free_struct(td, struct_ptr, contents_only); |
| 2689 | } |
| 2690 | |
| 2691 | int |
| 2692 | Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 2693 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2694 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2695 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2696 | } |
| 2697 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2698 | asn_dec_rval_t |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2699 | Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2700 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2701 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2702 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 2703 | } |
| 2704 | |
| 2705 | asn_enc_rval_t |
| 2706 | Utf8_4_encode_der(asn_TYPE_descriptor_t *td, |
| 2707 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2708 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2709 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2710 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2711 | } |
| 2712 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2713 | asn_dec_rval_t |
| 2714 | Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2715 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2716 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2717 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2718 | } |
| 2719 | |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2720 | asn_enc_rval_t |
| 2721 | Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 2722 | int ilevel, enum xer_encoder_flags_e flags, |
| 2723 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2724 | Utf8_4_1_inherit_TYPE_descriptor(td); |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2725 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 2726 | } |
| 2727 | |
| 2728 | |
| 2729 | /*** <<< STAT-DEFS [Utf8-4] >>> ***/ |
| 2730 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2731 | static ber_tlv_tag_t asn_DEF_Utf8_4_1_tags[] = { |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2732 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 2733 | }; |
| 2734 | asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { |
| 2735 | "Utf8-4", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2736 | "Utf8-4", |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2737 | Utf8_4_free, |
| 2738 | Utf8_4_print, |
| 2739 | Utf8_4_constraint, |
| 2740 | Utf8_4_decode_ber, |
| 2741 | Utf8_4_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2742 | Utf8_4_decode_xer, |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2743 | Utf8_4_encode_xer, |
| 2744 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2745 | asn_DEF_Utf8_4_1_tags, |
| 2746 | sizeof(asn_DEF_Utf8_4_1_tags) |
| 2747 | /sizeof(asn_DEF_Utf8_4_1_tags[0]), /* 1 */ |
| 2748 | asn_DEF_Utf8_4_1_tags, /* Same as above */ |
| 2749 | sizeof(asn_DEF_Utf8_4_1_tags) |
| 2750 | /sizeof(asn_DEF_Utf8_4_1_tags[0]), /* 1 */ |
vlm | ce0d4ad | 2004-10-03 09:14:32 +0000 | [diff] [blame] | 2751 | 0, 0, /* No members */ |
| 2752 | 0 /* No specifics */ |
| 2753 | }; |
| 2754 | |
| 2755 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2756 | /*** <<< INCLUDES [Utf8-3] >>> ***/ |
| 2757 | |
| 2758 | #include <Utf8-2.h> |
| 2759 | |
| 2760 | /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ |
| 2761 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2762 | typedef Utf8_2_t Utf8_3_t; |
| 2763 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2764 | /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ |
| 2765 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2766 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2767 | asn_struct_free_f Utf8_3_free; |
| 2768 | asn_struct_print_f Utf8_3_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2769 | asn_constr_check_f Utf8_3_constraint; |
| 2770 | ber_type_decoder_f Utf8_3_decode_ber; |
| 2771 | der_type_encoder_f Utf8_3_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2772 | xer_type_decoder_f Utf8_3_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2773 | xer_type_encoder_f Utf8_3_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2774 | |
| 2775 | /*** <<< CTABLES [Utf8-3] >>> ***/ |
| 2776 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2777 | static int permitted_alphabet_table_1[128] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2778 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2779 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2780 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2781 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 2782 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 2783 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 2784 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 2785 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 2786 | }; |
| 2787 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2788 | static int check_permitted_alphabet_1(const void *sptr) { |
| 2789 | int *table = permitted_alphabet_table_1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2790 | /* The underlying type is UTF8String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2791 | const UTF8String_t *st = (const UTF8String_t *)sptr; |
vlm | b08de15 | 2004-08-22 03:30:05 +0000 | [diff] [blame] | 2792 | const uint8_t *ch = st->buf; |
| 2793 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2794 | |
| 2795 | for(; ch < end; ch++) { |
| 2796 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2797 | if(cv >= 0x80) return -1; |
| 2798 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2799 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2800 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | |
| 2804 | /*** <<< CODE [Utf8-3] >>> ***/ |
| 2805 | |
| 2806 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2807 | Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2808 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2809 | const Utf8_2_t *st = (const Utf8_2_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2810 | size_t size; |
| 2811 | |
| 2812 | if(!sptr) { |
| 2813 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2814 | "%s: value not given (%s:%d)", |
| 2815 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2816 | return -1; |
| 2817 | } |
| 2818 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2819 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 2820 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2821 | _ASN_ERRLOG(app_errlog, app_key, |
| 2822 | "%s: UTF-8: broken encoding (%s:%d)", |
| 2823 | td->name, __FILE__, __LINE__); |
| 2824 | return -1; |
| 2825 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2826 | |
| 2827 | if((size >= 1 && size <= 2) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2828 | && !check_permitted_alphabet_1(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2829 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2830 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2831 | } else { |
| 2832 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2833 | "%s: constraint failed (%s:%d)", |
| 2834 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2835 | return -1; |
| 2836 | } |
| 2837 | } |
| 2838 | |
| 2839 | /* |
| 2840 | * This type is implemented using Utf8_2, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2841 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2842 | */ |
| 2843 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2844 | Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2845 | td->free_struct = asn_DEF_Utf8_2.free_struct; |
| 2846 | td->print_struct = asn_DEF_Utf8_2.print_struct; |
| 2847 | td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; |
| 2848 | td->der_encoder = asn_DEF_Utf8_2.der_encoder; |
| 2849 | td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; |
| 2850 | td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; |
| 2851 | td->elements = asn_DEF_Utf8_2.elements; |
| 2852 | td->elements_count = asn_DEF_Utf8_2.elements_count; |
| 2853 | td->specifics = asn_DEF_Utf8_2.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2854 | } |
| 2855 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2856 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2857 | Utf8_3_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2858 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2859 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2860 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2861 | } |
| 2862 | |
| 2863 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2864 | Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2865 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2866 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2867 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 2868 | } |
| 2869 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2870 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2871 | Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2872 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2873 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2874 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2875 | } |
| 2876 | |
| 2877 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2878 | Utf8_3_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2879 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 2880 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2881 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2882 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 2883 | } |
| 2884 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2885 | asn_dec_rval_t |
| 2886 | Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 2887 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2888 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2889 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 2890 | } |
| 2891 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2892 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2893 | Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2894 | int ilevel, enum xer_encoder_flags_e flags, |
| 2895 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2896 | Utf8_3_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2897 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2898 | } |
| 2899 | |
| 2900 | |
| 2901 | /*** <<< STAT-DEFS [Utf8-3] >>> ***/ |
| 2902 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2903 | static ber_tlv_tag_t asn_DEF_Utf8_3_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 2904 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2905 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2906 | asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2907 | "Utf8-3", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 2908 | "Utf8-3", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2909 | Utf8_3_free, |
| 2910 | Utf8_3_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2911 | Utf8_3_constraint, |
| 2912 | Utf8_3_decode_ber, |
| 2913 | Utf8_3_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2914 | Utf8_3_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2915 | Utf8_3_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2916 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2917 | asn_DEF_Utf8_3_1_tags, |
| 2918 | sizeof(asn_DEF_Utf8_3_1_tags) |
| 2919 | /sizeof(asn_DEF_Utf8_3_1_tags[0]), /* 1 */ |
| 2920 | asn_DEF_Utf8_3_1_tags, /* Same as above */ |
| 2921 | sizeof(asn_DEF_Utf8_3_1_tags) |
| 2922 | /sizeof(asn_DEF_Utf8_3_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2923 | 0, 0, /* No members */ |
| 2924 | 0 /* No specifics */ |
| 2925 | }; |
| 2926 | |
| 2927 | |
| 2928 | /*** <<< INCLUDES [Utf8-2] >>> ***/ |
| 2929 | |
| 2930 | #include <Utf8-1.h> |
| 2931 | |
| 2932 | /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ |
| 2933 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2934 | typedef Utf8_1_t Utf8_2_t; |
| 2935 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2936 | /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ |
| 2937 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2938 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2939 | asn_struct_free_f Utf8_2_free; |
| 2940 | asn_struct_print_f Utf8_2_print; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2941 | asn_constr_check_f Utf8_2_constraint; |
| 2942 | ber_type_decoder_f Utf8_2_decode_ber; |
| 2943 | der_type_encoder_f Utf8_2_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 2944 | xer_type_decoder_f Utf8_2_decode_xer; |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2945 | xer_type_encoder_f Utf8_2_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2946 | |
| 2947 | /*** <<< CODE [Utf8-2] >>> ***/ |
| 2948 | |
| 2949 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2950 | Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2951 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 2952 | const Utf8_1_t *st = (const Utf8_1_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2953 | size_t size; |
| 2954 | |
| 2955 | if(!sptr) { |
| 2956 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2957 | "%s: value not given (%s:%d)", |
| 2958 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2959 | return -1; |
| 2960 | } |
| 2961 | |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2962 | size = UTF8String_length(st); |
vlm | 1ba4275 | 2004-10-02 16:44:30 +0000 | [diff] [blame] | 2963 | if((ssize_t)size < 0) { |
vlm | e4506a3 | 2004-10-02 16:33:46 +0000 | [diff] [blame] | 2964 | _ASN_ERRLOG(app_errlog, app_key, |
| 2965 | "%s: UTF-8: broken encoding (%s:%d)", |
| 2966 | td->name, __FILE__, __LINE__); |
| 2967 | return -1; |
| 2968 | } |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2969 | |
| 2970 | if((size >= 1 && size <= 2)) { |
| 2971 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 2972 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2973 | } else { |
| 2974 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 2975 | "%s: constraint failed (%s:%d)", |
| 2976 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2977 | return -1; |
| 2978 | } |
| 2979 | } |
| 2980 | |
| 2981 | /* |
| 2982 | * This type is implemented using Utf8_1, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 2983 | * so here we adjust the DEF accordingly. |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2984 | */ |
| 2985 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 2986 | Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2987 | td->free_struct = asn_DEF_Utf8_1.free_struct; |
| 2988 | td->print_struct = asn_DEF_Utf8_1.print_struct; |
| 2989 | td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; |
| 2990 | td->der_encoder = asn_DEF_Utf8_1.der_encoder; |
| 2991 | td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; |
| 2992 | td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; |
| 2993 | td->elements = asn_DEF_Utf8_1.elements; |
| 2994 | td->elements_count = asn_DEF_Utf8_1.elements_count; |
| 2995 | td->specifics = asn_DEF_Utf8_1.specifics; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 2996 | } |
| 2997 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 2998 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 2999 | Utf8_2_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3000 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3001 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3002 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3003 | } |
| 3004 | |
| 3005 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3006 | Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3007 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3008 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3009 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3010 | } |
| 3011 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3012 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3013 | Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3014 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3015 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3016 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3017 | } |
| 3018 | |
| 3019 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3020 | Utf8_2_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3021 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3022 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3023 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3024 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3025 | } |
| 3026 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3027 | asn_dec_rval_t |
| 3028 | Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3029 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3030 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3031 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3032 | } |
| 3033 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3034 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3035 | Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3036 | int ilevel, enum xer_encoder_flags_e flags, |
| 3037 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3038 | Utf8_2_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3039 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3040 | } |
| 3041 | |
| 3042 | |
| 3043 | /*** <<< STAT-DEFS [Utf8-2] >>> ***/ |
| 3044 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3045 | static ber_tlv_tag_t asn_DEF_Utf8_2_1_tags[] = { |
vlm | 1308d2b | 2004-09-10 15:49:15 +0000 | [diff] [blame] | 3046 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3047 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3048 | asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3049 | "Utf8-2", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3050 | "Utf8-2", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3051 | Utf8_2_free, |
| 3052 | Utf8_2_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3053 | Utf8_2_constraint, |
| 3054 | Utf8_2_decode_ber, |
| 3055 | Utf8_2_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3056 | Utf8_2_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3057 | Utf8_2_encode_xer, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3058 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3059 | asn_DEF_Utf8_2_1_tags, |
| 3060 | sizeof(asn_DEF_Utf8_2_1_tags) |
| 3061 | /sizeof(asn_DEF_Utf8_2_1_tags[0]), /* 1 */ |
| 3062 | asn_DEF_Utf8_2_1_tags, /* Same as above */ |
| 3063 | sizeof(asn_DEF_Utf8_2_1_tags) |
| 3064 | /sizeof(asn_DEF_Utf8_2_1_tags[0]), /* 1 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3065 | 0, 0, /* No members */ |
| 3066 | 0 /* No specifics */ |
| 3067 | }; |
| 3068 | |
| 3069 | |
| 3070 | /*** <<< INCLUDES [Utf8-1] >>> ***/ |
| 3071 | |
| 3072 | #include <UTF8String.h> |
| 3073 | |
| 3074 | /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ |
| 3075 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3076 | typedef UTF8String_t Utf8_1_t; |
| 3077 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3078 | /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ |
| 3079 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3080 | extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; |
| 3081 | asn_struct_free_f Utf8_1_free; |
| 3082 | asn_struct_print_f Utf8_1_print; |
| 3083 | asn_constr_check_f Utf8_1_constraint; |
| 3084 | ber_type_decoder_f Utf8_1_decode_ber; |
| 3085 | der_type_encoder_f Utf8_1_encode_der; |
| 3086 | xer_type_decoder_f Utf8_1_decode_xer; |
| 3087 | xer_type_encoder_f Utf8_1_encode_xer; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3088 | |
| 3089 | /*** <<< CODE [Utf8-1] >>> ***/ |
| 3090 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3091 | int |
| 3092 | Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3093 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3094 | /* Replace with underlying type checker */ |
| 3095 | td->check_constraints = asn_DEF_UTF8String.check_constraints; |
| 3096 | return td->check_constraints(td, sptr, app_errlog, app_key); |
| 3097 | } |
| 3098 | |
| 3099 | /* |
| 3100 | * This type is implemented using UTF8String, |
| 3101 | * so here we adjust the DEF accordingly. |
| 3102 | */ |
| 3103 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3104 | Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3105 | td->free_struct = asn_DEF_UTF8String.free_struct; |
| 3106 | td->print_struct = asn_DEF_UTF8String.print_struct; |
| 3107 | td->ber_decoder = asn_DEF_UTF8String.ber_decoder; |
| 3108 | td->der_encoder = asn_DEF_UTF8String.der_encoder; |
| 3109 | td->xer_decoder = asn_DEF_UTF8String.xer_decoder; |
| 3110 | td->xer_encoder = asn_DEF_UTF8String.xer_encoder; |
| 3111 | td->elements = asn_DEF_UTF8String.elements; |
| 3112 | td->elements_count = asn_DEF_UTF8String.elements_count; |
| 3113 | td->specifics = asn_DEF_UTF8String.specifics; |
| 3114 | } |
| 3115 | |
| 3116 | void |
| 3117 | Utf8_1_free(asn_TYPE_descriptor_t *td, |
| 3118 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3119 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3120 | td->free_struct(td, struct_ptr, contents_only); |
| 3121 | } |
| 3122 | |
| 3123 | int |
| 3124 | Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3125 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3126 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3127 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3128 | } |
| 3129 | |
| 3130 | asn_dec_rval_t |
| 3131 | Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3132 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3133 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3134 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3135 | } |
| 3136 | |
| 3137 | asn_enc_rval_t |
| 3138 | Utf8_1_encode_der(asn_TYPE_descriptor_t *td, |
| 3139 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3140 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3141 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3142 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3143 | } |
| 3144 | |
| 3145 | asn_dec_rval_t |
| 3146 | Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3147 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3148 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3149 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3150 | } |
| 3151 | |
| 3152 | asn_enc_rval_t |
| 3153 | Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3154 | int ilevel, enum xer_encoder_flags_e flags, |
| 3155 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3156 | Utf8_1_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3157 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3158 | } |
| 3159 | |
| 3160 | |
| 3161 | /*** <<< STAT-DEFS [Utf8-1] >>> ***/ |
| 3162 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3163 | static ber_tlv_tag_t asn_DEF_Utf8_1_1_tags[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3164 | (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) |
| 3165 | }; |
| 3166 | asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { |
| 3167 | "Utf8-1", |
| 3168 | "Utf8-1", |
| 3169 | Utf8_1_free, |
| 3170 | Utf8_1_print, |
| 3171 | Utf8_1_constraint, |
| 3172 | Utf8_1_decode_ber, |
| 3173 | Utf8_1_encode_der, |
| 3174 | Utf8_1_decode_xer, |
| 3175 | Utf8_1_encode_xer, |
| 3176 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3177 | asn_DEF_Utf8_1_1_tags, |
| 3178 | sizeof(asn_DEF_Utf8_1_1_tags) |
| 3179 | /sizeof(asn_DEF_Utf8_1_1_tags[0]), /* 1 */ |
| 3180 | asn_DEF_Utf8_1_1_tags, /* Same as above */ |
| 3181 | sizeof(asn_DEF_Utf8_1_1_tags) |
| 3182 | /sizeof(asn_DEF_Utf8_1_1_tags[0]), /* 1 */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3183 | 0, 0, /* No members */ |
| 3184 | 0 /* No specifics */ |
| 3185 | }; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 3186 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3187 | |
| 3188 | /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ |
| 3189 | |
| 3190 | #include <Identifier.h> |
| 3191 | |
| 3192 | /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ |
| 3193 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3194 | typedef Identifier_t VisibleIdentifier_t; |
| 3195 | |
| 3196 | /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ |
| 3197 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3198 | extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; |
| 3199 | asn_struct_free_f VisibleIdentifier_free; |
| 3200 | asn_struct_print_f VisibleIdentifier_print; |
| 3201 | asn_constr_check_f VisibleIdentifier_constraint; |
| 3202 | ber_type_decoder_f VisibleIdentifier_decode_ber; |
| 3203 | der_type_encoder_f VisibleIdentifier_encode_der; |
| 3204 | xer_type_decoder_f VisibleIdentifier_decode_xer; |
| 3205 | xer_type_encoder_f VisibleIdentifier_encode_xer; |
| 3206 | |
| 3207 | /*** <<< CTABLES [VisibleIdentifier] >>> ***/ |
| 3208 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3209 | static int permitted_alphabet_table_1[256] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3210 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3211 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3212 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 3213 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 3214 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 3215 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 3216 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 3217 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 3218 | }; |
| 3219 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3220 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3221 | int *table = permitted_alphabet_table_1; |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3222 | /* The underlying type is VisibleString */ |
| 3223 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
| 3224 | const uint8_t *ch = st->buf; |
| 3225 | const uint8_t *end = ch + st->size; |
| 3226 | |
| 3227 | for(; ch < end; ch++) { |
| 3228 | uint8_t cv = *ch; |
| 3229 | if(!table[cv]) return -1; |
| 3230 | } |
| 3231 | return 0; |
| 3232 | } |
| 3233 | |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3234 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3235 | /*** <<< CODE [VisibleIdentifier] >>> ***/ |
| 3236 | |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3237 | int |
| 3238 | VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 3239 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
| 3240 | const Identifier_t *st = (const Identifier_t *)sptr; |
| 3241 | size_t size; |
| 3242 | |
| 3243 | if(!sptr) { |
| 3244 | _ASN_ERRLOG(app_errlog, app_key, |
| 3245 | "%s: value not given (%s:%d)", |
| 3246 | td->name, __FILE__, __LINE__); |
| 3247 | return -1; |
| 3248 | } |
| 3249 | |
| 3250 | size = st->size; |
| 3251 | |
| 3252 | if((size >= 1 && size <= 32) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3253 | && !check_permitted_alphabet_1(st)) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3254 | /* Constraint check succeeded */ |
| 3255 | return 0; |
| 3256 | } else { |
| 3257 | _ASN_ERRLOG(app_errlog, app_key, |
| 3258 | "%s: constraint failed (%s:%d)", |
| 3259 | td->name, __FILE__, __LINE__); |
| 3260 | return -1; |
| 3261 | } |
| 3262 | } |
| 3263 | |
| 3264 | /* |
| 3265 | * This type is implemented using Identifier, |
| 3266 | * so here we adjust the DEF accordingly. |
| 3267 | */ |
| 3268 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3269 | VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3270 | td->free_struct = asn_DEF_Identifier.free_struct; |
| 3271 | td->print_struct = asn_DEF_Identifier.print_struct; |
| 3272 | td->ber_decoder = asn_DEF_Identifier.ber_decoder; |
| 3273 | td->der_encoder = asn_DEF_Identifier.der_encoder; |
| 3274 | td->xer_decoder = asn_DEF_Identifier.xer_decoder; |
| 3275 | td->xer_encoder = asn_DEF_Identifier.xer_encoder; |
| 3276 | td->elements = asn_DEF_Identifier.elements; |
| 3277 | td->elements_count = asn_DEF_Identifier.elements_count; |
| 3278 | td->specifics = asn_DEF_Identifier.specifics; |
| 3279 | } |
| 3280 | |
| 3281 | void |
| 3282 | VisibleIdentifier_free(asn_TYPE_descriptor_t *td, |
| 3283 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3284 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3285 | td->free_struct(td, struct_ptr, contents_only); |
| 3286 | } |
| 3287 | |
| 3288 | int |
| 3289 | VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
| 3290 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3291 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3292 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3293 | } |
| 3294 | |
| 3295 | asn_dec_rval_t |
| 3296 | VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3297 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3298 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3299 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
| 3300 | } |
| 3301 | |
| 3302 | asn_enc_rval_t |
| 3303 | VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, |
| 3304 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3305 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3306 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3307 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3308 | } |
| 3309 | |
| 3310 | asn_dec_rval_t |
| 3311 | VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3312 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3313 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3314 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3315 | } |
| 3316 | |
| 3317 | asn_enc_rval_t |
| 3318 | VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
| 3319 | int ilevel, enum xer_encoder_flags_e flags, |
| 3320 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3321 | VisibleIdentifier_1_inherit_TYPE_descriptor(td); |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3322 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
| 3323 | } |
| 3324 | |
| 3325 | |
| 3326 | /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ |
| 3327 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3328 | static ber_tlv_tag_t asn_DEF_VisibleIdentifier_1_tags[] = { |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3329 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3330 | }; |
| 3331 | asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { |
| 3332 | "VisibleIdentifier", |
| 3333 | "VisibleIdentifier", |
| 3334 | VisibleIdentifier_free, |
| 3335 | VisibleIdentifier_print, |
| 3336 | VisibleIdentifier_constraint, |
| 3337 | VisibleIdentifier_decode_ber, |
| 3338 | VisibleIdentifier_encode_der, |
| 3339 | VisibleIdentifier_decode_xer, |
| 3340 | VisibleIdentifier_encode_xer, |
| 3341 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3342 | asn_DEF_VisibleIdentifier_1_tags, |
| 3343 | sizeof(asn_DEF_VisibleIdentifier_1_tags) |
| 3344 | /sizeof(asn_DEF_VisibleIdentifier_1_tags[0]), /* 1 */ |
| 3345 | asn_DEF_VisibleIdentifier_1_tags, /* Same as above */ |
| 3346 | sizeof(asn_DEF_VisibleIdentifier_1_tags) |
| 3347 | /sizeof(asn_DEF_VisibleIdentifier_1_tags[0]), /* 1 */ |
vlm | 1f7df78 | 2005-03-04 23:48:19 +0000 | [diff] [blame] | 3348 | 0, 0, /* No members */ |
| 3349 | 0 /* No specifics */ |
| 3350 | }; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3351 | |
| 3352 | |
| 3353 | /*** <<< INCLUDES [Identifier] >>> ***/ |
| 3354 | |
| 3355 | #include <VisibleString.h> |
| 3356 | |
| 3357 | /*** <<< TYPE-DECLS [Identifier] >>> ***/ |
| 3358 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3359 | typedef VisibleString_t Identifier_t; |
| 3360 | |
| 3361 | /*** <<< FUNC-DECLS [Identifier] >>> ***/ |
| 3362 | |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3363 | extern asn_TYPE_descriptor_t asn_DEF_Identifier; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3364 | asn_struct_free_f Identifier_free; |
| 3365 | asn_struct_print_f Identifier_print; |
| 3366 | asn_constr_check_f Identifier_constraint; |
| 3367 | ber_type_decoder_f Identifier_decode_ber; |
| 3368 | der_type_encoder_f Identifier_encode_der; |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3369 | xer_type_decoder_f Identifier_decode_xer; |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3370 | xer_type_encoder_f Identifier_encode_xer; |
| 3371 | |
| 3372 | /*** <<< CTABLES [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3373 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3374 | static int permitted_alphabet_table_1[256] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3375 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3376 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 3377 | 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */ |
| 3378 | 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789 */ |
| 3379 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 3380 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ _ */ |
| 3381 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 3382 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 3383 | }; |
| 3384 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3385 | static int check_permitted_alphabet_1(const void *sptr) { |
| 3386 | int *table = permitted_alphabet_table_1; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3387 | /* The underlying type is VisibleString */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 3388 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3389 | const uint8_t *ch = st->buf; |
| 3390 | const uint8_t *end = ch + st->size; |
| 3391 | |
| 3392 | for(; ch < end; ch++) { |
| 3393 | uint8_t cv = *ch; |
| 3394 | if(!table[cv]) return -1; |
| 3395 | } |
| 3396 | return 0; |
| 3397 | } |
| 3398 | |
| 3399 | |
vlm | aafc941 | 2004-09-26 13:12:56 +0000 | [diff] [blame] | 3400 | /*** <<< CODE [Identifier] >>> ***/ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3401 | |
| 3402 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3403 | Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3404 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 3405 | const VisibleString_t *st = (const VisibleString_t *)sptr; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3406 | size_t size; |
| 3407 | |
| 3408 | if(!sptr) { |
| 3409 | _ASN_ERRLOG(app_errlog, app_key, |
| 3410 | "%s: value not given (%s:%d)", |
| 3411 | td->name, __FILE__, __LINE__); |
| 3412 | return -1; |
| 3413 | } |
| 3414 | |
| 3415 | size = st->size; |
| 3416 | |
| 3417 | if((size >= 1 && size <= 32) |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3418 | && !check_permitted_alphabet_1(st)) { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3419 | /* Constraint check succeeded */ |
| 3420 | return 0; |
| 3421 | } else { |
| 3422 | _ASN_ERRLOG(app_errlog, app_key, |
| 3423 | "%s: constraint failed (%s:%d)", |
| 3424 | td->name, __FILE__, __LINE__); |
| 3425 | return -1; |
| 3426 | } |
| 3427 | } |
| 3428 | |
| 3429 | /* |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3430 | * This type is implemented using VisibleString, |
vlm | cb0b7fc | 2004-09-23 22:14:58 +0000 | [diff] [blame] | 3431 | * so here we adjust the DEF accordingly. |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3432 | */ |
| 3433 | static void |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3434 | Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3435 | td->free_struct = asn_DEF_VisibleString.free_struct; |
| 3436 | td->print_struct = asn_DEF_VisibleString.print_struct; |
| 3437 | td->ber_decoder = asn_DEF_VisibleString.ber_decoder; |
| 3438 | td->der_encoder = asn_DEF_VisibleString.der_encoder; |
| 3439 | td->xer_decoder = asn_DEF_VisibleString.xer_decoder; |
| 3440 | td->xer_encoder = asn_DEF_VisibleString.xer_encoder; |
| 3441 | td->elements = asn_DEF_VisibleString.elements; |
| 3442 | td->elements_count = asn_DEF_VisibleString.elements_count; |
| 3443 | td->specifics = asn_DEF_VisibleString.specifics; |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3444 | } |
| 3445 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3446 | void |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3447 | Identifier_free(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3448 | void *struct_ptr, int contents_only) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3449 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3450 | td->free_struct(td, struct_ptr, contents_only); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3451 | } |
| 3452 | |
| 3453 | int |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3454 | Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3455 | int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3456 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3457 | return td->print_struct(td, struct_ptr, ilevel, cb, app_key); |
| 3458 | } |
| 3459 | |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3460 | asn_dec_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3461 | Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3462 | void **structure, const void *bufptr, size_t size, int tag_mode) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3463 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3464 | return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3465 | } |
| 3466 | |
| 3467 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3468 | Identifier_encode_der(asn_TYPE_descriptor_t *td, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3469 | void *structure, int tag_mode, ber_tlv_tag_t tag, |
| 3470 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3471 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3472 | return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); |
| 3473 | } |
| 3474 | |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3475 | asn_dec_rval_t |
| 3476 | Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, |
vlm | c04faea | 2005-03-17 21:57:19 +0000 | [diff] [blame] | 3477 | void **structure, const char *opt_mname, const void *bufptr, size_t size) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3478 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3479 | return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); |
| 3480 | } |
| 3481 | |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3482 | asn_enc_rval_t |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3483 | Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3484 | int ilevel, enum xer_encoder_flags_e flags, |
| 3485 | asn_app_consume_bytes_f *cb, void *app_key) { |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3486 | Identifier_1_inherit_TYPE_descriptor(td); |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3487 | return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3488 | } |
| 3489 | |
| 3490 | |
| 3491 | /*** <<< STAT-DEFS [Identifier] >>> ***/ |
| 3492 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3493 | static ber_tlv_tag_t asn_DEF_Identifier_1_tags[] = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3494 | (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) |
| 3495 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 3496 | asn_TYPE_descriptor_t asn_DEF_Identifier = { |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3497 | "Identifier", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 3498 | "Identifier", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3499 | Identifier_free, |
| 3500 | Identifier_print, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3501 | Identifier_constraint, |
| 3502 | Identifier_decode_ber, |
| 3503 | Identifier_encode_der, |
vlm | a6af74c | 2004-10-23 13:26:56 +0000 | [diff] [blame] | 3504 | Identifier_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 3505 | Identifier_encode_xer, |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3506 | 0, /* Use generic outmost tag fetcher */ |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 3507 | asn_DEF_Identifier_1_tags, |
| 3508 | sizeof(asn_DEF_Identifier_1_tags) |
| 3509 | /sizeof(asn_DEF_Identifier_1_tags[0]), /* 1 */ |
| 3510 | asn_DEF_Identifier_1_tags, /* Same as above */ |
| 3511 | sizeof(asn_DEF_Identifier_1_tags) |
| 3512 | /sizeof(asn_DEF_Identifier_1_tags[0]), /* 1 */ |
vlm | 63c808c | 2004-09-15 11:44:13 +0000 | [diff] [blame] | 3513 | 0, 0, /* No members */ |
| 3514 | 0 /* No specifics */ |
| 3515 | }; |
| 3516 | |