vlm | 097616c | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [T] >>> ***/ |
| 3 | |
| 4 | #include <INTEGER.h> |
| 5 | #include <OCTET_STRING.h> |
| 6 | #include <REAL.h> |
| 7 | #include <constr_SET.h> |
| 8 | #include <constr_SEQUENCE.h> |
| 9 | |
| 10 | /*** <<< DEPS [T] >>> ***/ |
| 11 | |
| 12 | |
| 13 | /* |
| 14 | * Method of determining the components presence |
| 15 | */ |
| 16 | typedef enum class_PR { |
| 17 | } class_PR; |
| 18 | extern asn_TYPE_descriptor_t asn_DEF_T; |
| 19 | |
| 20 | /*** <<< TYPE-DECLS [T] >>> ***/ |
| 21 | |
| 22 | |
| 23 | typedef struct T { |
| 24 | INTEGER_t Int; |
| 25 | OCTET_STRING_t Char; |
| 26 | struct Class { |
| 27 | /* |
| 28 | * This type is extensible, |
| 29 | * possible extensions are below. |
| 30 | */ |
| 31 | |
| 32 | /* Presence bitmask: ASN_SET_ISPRESENT(pclass, class_PR_x) */ |
| 33 | unsigned int _presence_map |
| 34 | [((0+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; |
| 35 | |
| 36 | /* Context for parsing across buffer boundaries */ |
| 37 | asn_struct_ctx_t _asn_ctx; |
| 38 | } Class; |
| 39 | REAL_t Double; |
| 40 | |
| 41 | /* Context for parsing across buffer boundaries */ |
| 42 | asn_struct_ctx_t _asn_ctx; |
| 43 | } T_t; |
| 44 | |
| 45 | /*** <<< CODE [T] >>> ***/ |
| 46 | |
| 47 | static int |
| 48 | memb_char_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, |
| 49 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 50 | const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; |
vlm | 097616c | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 51 | size_t size; |
| 52 | |
| 53 | if(!sptr) { |
| 54 | _ASN_ERRLOG(app_errlog, app_key, |
| 55 | "%s: value not given (%s:%d)", |
| 56 | td->name, __FILE__, __LINE__); |
| 57 | return -1; |
| 58 | } |
| 59 | |
| 60 | size = st->size; |
| 61 | |
| 62 | if((size == 1)) { |
| 63 | /* Constraint check succeeded */ |
| 64 | return 0; |
| 65 | } else { |
| 66 | _ASN_ERRLOG(app_errlog, app_key, |
| 67 | "%s: constraint failed (%s:%d)", |
| 68 | td->name, __FILE__, __LINE__); |
| 69 | return -1; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |
| 74 | /*** <<< STAT-DEFS [T] >>> ***/ |
| 75 | |
| 76 | static ber_tlv_tag_t asn_DEF_class_tags[] = { |
| 77 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 78 | }; |
| 79 | static asn_TYPE_tag2member_t asn_DEF_class_tag2el[] = { |
| 80 | }; |
| 81 | static uint8_t asn_DEF_class_mmap[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = { |
| 82 | 0 |
| 83 | }; |
| 84 | static asn_SET_specifics_t asn_DEF_class_specs = { |
| 85 | sizeof(struct Class), |
| 86 | offsetof(struct Class, _asn_ctx), |
| 87 | offsetof(struct Class, _presence_map), |
| 88 | asn_DEF_class_tag2el, |
| 89 | 0, /* Count of tags in the map */ |
| 90 | asn_DEF_class_tag2el, /* Same as above */ |
| 91 | 0, /* Count of tags in the CANONICAL-XER map */ |
| 92 | 1, /* Whether extensible */ |
| 93 | (unsigned int *)asn_DEF_class_mmap /* Mandatory elements map */ |
| 94 | }; |
| 95 | static /* Use -fall-defs-global to expose */ |
| 96 | asn_TYPE_descriptor_t asn_DEF_class = { |
| 97 | "class", |
| 98 | "class", |
| 99 | SET_free, |
| 100 | SET_print, |
| 101 | SET_constraint, |
| 102 | SET_decode_ber, |
| 103 | SET_encode_der, |
vlm | 9de212e | 2005-02-14 20:31:31 +0000 | [diff] [blame] | 104 | SET_decode_xer, |
vlm | 097616c | 2005-01-30 18:34:07 +0000 | [diff] [blame] | 105 | SET_encode_xer, |
| 106 | 0, /* Use generic outmost tag fetcher */ |
| 107 | asn_DEF_class_tags, |
| 108 | sizeof(asn_DEF_class_tags) |
| 109 | /sizeof(asn_DEF_class_tags[0]), /* 1 */ |
| 110 | asn_DEF_class_tags, /* Same as above */ |
| 111 | sizeof(asn_DEF_class_tags) |
| 112 | /sizeof(asn_DEF_class_tags[0]), /* 1 */ |
| 113 | 0, 0, /* No members */ |
| 114 | &asn_DEF_class_specs /* Additional specs */ |
| 115 | }; |
| 116 | |
| 117 | static asn_TYPE_member_t asn_MBR_T[] = { |
| 118 | { ATF_NOFLAGS, 0, offsetof(struct T, Int), |
| 119 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 120 | .tag_mode = 0, |
| 121 | .type = (void *)&asn_DEF_INTEGER, |
| 122 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 123 | .name = "int" |
| 124 | }, |
| 125 | { ATF_NOFLAGS, 0, offsetof(struct T, Char), |
| 126 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), |
| 127 | .tag_mode = 0, |
| 128 | .type = (void *)&asn_DEF_OCTET_STRING, |
| 129 | .memb_constraints = memb_char_1_constraint, |
| 130 | .name = "char" |
| 131 | }, |
| 132 | { ATF_NOFLAGS, 0, offsetof(struct T, Class), |
| 133 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), |
| 134 | .tag_mode = 0, |
| 135 | .type = (void *)&asn_DEF_class, |
| 136 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 137 | .name = "class" |
| 138 | }, |
| 139 | { ATF_NOFLAGS, 0, offsetof(struct T, Double), |
| 140 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), |
| 141 | .tag_mode = 0, |
| 142 | .type = (void *)&asn_DEF_REAL, |
| 143 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
| 144 | .name = "double" |
| 145 | }, |
| 146 | }; |
| 147 | static ber_tlv_tag_t asn_DEF_T_tags[] = { |
| 148 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 149 | }; |
| 150 | static asn_TYPE_tag2member_t asn_DEF_T_tag2el[] = { |
| 151 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int at 15 */ |
| 152 | { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char at 16 */ |
| 153 | { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double at 18 */ |
| 154 | { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 }, /* class at 17 */ |
| 155 | }; |
| 156 | static asn_SEQUENCE_specifics_t asn_DEF_T_specs = { |
| 157 | sizeof(struct T), |
| 158 | offsetof(struct T, _asn_ctx), |
| 159 | asn_DEF_T_tag2el, |
| 160 | 4, /* Count of tags in the map */ |
| 161 | -1, /* Start extensions */ |
| 162 | -1 /* Stop extensions */ |
| 163 | }; |
| 164 | asn_TYPE_descriptor_t asn_DEF_T = { |
| 165 | "T", |
| 166 | "T", |
| 167 | SEQUENCE_free, |
| 168 | SEQUENCE_print, |
| 169 | SEQUENCE_constraint, |
| 170 | SEQUENCE_decode_ber, |
| 171 | SEQUENCE_encode_der, |
| 172 | SEQUENCE_decode_xer, |
| 173 | SEQUENCE_encode_xer, |
| 174 | 0, /* Use generic outmost tag fetcher */ |
| 175 | asn_DEF_T_tags, |
| 176 | sizeof(asn_DEF_T_tags) |
| 177 | /sizeof(asn_DEF_T_tags[0]), /* 1 */ |
| 178 | asn_DEF_T_tags, /* Same as above */ |
| 179 | sizeof(asn_DEF_T_tags) |
| 180 | /sizeof(asn_DEF_T_tags[0]), /* 1 */ |
| 181 | asn_MBR_T, |
| 182 | 4, /* Elements count */ |
| 183 | &asn_DEF_T_specs /* Additional specs */ |
| 184 | }; |
| 185 | |