ITS
DangerousGoodsExtended.c
Go to the documentation of this file.
1 /*
2  * Generated by asn1c-0.9.27 (http://lionet.info/asn1c)
3  * From ASN.1 module "ITS-Container"
4  * found in "ITS-Container.asn"
5  */
6 
8 
9 static int check_permitted_alphabet_7(const void *sptr) {
10  /* The underlying type is IA5String */
11  const IA5String_t *st = (const IA5String_t *)sptr;
12  const uint8_t *ch = st->buf;
13  const uint8_t *end = ch + st->size;
14 
15  for(; ch < end; ch++) {
16  uint8_t cv = *ch;
17  if(!(cv <= 127)) return -1;
18  }
19  return 0;
20 }
21 
22 static int check_permitted_alphabet_8(const void *sptr) {
23  /* The underlying type is IA5String */
24  const IA5String_t *st = (const IA5String_t *)sptr;
25  const uint8_t *ch = st->buf;
26  const uint8_t *end = ch + st->size;
27 
28  for(; ch < end; ch++) {
29  uint8_t cv = *ch;
30  if(!(cv <= 127)) return -1;
31  }
32  return 0;
33 }
34 
35 static int
37  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
38  long value;
39 
40  if(!sptr) {
41  _ASN_CTFAIL(app_key, td, sptr,
42  "%s: value not given (%s:%d)",
43  td->name, __FILE__, __LINE__);
44  return -1;
45  }
46 
47  value = *(const long *)sptr;
48 
49  if((value >= 0 && value <= 9999)) {
50  /* Constraint check succeeded */
51  return 0;
52  } else {
53  _ASN_CTFAIL(app_key, td, sptr,
54  "%s: constraint failed (%s:%d)",
55  td->name, __FILE__, __LINE__);
56  return -1;
57  }
58 }
59 
60 static int
62  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
63  const IA5String_t *st = (const IA5String_t *)sptr;
64  size_t size;
65 
66  if(!sptr) {
67  _ASN_CTFAIL(app_key, td, sptr,
68  "%s: value not given (%s:%d)",
69  td->name, __FILE__, __LINE__);
70  return -1;
71  }
72 
73  size = st->size;
74 
75  if((size >= 1 && size <= 24)
77  /* Constraint check succeeded */
78  return 0;
79  } else {
80  _ASN_CTFAIL(app_key, td, sptr,
81  "%s: constraint failed (%s:%d)",
82  td->name, __FILE__, __LINE__);
83  return -1;
84  }
85 }
86 
87 static int
89  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
90  const IA5String_t *st = (const IA5String_t *)sptr;
91  size_t size;
92 
93  if(!sptr) {
94  _ASN_CTFAIL(app_key, td, sptr,
95  "%s: value not given (%s:%d)",
96  td->name, __FILE__, __LINE__);
97  return -1;
98  }
99 
100  size = st->size;
101 
102  if((size >= 1 && size <= 24)
103  && !check_permitted_alphabet_8(st)) {
104  /* Constraint check succeeded */
105  return 0;
106  } else {
107  _ASN_CTFAIL(app_key, td, sptr,
108  "%s: constraint failed (%s:%d)",
109  td->name, __FILE__, __LINE__);
110  return -1;
111  }
112 }
113 
114 static int
116  asn_app_constraint_failed_f *ctfailcb, void *app_key) {
117  const UTF8String_t *st = (const UTF8String_t *)sptr;
118  size_t size;
119 
120  if(!sptr) {
121  _ASN_CTFAIL(app_key, td, sptr,
122  "%s: value not given (%s:%d)",
123  td->name, __FILE__, __LINE__);
124  return -1;
125  }
126 
127  size = UTF8String_length(st);
128  if((ssize_t)size < 0) {
129  _ASN_CTFAIL(app_key, td, sptr,
130  "%s: UTF-8: broken encoding (%s:%d)",
131  td->name, __FILE__, __LINE__);
132  return -1;
133  }
134 
135  if((size >= 1 && size <= 24)) {
136  /* Constraint check succeeded */
137  return 0;
138  } else {
139  _ASN_CTFAIL(app_key, td, sptr,
140  "%s: constraint failed (%s:%d)",
141  td->name, __FILE__, __LINE__);
142  return -1;
143  }
144 }
145 
146 static asn_per_constraints_t asn_PER_memb_unNumber_constr_3 GCC_NOTUSED = {
147  { APC_CONSTRAINED, 14, 14, 0, 9999 } /* (0..9999) */,
148  { APC_UNCONSTRAINED, -1, -1, 0, 0 },
149  0, 0 /* No PER value map */
150 };
151 static asn_per_constraints_t asn_PER_memb_emergencyActionCode_constr_7 GCC_NOTUSED = {
152  { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */,
153  { APC_CONSTRAINED, 5, 5, 1, 24 } /* (SIZE(1..24)) */,
154  0, 0 /* No PER character map necessary */
155 };
156 static asn_per_constraints_t asn_PER_memb_phoneNumber_constr_8 GCC_NOTUSED = {
157  { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */,
158  { APC_CONSTRAINED, 5, 5, 1, 24 } /* (SIZE(1..24)) */,
159  0, 0 /* No PER character map necessary */
160 };
161 static asn_per_constraints_t asn_PER_memb_companyName_constr_9 GCC_NOTUSED = {
162  { APC_UNCONSTRAINED, -1, -1, 0, 0 },
163  { APC_UNCONSTRAINED, -1, -1, 0, 0 },
164  0, 0 /* No PER value map */
165 };
167  { ATF_NOFLAGS, 0, offsetof(struct DangerousGoodsExtended, dangerousGoodsType),
168  (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
169  -1, /* IMPLICIT tag at current level */
171  0, /* Defer constraints checking to the member type */
172  0, /* No PER visible constraints */
173  0,
174  "dangerousGoodsType"
175  },
176  { ATF_NOFLAGS, 0, offsetof(struct DangerousGoodsExtended, unNumber),
177  (ASN_TAG_CLASS_CONTEXT | (1 << 2)),
178  -1, /* IMPLICIT tag at current level */
181  &asn_PER_memb_unNumber_constr_3,
182  0,
183  "unNumber"
184  },
185  { ATF_NOFLAGS, 0, offsetof(struct DangerousGoodsExtended, elevatedTemperature),
186  (ASN_TAG_CLASS_CONTEXT | (2 << 2)),
187  -1, /* IMPLICIT tag at current level */
189  0, /* Defer constraints checking to the member type */
190  0, /* No PER visible constraints */
191  0,
192  "elevatedTemperature"
193  },
194  { ATF_NOFLAGS, 0, offsetof(struct DangerousGoodsExtended, tunnelsRestricted),
195  (ASN_TAG_CLASS_CONTEXT | (3 << 2)),
196  -1, /* IMPLICIT tag at current level */
198  0, /* Defer constraints checking to the member type */
199  0, /* No PER visible constraints */
200  0,
201  "tunnelsRestricted"
202  },
203  { ATF_NOFLAGS, 0, offsetof(struct DangerousGoodsExtended, limitedQuantity),
204  (ASN_TAG_CLASS_CONTEXT | (4 << 2)),
205  -1, /* IMPLICIT tag at current level */
207  0, /* Defer constraints checking to the member type */
208  0, /* No PER visible constraints */
209  0,
210  "limitedQuantity"
211  },
212  { ATF_POINTER, 3, offsetof(struct DangerousGoodsExtended, emergencyActionCode),
213  (ASN_TAG_CLASS_CONTEXT | (5 << 2)),
214  -1, /* IMPLICIT tag at current level */
217  &asn_PER_memb_emergencyActionCode_constr_7,
218  0,
219  "emergencyActionCode"
220  },
221  { ATF_POINTER, 2, offsetof(struct DangerousGoodsExtended, phoneNumber),
222  (ASN_TAG_CLASS_CONTEXT | (6 << 2)),
223  -1, /* IMPLICIT tag at current level */
226  &asn_PER_memb_phoneNumber_constr_8,
227  0,
228  "phoneNumber"
229  },
230  { ATF_POINTER, 1, offsetof(struct DangerousGoodsExtended, companyName),
231  (ASN_TAG_CLASS_CONTEXT | (7 << 2)),
232  -1, /* IMPLICIT tag at current level */
235  &asn_PER_memb_companyName_constr_9,
236  0,
237  "companyName"
238  },
239 };
240 static int asn_MAP_DangerousGoodsExtended_oms_1[] = { 5, 6, 7 };
242  (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
243 };
245  { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* dangerousGoodsType */
246  { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* unNumber */
247  { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* elevatedTemperature */
248  { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* tunnelsRestricted */
249  { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* limitedQuantity */
250  { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* emergencyActionCode */
251  { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* phoneNumber */
252  { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 } /* companyName */
253 };
255  sizeof(struct DangerousGoodsExtended),
258  8, /* Count of tags in the map */
259  asn_MAP_DangerousGoodsExtended_oms_1, /* Optional members */
260  3, 0, /* Root/Additions */
261  -1, /* Start extensions */
262  -1 /* Stop extensions */
263 };
265  "DangerousGoodsExtended",
266  "DangerousGoodsExtended",
276  0, /* Use generic outmost tag fetcher */
279  /sizeof(asn_DEF_DangerousGoodsExtended_tags_1[0]), /* 1 */
280  asn_DEF_DangerousGoodsExtended_tags_1, /* Same as above */
282  /sizeof(asn_DEF_DangerousGoodsExtended_tags_1[0]), /* 1 */
283  0, /* No PER visible constraints */
285  8, /* Elements count */
286  &asn_SPC_DangerousGoodsExtended_specs_1 /* Additional specs */
287 };
288 
static int check_permitted_alphabet_8(const void *sptr)
static int memb_unNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key)
#define offsetof(s, m)
Definition: asn_system.h:115
static int memb_emergencyActionCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key)
static int memb_phoneNumber_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key)
ber_type_decoder_f SEQUENCE_decode_ber
asn_TYPE_descriptor_t asn_DEF_UTF8String
Definition: UTF8String.c:16
ssize_t UTF8String_length(const UTF8String_t *st)
Definition: UTF8String.c:153
static asn_per_constraints_t asn_PER_memb_unNumber_constr_3 GCC_NOTUSED
der_type_encoder_f SEQUENCE_encode_der
static int memb_companyName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key)
static int asn_MAP_DangerousGoodsExtended_oms_1[]
asn_struct_print_f SEQUENCE_print
per_type_decoder_f SEQUENCE_decode_uper
per_type_encoder_f SEQUENCE_encode_uper
asn_constr_check_f SEQUENCE_constraint
xer_type_decoder_f SEQUENCE_decode_xer
static asn_TYPE_member_t asn_MBR_DangerousGoodsExtended_1[]
asn_TYPE_descriptor_t asn_DEF_IA5String
Definition: IA5String.c:20
asn_TYPE_descriptor_t asn_DEF_NativeInteger
Definition: NativeInteger.c:22
static asn_SEQUENCE_specifics_t asn_SPC_DangerousGoodsExtended_specs_1
asn_struct_free_f SEQUENCE_free
asn_TYPE_descriptor_t asn_DEF_BOOLEAN
Definition: BOOLEAN.c:15
static int check_permitted_alphabet_7(const void *sptr)
void() asn_app_constraint_failed_f(void *application_specific_key, struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format,...) GCC_PRINTFLIKE(4
static asn_TYPE_tag2member_t asn_MAP_DangerousGoodsExtended_tag2el_1[]
xer_type_encoder_f SEQUENCE_encode_xer
#define _ASN_CTFAIL
Definition: constraints.h:57
asn_TYPE_descriptor_t asn_DEF_DangerousGoodsExtended
uint8_t * buf
Definition: OCTET_STRING.h:15
asn_TYPE_descriptor_t asn_DEF_DangerousGoodsBasic
static ber_tlv_tag_t asn_DEF_DangerousGoodsExtended_tags_1[]
unsigned ber_tlv_tag_t
Definition: ber_tlv_tag.h:18