Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [MinMax] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | |
| 6 | /*** <<< TYPE-DECLS [MinMax] >>> ***/ |
| 7 | |
| 8 | typedef INTEGER_t MinMax_16P0_t; |
| 9 | |
| 10 | /*** <<< FUNC-DECLS [MinMax] >>> ***/ |
| 11 | |
| 12 | extern asn_TYPE_descriptor_t asn_DEF_MinMax_16P0; |
| 13 | asn_struct_free_f MinMax_16P0_free; |
| 14 | asn_struct_print_f MinMax_16P0_print; |
| 15 | asn_constr_check_f MinMax_16P0_constraint; |
| 16 | ber_type_decoder_f MinMax_16P0_decode_ber; |
| 17 | der_type_encoder_f MinMax_16P0_encode_der; |
| 18 | xer_type_decoder_f MinMax_16P0_decode_xer; |
| 19 | xer_type_encoder_f MinMax_16P0_encode_xer; |
| 20 | |
| 21 | /*** <<< CODE [MinMax] >>> ***/ |
| 22 | |
| 23 | int |
| 24 | MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 25 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 26 | const INTEGER_t *st = (const INTEGER_t *)sptr; |
| 27 | long value; |
| 28 | |
| 29 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 30 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 31 | "%s: value not given (%s:%d)", |
| 32 | td->name, __FILE__, __LINE__); |
| 33 | return -1; |
| 34 | } |
| 35 | |
| 36 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 37 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 38 | "%s: value too large (%s:%d)", |
| 39 | td->name, __FILE__, __LINE__); |
| 40 | return -1; |
| 41 | } |
| 42 | |
| 43 | if((value >= 3)) { |
| 44 | /* Constraint check succeeded */ |
| 45 | return 0; |
| 46 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 47 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 48 | "%s: constraint failed (%s:%d)", |
| 49 | td->name, __FILE__, __LINE__); |
| 50 | return -1; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /* |
| 55 | * This type is implemented using INTEGER, |
| 56 | * so here we adjust the DEF accordingly. |
| 57 | */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 58 | |
| 59 | /*** <<< STAT-DEFS [MinMax] >>> ***/ |
| 60 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 61 | static const ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 62 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 63 | }; |
| 64 | asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = { |
| 65 | "MinMax", |
| 66 | "MinMax", |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 67 | INTEGER_free, |
| 68 | INTEGER_print, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 69 | MinMax_16P0_constraint, |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 70 | INTEGER_decode_ber, |
| 71 | INTEGER_encode_der, |
| 72 | INTEGER_decode_xer, |
| 73 | INTEGER_encode_xer, |
Lev Walkin | ba68c91 | 2017-07-06 07:52:39 -0700 | [diff] [blame] | 74 | 0, 0, /* No OER support, use "-gen-OER" to enable */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 75 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 76 | 0, /* Use generic outmost tag fetcher */ |
| 77 | asn_DEF_MinMax_16P0_tags_1, |
| 78 | sizeof(asn_DEF_MinMax_16P0_tags_1) |
| 79 | /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ |
| 80 | asn_DEF_MinMax_16P0_tags_1, /* Same as above */ |
| 81 | sizeof(asn_DEF_MinMax_16P0_tags_1) |
| 82 | /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 83 | 0, /* No OER visible constraints */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 84 | 0, /* No PER visible constraints */ |
| 85 | 0, 0, /* No members */ |
| 86 | 0 /* No specifics */ |
| 87 | }; |
| 88 | |
| 89 | |
| 90 | /*** <<< INCLUDES [ThreePlus] >>> ***/ |
| 91 | |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 92 | #include "MinMax.h" |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 93 | |
| 94 | /*** <<< TYPE-DECLS [ThreePlus] >>> ***/ |
| 95 | |
| 96 | typedef MinMax_16P0_t ThreePlus_t; |
| 97 | |
| 98 | /*** <<< FUNC-DECLS [ThreePlus] >>> ***/ |
| 99 | |
| 100 | extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; |
| 101 | asn_struct_free_f ThreePlus_free; |
| 102 | asn_struct_print_f ThreePlus_print; |
| 103 | asn_constr_check_f ThreePlus_constraint; |
| 104 | ber_type_decoder_f ThreePlus_decode_ber; |
| 105 | der_type_encoder_f ThreePlus_encode_der; |
| 106 | xer_type_decoder_f ThreePlus_decode_xer; |
| 107 | xer_type_encoder_f ThreePlus_encode_xer; |
| 108 | |
| 109 | /*** <<< CODE [ThreePlus] >>> ***/ |
| 110 | |
| 111 | int |
| 112 | ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
Lev Walkin | 1eded35 | 2006-07-13 11:19:01 +0000 | [diff] [blame] | 113 | asn_app_constraint_failed_f *ctfailcb, void *app_key) { |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 114 | const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; |
| 115 | long value; |
| 116 | |
| 117 | if(!sptr) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 118 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 119 | "%s: value not given (%s:%d)", |
| 120 | td->name, __FILE__, __LINE__); |
| 121 | return -1; |
| 122 | } |
| 123 | |
| 124 | if(asn_INTEGER2long(st, &value)) { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 125 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 126 | "%s: value too large (%s:%d)", |
| 127 | td->name, __FILE__, __LINE__); |
| 128 | return -1; |
| 129 | } |
| 130 | |
| 131 | if((value >= 3)) { |
| 132 | /* Constraint check succeeded */ |
| 133 | return 0; |
| 134 | } else { |
Lev Walkin | 7c1dc05 | 2016-03-14 03:08:15 -0700 | [diff] [blame] | 135 | ASN__CTFAIL(app_key, td, sptr, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 136 | "%s: constraint failed (%s:%d)", |
| 137 | td->name, __FILE__, __LINE__); |
| 138 | return -1; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /* |
| 143 | * This type is implemented using MinMax_16P0, |
| 144 | * so here we adjust the DEF accordingly. |
| 145 | */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 146 | |
| 147 | /*** <<< STAT-DEFS [ThreePlus] >>> ***/ |
| 148 | |
Lev Walkin | a7591b5 | 2014-10-12 18:37:35 -0700 | [diff] [blame] | 149 | static const ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 150 | (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) |
| 151 | }; |
| 152 | asn_TYPE_descriptor_t asn_DEF_ThreePlus = { |
| 153 | "ThreePlus", |
| 154 | "ThreePlus", |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 155 | INTEGER_free, |
| 156 | INTEGER_print, |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 157 | ThreePlus_constraint, |
Bi-Ruei, Chiu | 1fa31c9 | 2016-05-16 13:50:09 +0800 | [diff] [blame] | 158 | INTEGER_decode_ber, |
| 159 | INTEGER_encode_der, |
| 160 | INTEGER_decode_xer, |
| 161 | INTEGER_encode_xer, |
Lev Walkin | ba68c91 | 2017-07-06 07:52:39 -0700 | [diff] [blame] | 162 | 0, 0, /* No OER support, use "-gen-OER" to enable */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 163 | 0, 0, /* No PER support, use "-gen-PER" to enable */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 164 | 0, /* Use generic outmost tag fetcher */ |
| 165 | asn_DEF_ThreePlus_tags_1, |
| 166 | sizeof(asn_DEF_ThreePlus_tags_1) |
| 167 | /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ |
| 168 | asn_DEF_ThreePlus_tags_1, /* Same as above */ |
| 169 | sizeof(asn_DEF_ThreePlus_tags_1) |
| 170 | /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ |
Lev Walkin | b33425f | 2017-07-14 14:59:52 +0400 | [diff] [blame] | 171 | 0, /* No OER visible constraints */ |
Lev Walkin | 171487e | 2006-03-21 07:25:18 +0000 | [diff] [blame] | 172 | 0, /* No PER visible constraints */ |
| 173 | 0, 0, /* No members */ |
| 174 | 0 /* No specifics */ |
| 175 | }; |
| 176 | |