1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
17 * Szabo, Janos Zoltan – initial implementation
19 ******************************************************************************/
20 #ifndef ASN_External_HH
21 #define ASN_External_HH
24 #include "Basetype.hh"
25 #include "Template.hh"
27 #include "ASN_Null.hh"
30 #include "Octetstring.hh"
31 #include "Universal_charstring.hh"
33 class EXTERNAL_identification;
34 class EXTERNAL_identification_template;
35 class EXTERNAL_identification_syntaxes;
36 class EXTERNAL_identification_syntaxes_template;
37 class EXTERNAL_identification_context__negotiation;
38 class EXTERNAL_identification_context__negotiation_template;
40 class EXTERNAL_template;
44 class EXTERNAL_identification : public Base_Type {
46 enum union_selection_type { UNBOUND_VALUE = 0, ALT_syntaxes = 1, ALT_syntax = 2, ALT_presentation__context__id = 3, ALT_context__negotiation = 4, ALT_transfer__syntax = 5, ALT_fixed = 6 };
48 union_selection_type union_selection;
50 EXTERNAL_identification_syntaxes *field_syntaxes;
52 INTEGER *field_presentation__context__id;
53 EXTERNAL_identification_context__negotiation *field_context__negotiation;
54 OBJID *field_transfer__syntax;
55 ASN_NULL *field_fixed;
57 void copy_value(const EXTERNAL_identification& other_value);
60 EXTERNAL_identification();
61 EXTERNAL_identification(const EXTERNAL_identification& other_value);
62 ~EXTERNAL_identification();
63 EXTERNAL_identification& operator=(const EXTERNAL_identification& other_value);
64 boolean operator==(const EXTERNAL_identification& other_value) const;
65 inline boolean operator!=(const EXTERNAL_identification& other_value) const { return !(*this == other_value); }
66 EXTERNAL_identification_syntaxes& syntaxes();
67 const EXTERNAL_identification_syntaxes& syntaxes() const;
69 const OBJID& syntax() const;
70 INTEGER& presentation__context__id();
71 const INTEGER& presentation__context__id() const;
72 EXTERNAL_identification_context__negotiation& context__negotiation();
73 const EXTERNAL_identification_context__negotiation& context__negotiation() const;
74 OBJID& transfer__syntax();
75 const OBJID& transfer__syntax() const;
77 const ASN_NULL& fixed() const;
78 inline union_selection_type get_selection() const { return union_selection; }
79 boolean ischosen(union_selection_type checked_selection) const;
80 inline boolean is_bound() const
81 { return union_selection != UNBOUND_VALUE; }
82 boolean is_value() const;
85 #ifdef TITAN_RUNTIME_2
86 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const EXTERNAL_identification*>(other_value)); }
87 void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification*>(other_value)); }
88 Base_Type* clone() const { return new EXTERNAL_identification(*this); }
89 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
91 inline boolean is_present() const { return is_bound(); }
93 void set_param(Module_Param& param);
94 Module_Param* get_param(Module_Param_Name& param_name) const;
95 void encode_text(Text_Buf& text_buf) const;
96 void decode_text(Text_Buf& text_buf);
99 class EXTERNAL_identification_template : public Base_Template {
102 EXTERNAL_identification::union_selection_type union_selection;
104 EXTERNAL_identification_syntaxes_template *field_syntaxes;
105 OBJID_template *field_syntax;
106 INTEGER_template *field_presentation__context__id;
107 EXTERNAL_identification_context__negotiation_template *field_context__negotiation;
108 OBJID_template *field_transfer__syntax;
109 ASN_NULL_template *field_fixed;
113 unsigned int n_values;
114 EXTERNAL_identification_template *list_value;
118 void copy_value(const EXTERNAL_identification& other_value);
120 void copy_template(const EXTERNAL_identification_template& other_value);
123 EXTERNAL_identification_template();
124 EXTERNAL_identification_template(template_sel other_value);
125 EXTERNAL_identification_template(const EXTERNAL_identification& other_value);
126 EXTERNAL_identification_template(const OPTIONAL<EXTERNAL_identification>& other_value);
127 EXTERNAL_identification_template(const EXTERNAL_identification_template& other_value);
128 ~EXTERNAL_identification_template();
131 EXTERNAL_identification_template& operator=(template_sel other_value);
132 EXTERNAL_identification_template& operator=(const EXTERNAL_identification& other_value);
133 EXTERNAL_identification_template& operator=(const OPTIONAL<EXTERNAL_identification>& other_value);
134 EXTERNAL_identification_template& operator=(const EXTERNAL_identification_template& other_value);
135 boolean match(const EXTERNAL_identification& other_value, boolean legacy = FALSE) const;
136 EXTERNAL_identification valueof() const;
137 EXTERNAL_identification_template& list_item(unsigned int list_index) const;
138 void set_type(template_sel template_type, unsigned int list_length);
139 EXTERNAL_identification_syntaxes_template& syntaxes();
140 const EXTERNAL_identification_syntaxes_template& syntaxes() const;
141 OBJID_template& syntax();
142 const OBJID_template& syntax() const;
143 INTEGER_template& presentation__context__id();
144 const INTEGER_template& presentation__context__id() const;
145 EXTERNAL_identification_context__negotiation_template& context__negotiation();
146 const EXTERNAL_identification_context__negotiation_template& context__negotiation() const;
147 OBJID_template& transfer__syntax();
148 const OBJID_template& transfer__syntax() const;
149 ASN_NULL_template& fixed();
150 const ASN_NULL_template& fixed() const;
151 boolean ischosen(EXTERNAL_identification::union_selection_type checked_selection) const;
153 void log_match(const EXTERNAL_identification& match_value, boolean legacy = FALSE) const;
154 void encode_text(Text_Buf& text_buf) const;
155 void decode_text(Text_Buf& text_buf);
157 boolean is_present(boolean legacy = FALSE) const;
158 boolean match_omit(boolean legacy = FALSE) const;
159 void set_param(Module_Param& param);
160 Module_Param* get_param(Module_Param_Name& param_name) const;
161 #ifdef TITAN_RUNTIME_2
162 void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification*>(value)) = valueof(); }
163 void set_value(template_sel other_value) { *this = other_value; }
164 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification*>(other_value)); }
165 Base_Template* clone() const { return new EXTERNAL_identification_template(*this); }
166 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
167 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const EXTERNAL_identification*>(other_value)), legacy); }
168 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const EXTERNAL_identification*>(match_value)), legacy); }
170 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
174 class EXTERNAL_identification_syntaxes : public Base_Type {
175 OBJID field_abstract;
176 OBJID field_transfer;
178 EXTERNAL_identification_syntaxes();
179 EXTERNAL_identification_syntaxes(const OBJID& par_abstract,
180 const OBJID& par_transfer);
181 boolean operator==(const EXTERNAL_identification_syntaxes& other_value) const;
182 inline boolean operator!=(const EXTERNAL_identification_syntaxes& other_value) const
183 { return !(*this == other_value); }
185 inline OBJID& abstract()
186 {return field_abstract;}
187 inline const OBJID& abstract() const
188 {return field_abstract;}
189 inline OBJID& transfer()
190 {return field_transfer;}
191 inline const OBJID& transfer() const
192 {return field_transfer;}
195 boolean is_bound() const;
196 boolean is_value() const;
198 #ifdef TITAN_RUNTIME_2
199 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)); }
200 void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)); }
201 Base_Type* clone() const { return new EXTERNAL_identification_syntaxes(*this); }
202 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
204 inline boolean is_present() const { return is_bound(); }
206 void set_param(Module_Param& param);
207 Module_Param* get_param(Module_Param_Name& param_name) const;
208 void encode_text(Text_Buf& text_buf) const;
209 void decode_text(Text_Buf& text_buf);
212 class EXTERNAL_identification_syntaxes_template : public Base_Template {
216 struct single_value_struct;
221 single_value_struct *single_value;
223 unsigned int n_values;
224 EXTERNAL_identification_syntaxes_template *list_value;
229 void copy_value(const EXTERNAL_identification_syntaxes& other_value);
230 void copy_template(const EXTERNAL_identification_syntaxes_template& other_value);
233 EXTERNAL_identification_syntaxes_template();
234 EXTERNAL_identification_syntaxes_template(template_sel other_value);
235 EXTERNAL_identification_syntaxes_template(const EXTERNAL_identification_syntaxes& other_value);
236 EXTERNAL_identification_syntaxes_template(const OPTIONAL<EXTERNAL_identification_syntaxes>& other_value);
237 EXTERNAL_identification_syntaxes_template(const EXTERNAL_identification_syntaxes_template& other_value);
238 ~EXTERNAL_identification_syntaxes_template();
240 EXTERNAL_identification_syntaxes_template& operator=(template_sel other_value);
241 EXTERNAL_identification_syntaxes_template& operator=(const EXTERNAL_identification_syntaxes& other_value);
242 EXTERNAL_identification_syntaxes_template& operator=(const OPTIONAL<EXTERNAL_identification_syntaxes>& other_value);
243 EXTERNAL_identification_syntaxes_template& operator=(const EXTERNAL_identification_syntaxes_template& other_value);
244 boolean match(const EXTERNAL_identification_syntaxes& other_value, boolean legacy = FALSE) const;
245 EXTERNAL_identification_syntaxes valueof() const;
246 void set_type(template_sel template_type, unsigned int list_length);
247 EXTERNAL_identification_syntaxes_template& list_item(unsigned int list_index) const;
248 OBJID_template& abstract();
249 const OBJID_template& abstract() const;
250 OBJID_template& transfer();
251 const OBJID_template& transfer() const;
254 void log_match(const EXTERNAL_identification_syntaxes& match_value, boolean legacy = FALSE) const;
255 void encode_text(Text_Buf& text_buf) const;
256 void decode_text(Text_Buf& text_buf);
258 boolean is_present(boolean legacy = FALSE) const;
259 boolean match_omit(boolean legacy = FALSE) const;
260 void set_param(Module_Param& param);
261 Module_Param* get_param(Module_Param_Name& param_name) const;
262 #ifdef TITAN_RUNTIME_2
263 void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification_syntaxes*>(value)) = valueof(); }
264 void set_value(template_sel other_value) { *this = other_value; }
265 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)); }
266 Base_Template* clone() const { return new EXTERNAL_identification_syntaxes_template(*this); }
267 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
268 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)), legacy); }
269 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const EXTERNAL_identification_syntaxes*>(match_value)), legacy); }
271 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
275 class EXTERNAL_identification_context__negotiation : public Base_Type {
276 INTEGER field_presentation__context__id;
277 OBJID field_transfer__syntax;
279 EXTERNAL_identification_context__negotiation();
280 EXTERNAL_identification_context__negotiation(const INTEGER& par_presentation__context__id,
281 const OBJID& par_transfer__syntax);
282 boolean operator==(const EXTERNAL_identification_context__negotiation& other_value) const;
283 inline boolean operator!=(const EXTERNAL_identification_context__negotiation& other_value) const
284 { return !(*this == other_value); }
286 inline INTEGER& presentation__context__id()
287 {return field_presentation__context__id;}
288 inline const INTEGER& presentation__context__id() const
289 {return field_presentation__context__id;}
290 inline OBJID& transfer__syntax()
291 {return field_transfer__syntax;}
292 inline const OBJID& transfer__syntax() const
293 {return field_transfer__syntax;}
296 boolean is_bound() const;
297 boolean is_value() const;
299 #ifdef TITAN_RUNTIME_2
300 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)); }
301 void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)); }
302 Base_Type* clone() const { return new EXTERNAL_identification_context__negotiation(*this); }
303 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
305 inline boolean is_present() const { return is_bound(); }
307 void set_param(Module_Param& param);
308 Module_Param* get_param(Module_Param_Name& param_name) const;
309 void encode_text(Text_Buf& text_buf) const;
310 void decode_text(Text_Buf& text_buf);
313 class EXTERNAL_identification_context__negotiation_template : public Base_Template {
317 struct single_value_struct;
322 single_value_struct *single_value;
324 unsigned int n_values;
325 EXTERNAL_identification_context__negotiation_template *list_value;
330 void copy_value(const EXTERNAL_identification_context__negotiation& other_value);
331 void copy_template(const EXTERNAL_identification_context__negotiation_template& other_value);
334 EXTERNAL_identification_context__negotiation_template();
335 EXTERNAL_identification_context__negotiation_template(template_sel other_value);
336 EXTERNAL_identification_context__negotiation_template(const EXTERNAL_identification_context__negotiation& other_value);
337 EXTERNAL_identification_context__negotiation_template(const OPTIONAL<EXTERNAL_identification_context__negotiation>& other_value);
338 EXTERNAL_identification_context__negotiation_template(const EXTERNAL_identification_context__negotiation_template& other_value);
339 ~EXTERNAL_identification_context__negotiation_template();
341 EXTERNAL_identification_context__negotiation_template& operator=(template_sel other_value);
342 EXTERNAL_identification_context__negotiation_template& operator=(const EXTERNAL_identification_context__negotiation& other_value);
343 EXTERNAL_identification_context__negotiation_template& operator=(const OPTIONAL<EXTERNAL_identification_context__negotiation>& other_value);
344 EXTERNAL_identification_context__negotiation_template& operator=(const EXTERNAL_identification_context__negotiation_template& other_value);
345 boolean match(const EXTERNAL_identification_context__negotiation& other_value, boolean legacy = FALSE) const;
346 EXTERNAL_identification_context__negotiation valueof() const;
347 void set_type(template_sel template_type, unsigned int list_length);
348 EXTERNAL_identification_context__negotiation_template& list_item(unsigned int list_index) const;
349 INTEGER_template& presentation__context__id();
350 const INTEGER_template& presentation__context__id() const;
351 OBJID_template& transfer__syntax();
352 const OBJID_template& transfer__syntax() const;
355 void log_match(const EXTERNAL_identification_context__negotiation& match_value, boolean legacy = FALSE) const;
356 void encode_text(Text_Buf& text_buf) const;
357 void decode_text(Text_Buf& text_buf);
359 boolean is_present(boolean legacy = FALSE) const;
360 boolean match_omit(boolean legacy = FALSE) const;
361 void set_param(Module_Param& param);
362 Module_Param* get_param(Module_Param_Name& param_name) const;
363 #ifdef TITAN_RUNTIME_2
364 void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification_context__negotiation*>(value)) = valueof(); }
365 void set_value(template_sel other_value) { *this = other_value; }
366 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)); }
367 Base_Template* clone() const { return new EXTERNAL_identification_context__negotiation_template(*this); }
368 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
369 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)), legacy); }
370 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const EXTERNAL_identification_context__negotiation*>(match_value)), legacy); }
372 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
376 class EXTERNAL : public Base_Type {
377 EXTERNAL_identification field_identification;
378 OPTIONAL<UNIVERSAL_CHARSTRING> field_data__value__descriptor;
379 OCTETSTRING field_data__value;
381 void transfer(void*);
384 EXTERNAL(const EXTERNAL_identification& par_identification,
385 const OPTIONAL<UNIVERSAL_CHARSTRING>& par_data__value__descriptor,
386 const OCTETSTRING& par_data__value);
387 boolean operator==(const EXTERNAL& other_value) const;
388 inline boolean operator!=(const EXTERNAL& other_value) const
389 { return !(*this == other_value); }
391 inline EXTERNAL_identification& identification()
392 {return field_identification;}
393 inline const EXTERNAL_identification& identification() const
394 {return field_identification;}
395 inline OPTIONAL<UNIVERSAL_CHARSTRING>& data__value__descriptor()
396 {return field_data__value__descriptor;}
397 inline const OPTIONAL<UNIVERSAL_CHARSTRING>& data__value__descriptor() const
398 {return field_data__value__descriptor;}
399 inline OCTETSTRING& data__value()
400 {return field_data__value;}
401 inline const OCTETSTRING& data__value() const
402 {return field_data__value;}
404 boolean is_bound() const;
405 boolean is_value() const;
408 #ifdef TITAN_RUNTIME_2
409 boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const EXTERNAL*>(other_value)); }
410 void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL*>(other_value)); }
411 Base_Type* clone() const { return new EXTERNAL(*this); }
412 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
414 inline boolean is_present() const { return is_bound(); }
416 void set_param(Module_Param& param);
417 Module_Param* get_param(Module_Param_Name& param_name) const;
418 void encode_text(Text_Buf& text_buf) const;
419 void decode_text(Text_Buf& text_buf);
420 void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const;
421 void decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...);
422 ASN_BER_TLV_t* BER_encode_TLV(const TTCN_Typedescriptor_t& p_td, unsigned p_coding) const;
423 boolean BER_decode_TLV(const TTCN_Typedescriptor_t& p_td, const ASN_BER_TLV_t& p_tlv, unsigned L_form);
424 int XER_encode(const XERdescriptor_t& p_td,
425 TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const;
426 int XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader,
427 unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*);
430 class EXTERNAL_template : public Base_Template {
434 struct single_value_struct;
439 single_value_struct *single_value;
441 unsigned int n_values;
442 EXTERNAL_template *list_value;
447 void copy_value(const EXTERNAL& other_value);
448 void copy_template(const EXTERNAL_template& other_value);
452 EXTERNAL_template(template_sel other_value);
453 EXTERNAL_template(const EXTERNAL& other_value);
454 EXTERNAL_template(const OPTIONAL<EXTERNAL>& other_value);
455 EXTERNAL_template(const EXTERNAL_template& other_value);
456 ~EXTERNAL_template();
458 EXTERNAL_template& operator=(template_sel other_value);
459 EXTERNAL_template& operator=(const EXTERNAL& other_value);
460 EXTERNAL_template& operator=(const OPTIONAL<EXTERNAL>& other_value);
461 EXTERNAL_template& operator=(const EXTERNAL_template& other_value);
462 boolean match(const EXTERNAL& other_value, boolean legacy = FALSE) const;
463 EXTERNAL valueof() const;
464 void set_type(template_sel template_type, unsigned int list_length);
465 EXTERNAL_template& list_item(unsigned int list_index) const;
466 EXTERNAL_identification_template& identification();
467 const EXTERNAL_identification_template& identification() const;
468 UNIVERSAL_CHARSTRING_template& data__value__descriptor();
469 const UNIVERSAL_CHARSTRING_template& data__value__descriptor() const;
470 OCTETSTRING_template& data__value();
471 const OCTETSTRING_template& data__value() const;
474 void log_match(const EXTERNAL& match_value, boolean legacy = FALSE) const;
475 void encode_text(Text_Buf& text_buf) const;
476 void decode_text(Text_Buf& text_buf);
478 boolean is_present(boolean legacy = FALSE) const;
479 boolean match_omit(boolean legacy = FALSE) const;
480 void set_param(Module_Param& param);
481 Module_Param* get_param(Module_Param_Name& param_name) const;
482 #ifdef TITAN_RUNTIME_2
483 void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL*>(value)) = valueof(); }
484 void set_value(template_sel other_value) { *this = other_value; }
485 void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL*>(other_value)); }
486 Base_Template* clone() const { return new EXTERNAL_template(*this); }
487 const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; }
488 boolean matchv(const Base_Type* other_value, boolean legacy) const { return match(*(static_cast<const EXTERNAL*>(other_value)), legacy); }
489 void log_matchv(const Base_Type* match_value, boolean legacy) const { log_match(*(static_cast<const EXTERNAL*>(match_value)), legacy); }
491 void check_restriction(template_res t_res, const char* t_name=NULL, boolean legacy = FALSE) const;
495 #endif // ASN_External_HH