📄 50-constraint-ok.asn1.-p
字号:
}asn_enc_rval_tStr1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);}/*** <<< STAT-DEFS [Str1] >>> ***/static ber_tlv_tag_t asn_DEF_Str1_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))};asn_TYPE_descriptor_t asn_DEF_Str1 = { "Str1", "Str1", Str1_free, Str1_print, Str1_constraint, Str1_decode_ber, Str1_encode_der, Str1_decode_xer, Str1_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str1_1_tags, sizeof(asn_DEF_Str1_1_tags) /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */ asn_DEF_Str1_1_tags, /* Same as above */ sizeof(asn_DEF_Str1_1_tags) /sizeof(asn_DEF_Str1_1_tags[0]), /* 1 */ 0, 0, /* No members */ 0 /* No specifics */};/*** <<< INCLUDES [Str2] >>> ***/#include <Str1.h>/*** <<< TYPE-DECLS [Str2] >>> ***/typedef Str1_t Str2_t;/*** <<< FUNC-DECLS [Str2] >>> ***/extern asn_TYPE_descriptor_t asn_DEF_Str2;asn_struct_free_f Str2_free;asn_struct_print_f Str2_print;asn_constr_check_f Str2_constraint;ber_type_decoder_f Str2_decode_ber;der_type_encoder_f Str2_encode_der;xer_type_decoder_f Str2_decode_xer;xer_type_encoder_f Str2_encode_xer;/*** <<< CTABLES [Str2] >>> ***/static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0;}/*** <<< CODE [Str2] >>> ***/intStr2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *app_errlog, void *app_key) { const Str1_t *st = (const Str1_t *)sptr; size_t size; if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size <= 20) || (size >= 25 && size <= 30)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { _ASN_ERRLOG(app_errlog, app_key, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; }}/* * This type is implemented using Str1, * so here we adjust the DEF accordingly. */static voidStr2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str1.free_struct; td->print_struct = asn_DEF_Str1.print_struct; td->ber_decoder = asn_DEF_Str1.ber_decoder; td->der_encoder = asn_DEF_Str1.der_encoder; td->xer_decoder = asn_DEF_Str1.xer_decoder; td->xer_encoder = asn_DEF_Str1.xer_encoder; td->elements = asn_DEF_Str1.elements; td->elements_count = asn_DEF_Str1.elements_count; td->specifics = asn_DEF_Str1.specifics;}voidStr2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only);}intStr2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);}asn_dec_rval_tStr2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, void *bufptr, size_t size, int tag_mode) { Str2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);}asn_enc_rval_tStr2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);}asn_dec_rval_tStr2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, void *bufptr, size_t size) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);}asn_enc_rval_tStr2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);}/*** <<< STAT-DEFS [Str2] >>> ***/static ber_tlv_tag_t asn_DEF_Str2_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))};asn_TYPE_descriptor_t asn_DEF_Str2 = { "Str2", "Str2", Str2_free, Str2_print, Str2_constraint, Str2_decode_ber, Str2_encode_der, Str2_decode_xer, Str2_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str2_1_tags, sizeof(asn_DEF_Str2_1_tags) /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */ asn_DEF_Str2_1_tags, /* Same as above */ sizeof(asn_DEF_Str2_1_tags) /sizeof(asn_DEF_Str2_1_tags[0]), /* 1 */ 0, 0, /* No members */ 0 /* No specifics */};/*** <<< INCLUDES [Str3] >>> ***/#include <Str2.h>/*** <<< TYPE-DECLS [Str3] >>> ***/typedef Str2_t Str3_t;/*** <<< FUNC-DECLS [Str3] >>> ***/extern asn_TYPE_descriptor_t asn_DEF_Str3;asn_struct_free_f Str3_free;asn_struct_print_f Str3_print;asn_constr_check_f Str3_constraint;ber_type_decoder_f Str3_decode_ber;der_type_encoder_f Str3_encode_der;xer_type_decoder_f Str3_decode_xer;xer_type_encoder_f Str3_encode_xer;/*** <<< CTABLES [Str3] >>> ***/static int permitted_alphabet_table_1[256] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* ABC */0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, /* def */};static int check_permitted_alphabet_1(const void *sptr) { int *table = permitted_alphabet_table_1; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0;}/*** <<< CODE [Str3] >>> ***/intStr3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *app_errlog, void *app_key) { const Str2_t *st = (const Str2_t *)sptr; size_t size; if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { _ASN_ERRLOG(app_errlog, app_key, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; }}/* * This type is implemented using Str2, * so here we adjust the DEF accordingly. */static voidStr3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str2.free_struct; td->print_struct = asn_DEF_Str2.print_struct; td->ber_decoder = asn_DEF_Str2.ber_decoder; td->der_encoder = asn_DEF_Str2.der_encoder; td->xer_decoder = asn_DEF_Str2.xer_decoder; td->xer_encoder = asn_DEF_Str2.xer_encoder; td->elements = asn_DEF_Str2.elements; td->elements_count = asn_DEF_Str2.elements_count; td->specifics = asn_DEF_Str2.specifics;}voidStr3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only);}intStr3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);}asn_dec_rval_tStr3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, void *bufptr, size_t size, int tag_mode) { Str3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);}asn_enc_rval_tStr3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);}asn_dec_rval_tStr3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, void *bufptr, size_t size) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);}asn_enc_rval_tStr3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);}/*** <<< STAT-DEFS [Str3] >>> ***/static ber_tlv_tag_t asn_DEF_Str3_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2))};asn_TYPE_descriptor_t asn_DEF_Str3 = { "Str3", "Str3", Str3_free, Str3_print, Str3_constraint, Str3_decode_ber, Str3_encode_der, Str3_decode_xer, Str3_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str3_1_tags, sizeof(asn_DEF_Str3_1_tags) /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */ asn_DEF_Str3_1_tags, /* Same as above */ sizeof(asn_DEF_Str3_1_tags) /sizeof(asn_DEF_Str3_1_tags[0]), /* 1 */ 0, 0, /* No members */ 0 /* No specifics */};/*** <<< INCLUDES [Str4] >>> ***/#include <IA5String.h>/*** <<< TYPE-DECLS [Str4] >>> ***/typedef IA5String_t Str4_t;/*** <<< FUNC-DECLS [Str4] >>> ***/extern asn_TYPE_descriptor_t asn_DEF_Str4;asn_struct_free_f Str4_free;asn_struct_print_f Str4_print;asn_constr_check_f Str4_constraint;ber_type_decoder_f Str4_decode_ber;der_type_encoder_f Str4_encode_der;xer_type_decoder_f Str4_decode_xer;xer_type_encoder_f Str4_encode_xer;/*** <<< CTABLES [Str4] >>> ***/static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0;}/*** <<< CODE [Str4] >>> ***/intStr4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *app_errlog, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { _ASN_ERRLOG(app_errlog, app_key, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; }}/* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */static voidStr4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics;}voidStr4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only);}intStr4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key);}asn_dec_rval_tStr4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, void *bufptr, size_t size, int tag_mode) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -