1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 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
7 ///////////////////////////////////////////////////////////////////////////////
10 #include "ASN_External.hh"
13 #include "ASN_Null.hh"
14 #include "Bitstring.hh"
17 #include "Octetstring.hh"
18 #include "Universal_charstring.hh"
20 #include "Parameters.h"
21 #include "Param_Types.hh"
28 #include "../common/dbgnew.hh"
31 * This type is used to BER encode/decode the EXTERNAL type.
32 * For details, see X.690 8.18.
37 to do when regenerating:
41 add __SUNPRO_CC ifdefs for single_value_struct
43 delete encode/decode members except for EXTERNAL
47 leave transfer syntax in anonymous namespace
49 delete encode/decode members except for EXTERNAL
50 leave EXTERNAL::BER_encode_TLV() -- written by hand
51 leave EXTERNAL::BER_decode_TLV() -- written by hand
53 replace '@EXTERNAL' with 'EXTERNAL'
55 remove RAW and TEXT enc/dec functions
59 namespace { /* anonymous namespace */
61 class EXTERNALtransfer_encoding
;
62 class EXTERNALtransfer
;
64 class EXTERNALtransfer_encoding
: public Base_Type
{
66 enum union_selection_type
{ UNBOUND_VALUE
= 0, ALT_single__ASN1__type
= 1, ALT_octet__aligned
= 2, ALT_arbitrary
= 3 };
68 union_selection_type union_selection
;
70 ASN_ANY
*field_single__ASN1__type
;
71 OCTETSTRING
*field_octet__aligned
;
72 BITSTRING
*field_arbitrary
;
75 void copy_value(const EXTERNALtransfer_encoding
& other_value
);
78 EXTERNALtransfer_encoding()
79 { union_selection
= UNBOUND_VALUE
; }
80 EXTERNALtransfer_encoding(const EXTERNALtransfer_encoding
& other_value
)
81 : Base_Type(other_value
)
82 { copy_value(other_value
); }
83 ~EXTERNALtransfer_encoding() { clean_up(); }
84 EXTERNALtransfer_encoding
& operator=(const EXTERNALtransfer_encoding
& other_value
);
85 ASN_ANY
& single__ASN1__type();
86 const ASN_ANY
& single__ASN1__type() const;
87 OCTETSTRING
& octet__aligned();
88 const OCTETSTRING
& octet__aligned() const;
89 BITSTRING
& arbitrary();
90 const BITSTRING
& arbitrary() const;
91 inline union_selection_type
get_selection() const { return union_selection
; }
92 #ifdef TITAN_RUNTIME_2
93 void set_param(Module_Param
& /*param*/) { TTCN_error("Internal error: EXTERNALtransfer_encoding::set_param() called."); }
94 void encode_text(Text_Buf
& /*text_buf*/) const { TTCN_error("Internal error: EXTERNALtransfer_encoding::encode_text() called."); }
95 void decode_text(Text_Buf
& /*text_buf*/) { TTCN_error("Internal error: EXTERNALtransfer_encoding::decode_text() called."); }
96 boolean
is_bound() const { return union_selection
!=UNBOUND_VALUE
; }
97 boolean
is_equal(const Base_Type
* /*other_value*/) const { TTCN_error("Internal error: EXTERNALtransfer_encoding::is_equal() called."); }
98 void set_value(const Base_Type
* /*other_value*/) { TTCN_error("Internal error: EXTERNALtransfer_encoding::set_value() called."); }
99 Base_Type
* clone() const { TTCN_error("Internal error: EXTERNALtransfer_encoding::clone() called."); }
100 const TTCN_Typedescriptor_t
* get_descriptor() const { TTCN_error("Internal error: EXTERNALtransfer_encoding::get_descriptor() called."); }
102 ASN_BER_TLV_t
* BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const;
103 boolean
BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
);
104 int XER_encode(const XERdescriptor_t
& p_td
,
105 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const;
106 int XER_decode(const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
,
107 unsigned int flavor
, embed_values_dec_struct_t
*);
109 boolean
BER_decode_set_selection(const ASN_BER_TLV_t
& p_tlv
);
111 boolean
BER_decode_isMyMsg(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
);
114 /** This class is used to encode/decode the EXTERNAL type.
116 * The sequence type used for encoding/decoding the EXTERNAL type
117 * differs from the associated type of EXTERNAL. See
118 * = X.690 (BER), 8.18.1 ;
119 * = X.691 (PER), 26.1 ;
122 * The actual encoding/decoding is performed by this class and its members.
123 * Data is transferred to/from an object of class EXTERNAL. */
124 class EXTERNALtransfer
: public Base_Type
{
125 OPTIONAL
<OBJID
> field_direct__reference
;
126 OPTIONAL
<INTEGER
> field_indirect__reference
;
127 OPTIONAL
<ObjectDescriptor
> field_data__value__descriptor
;
128 EXTERNALtransfer_encoding field_encoding
;
130 void load(const EXTERNAL
& ex
);
131 inline OPTIONAL
<OBJID
>& direct__reference()
132 {return field_direct__reference
;}
133 inline const OPTIONAL
<OBJID
>& direct__reference() const
134 {return field_direct__reference
;}
135 inline OPTIONAL
<INTEGER
>& indirect__reference()
136 {return field_indirect__reference
;}
137 inline const OPTIONAL
<INTEGER
>& indirect__reference() const
138 {return field_indirect__reference
;}
139 inline OPTIONAL
<ObjectDescriptor
>& data__value__descriptor()
140 {return field_data__value__descriptor
;}
141 inline const OPTIONAL
<ObjectDescriptor
>& data__value__descriptor() const
142 {return field_data__value__descriptor
;}
143 inline EXTERNALtransfer_encoding
& encoding()
144 {return field_encoding
;}
145 inline const EXTERNALtransfer_encoding
& encoding() const
146 {return field_encoding
;}
147 #ifdef TITAN_RUNTIME_2
148 void set_param(Module_Param
& /*param*/) { TTCN_error("Internal error: EXTERNALtransfer::set_param() called."); }
149 void encode_text(Text_Buf
& /*text_buf*/) const { TTCN_error("Internal error: EXTERNALtransfer::encode_text() called."); }
150 void decode_text(Text_Buf
& /*text_buf*/) { TTCN_error("Internal error: EXTERNALtransfer::decode_text() called."); }
151 boolean
is_bound() const { TTCN_error("Internal error: EXTERNALtransfer::is_bound() called."); }
152 boolean
is_value() const { TTCN_error("Internal error: EXTERNALtransfer::is_value() called."); }
153 void clean_up() { TTCN_error("Internal error: EXTERNALtransfer::clean_up() called."); }
154 boolean
is_equal(const Base_Type
* /*other_value*/) const { TTCN_error("Internal error: EXTERNALtransfer::is_equal() called."); }
155 void set_value(const Base_Type
* /*other_value*/) { TTCN_error("Internal error: EXTERNALtransfer::set_value() called."); }
156 Base_Type
* clone() const { TTCN_error("Internal error: EXTERNALtransfer::clone() called."); }
157 const TTCN_Typedescriptor_t
* get_descriptor() const { TTCN_error("Internal error: EXTERNALtransfer::get_descriptor() called."); }
159 ASN_BER_TLV_t
* BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const;
160 boolean
BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
);
161 int XER_encode(const XERdescriptor_t
& p_td
,
162 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const;
163 int XER_decode(const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
,
164 unsigned int flavor
, embed_values_dec_struct_t
*);
167 /** Transform the information from the visible format to the encoding format
169 * Called from EXTERNAL::XER_encode() */
170 void EXTERNALtransfer::load(const EXTERNAL
& ex
)
172 // ALT_syntaxes, ALT_transfer__syntax and ALT_fixed do not appear below.
173 // These are forbidden for the EXTERNAL type.
174 switch(ex
.identification().get_selection()) {
175 case EXTERNAL_identification::ALT_syntax
:
176 field_direct__reference
=ex
.identification().syntax();
178 case EXTERNAL_identification::ALT_context__negotiation
:
179 field_direct__reference
=ex
.identification().context__negotiation().transfer__syntax();
182 field_direct__reference
=OMIT_VALUE
;
185 switch(ex
.identification().get_selection()) {
186 case EXTERNAL_identification::ALT_presentation__context__id
:
187 field_indirect__reference
=ex
.identification().presentation__context__id();
189 case EXTERNAL_identification::ALT_context__negotiation
:
190 field_indirect__reference
=ex
.identification().context__negotiation().presentation__context__id();
193 field_indirect__reference
=OMIT_VALUE
;
196 field_data__value__descriptor
=ex
.data__value__descriptor();
197 field_encoding
.octet__aligned()=ex
.data__value();
200 static const TTCN_Typedescriptor_t EXTERNALtransfer_encoding_descr_
= { "EXTERNALtransfer.encoding", &CHOICE_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
202 static const ASN_Tag_t EXTERNALtransfer_encoding_single__ASN1__type_tag_
[] = { { ASN_TAG_CONT
, 0u } };
203 static const ASN_BERdescriptor_t EXTERNALtransfer_encoding_single__ASN1__type_ber_
= { 1u, EXTERNALtransfer_encoding_single__ASN1__type_tag_
};
204 static const TTCN_Typedescriptor_t EXTERNALtransfer_encoding_single__ASN1__type_descr_
= { "EXTERNALtransfer.encoding.single-ASN1-type", &EXTERNALtransfer_encoding_single__ASN1__type_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
206 static const ASN_Tag_t EXTERNALtransfer_encoding_octet__aligned_tag_
[] = { { ASN_TAG_CONT
, 1u } };
207 static const ASN_BERdescriptor_t EXTERNALtransfer_encoding_octet__aligned_ber_
= { 1u, EXTERNALtransfer_encoding_octet__aligned_tag_
};
208 static const TTCN_Typedescriptor_t EXTERNALtransfer_encoding_octet__aligned_descr_
= { "EXTERNALtransfer.encoding.octet-aligned", &EXTERNALtransfer_encoding_octet__aligned_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
210 static const ASN_Tag_t EXTERNALtransfer_encoding_arbitrary_tag_
[] = { { ASN_TAG_CONT
, 2u } };
211 static const ASN_BERdescriptor_t EXTERNALtransfer_encoding_arbitrary_ber_
= { 1u, EXTERNALtransfer_encoding_arbitrary_tag_
};
212 static const TTCN_Typedescriptor_t EXTERNALtransfer_encoding_arbitrary_descr_
= { "EXTERNALtransfer.encoding.arbitrary", &EXTERNALtransfer_encoding_arbitrary_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
214 /* Member functions of C++ classes */
216 void EXTERNALtransfer_encoding::clean_up()
218 switch (union_selection
) {
219 case ALT_single__ASN1__type
:
220 delete field_single__ASN1__type
;
222 case ALT_octet__aligned
:
223 delete field_octet__aligned
;
226 delete field_arbitrary
;
231 union_selection
= UNBOUND_VALUE
;
234 void EXTERNALtransfer_encoding::copy_value(const EXTERNALtransfer_encoding
& other_value
)
236 switch (other_value
.union_selection
) {
237 case ALT_single__ASN1__type
:
238 field_single__ASN1__type
= new ASN_ANY(*other_value
.field_single__ASN1__type
);
240 case ALT_octet__aligned
:
241 field_octet__aligned
= new OCTETSTRING(*other_value
.field_octet__aligned
);
244 field_arbitrary
= new BITSTRING(*other_value
.field_arbitrary
);
247 TTCN_error("Assignment of an unbound union value of type EXTERNALtransfer.encoding.");
249 union_selection
= other_value
.union_selection
;
252 EXTERNALtransfer_encoding
& EXTERNALtransfer_encoding::operator=(const EXTERNALtransfer_encoding
& other_value
)
254 if(this != &other_value
) {
256 copy_value(other_value
);
261 ASN_ANY
& EXTERNALtransfer_encoding::single__ASN1__type()
263 if (union_selection
!= ALT_single__ASN1__type
) {
265 field_single__ASN1__type
= new ASN_ANY
;
266 union_selection
= ALT_single__ASN1__type
;
268 return *field_single__ASN1__type
;
271 const ASN_ANY
& EXTERNALtransfer_encoding::single__ASN1__type() const
273 if (union_selection
!= ALT_single__ASN1__type
) TTCN_error("Using non-selected field single-ASN1-type in a value of union type EXTERNALtransfer.encoding.");
274 return *field_single__ASN1__type
;
277 OCTETSTRING
& EXTERNALtransfer_encoding::octet__aligned()
279 if (union_selection
!= ALT_octet__aligned
) {
281 field_octet__aligned
= new OCTETSTRING
;
282 union_selection
= ALT_octet__aligned
;
284 return *field_octet__aligned
;
287 const OCTETSTRING
& EXTERNALtransfer_encoding::octet__aligned() const
289 if (union_selection
!= ALT_octet__aligned
) TTCN_error("Using non-selected field octet-aligned in a value of union type EXTERNALtransfer.encoding.");
290 return *field_octet__aligned
;
293 BITSTRING
& EXTERNALtransfer_encoding::arbitrary()
295 if (union_selection
!= ALT_arbitrary
) {
297 field_arbitrary
= new BITSTRING
;
298 union_selection
= ALT_arbitrary
;
300 return *field_arbitrary
;
303 const BITSTRING
& EXTERNALtransfer_encoding::arbitrary() const
305 if (union_selection
!= ALT_arbitrary
) TTCN_error("Using non-selected field arbitrary in a value of union type EXTERNALtransfer.encoding.");
306 return *field_arbitrary
;
309 ASN_BER_TLV_t
* EXTERNALtransfer_encoding::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
312 ASN_BER_TLV_t
*new_tlv
;
313 TTCN_EncDec_ErrorContext
ec_0("Alternative '");
314 TTCN_EncDec_ErrorContext ec_1
;
315 switch (union_selection
) {
316 case ALT_single__ASN1__type
:
317 ec_1
.set_msg("single-ASN1-type': ");
318 new_tlv
=field_single__ASN1__type
->BER_encode_TLV(EXTERNALtransfer_encoding_single__ASN1__type_descr_
, p_coding
);
320 case ALT_octet__aligned
:
321 ec_1
.set_msg("octet-aligned': ");
322 new_tlv
=field_octet__aligned
->BER_encode_TLV(EXTERNALtransfer_encoding_octet__aligned_descr_
, p_coding
);
325 ec_1
.set_msg("arbitrary': ");
326 new_tlv
=field_arbitrary
->BER_encode_TLV(EXTERNALtransfer_encoding_arbitrary_descr_
, p_coding
);
329 new_tlv
=BER_encode_chk_bound(FALSE
);
332 TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
336 return ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
339 boolean
EXTERNALtransfer_encoding::BER_decode_set_selection(const ASN_BER_TLV_t
& p_tlv
)
342 union_selection
=ALT_single__ASN1__type
;
343 field_single__ASN1__type
=new ASN_ANY
;
344 if(field_single__ASN1__type
->BER_decode_isMyMsg(EXTERNALtransfer_encoding_single__ASN1__type_descr_
, p_tlv
))
346 delete field_single__ASN1__type
;
347 union_selection
=ALT_octet__aligned
;
348 field_octet__aligned
=new OCTETSTRING
;
349 if(field_octet__aligned
->BER_decode_isMyMsg(EXTERNALtransfer_encoding_octet__aligned_descr_
, p_tlv
))
351 delete field_octet__aligned
;
352 union_selection
=ALT_arbitrary
;
353 field_arbitrary
=new BITSTRING
;
354 if(field_arbitrary
->BER_decode_isMyMsg(EXTERNALtransfer_encoding_arbitrary_descr_
, p_tlv
))
356 delete field_arbitrary
;
357 union_selection
=UNBOUND_VALUE
;
361 boolean
EXTERNALtransfer_encoding::BER_decode_isMyMsg(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
)
363 if(p_td
.ber
->n_tags
==0) {
364 EXTERNALtransfer_encoding tmp_type
;
365 return tmp_type
.BER_decode_set_selection(p_tlv
);
367 else return Base_Type::BER_decode_isMyMsg(p_td
, p_tlv
);
370 boolean
EXTERNALtransfer_encoding::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
373 ASN_BER_TLV_t stripped_tlv
;
374 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
375 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EXTERNALtransfer.encoding' type: ");
376 ASN_BER_TLV_t tmp_tlv
;
377 if(!BER_decode_TLV_CHOICE(*p_td
.ber
, stripped_tlv
, L_form
, tmp_tlv
) || !BER_decode_CHOICE_selection(BER_decode_set_selection(tmp_tlv
), tmp_tlv
))
379 TTCN_EncDec_ErrorContext
ec_1("Alternative '");
380 TTCN_EncDec_ErrorContext ec_2
;
381 switch (union_selection
) {
382 case ALT_single__ASN1__type
:
383 ec_2
.set_msg("single-ASN1-type': ");
384 field_single__ASN1__type
->BER_decode_TLV(EXTERNALtransfer_encoding_single__ASN1__type_descr_
, tmp_tlv
, L_form
);
386 case ALT_octet__aligned
:
387 ec_2
.set_msg("octet-aligned': ");
388 field_octet__aligned
->BER_decode_TLV(EXTERNALtransfer_encoding_octet__aligned_descr_
, tmp_tlv
, L_form
);
391 ec_2
.set_msg("arbitrary': ");
392 field_arbitrary
->BER_decode_TLV(EXTERNALtransfer_encoding_arbitrary_descr_
, tmp_tlv
, L_form
);
400 int EXTERNALtransfer_encoding::XER_encode(const XERdescriptor_t
& p_td
,
401 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
403 int indenting
= !is_canonical(flavor
);
404 int exer
= is_exer(flavor
);
405 int encoded_length
=(int)p_buf
.get_len();
406 if (indenting
) do_indent(p_buf
, indent
);
408 if (exer
) write_ns_prefix(p_td
, p_buf
);
409 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
412 switch (union_selection
) {
413 case ALT_single__ASN1__type
:
414 field_single__ASN1__type
->XER_encode(EXTERNAL_encoding_singleASN_xer_
, p_buf
, flavor
, indent
, 0);
416 case ALT_octet__aligned
:
417 field_octet__aligned
->XER_encode(EXTERNAL_encoding_octet_aligned_xer_
, p_buf
, flavor
, indent
, 0);
420 field_arbitrary
->XER_encode(EXTERNAL_encoding_arbitrary_xer_
, p_buf
, flavor
, indent
, 0);
423 TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND
,
424 "Encoding an unbound value");
427 TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
428 // TODO something at all ?
432 if (indenting
) do_indent(p_buf
, --indent
);
435 if (exer
) write_ns_prefix(p_td
, p_buf
);
436 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
437 return (int)p_buf
.get_len() - encoded_length
;
440 int EXTERNALtransfer_encoding::XER_decode(const XERdescriptor_t
& p_td
,
441 XmlReaderWrap
& reader
, unsigned int flavor
, embed_values_dec_struct_t
*)
443 int exer
= is_exer(flavor
);
444 int success
= reader
.Ok(), type
, depth
= -1;
445 for (; success
==1; success
= reader
.Read()) {
446 type
= reader
.NodeType();
447 if (type
== XML_READER_TYPE_ELEMENT
) {
448 verify_name(reader
, p_td
, exer
);
449 depth
= reader
.Depth();
454 const char * name
= 0;
455 for (success
= reader
.Read(); success
== 1; success
= reader
.Read()) {
456 type
= reader
.NodeType();
457 if (XML_READER_TYPE_ELEMENT
== type
) break;
458 else if (XML_READER_TYPE_END_ELEMENT
== type
) goto bail
;
460 name
= (const char*)reader
.Name();
463 case 's': // single-ASN1-type
464 single__ASN1__type().XER_decode(EXTERNAL_encoding_singleASN_xer_
, reader
, flavor
, 0);
467 case 'o': // octet-aligned
468 octet__aligned().XER_decode(EXTERNAL_encoding_octet_aligned_xer_
, reader
, flavor
, 0);
471 case 'a': // arbitrary
472 arbitrary().XER_decode(EXTERNAL_encoding_arbitrary_xer_
, reader
, flavor
, 0);
476 TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG
,
477 "Doh!"); // FIXME error method and text
481 for (success
= reader
.Read(); success
==1; success
= reader
.Read()) {
482 type
= reader
.NodeType();
483 if (XML_READER_TYPE_END_ELEMENT
== type
) {
484 verify_end(reader
, p_td
, depth
, exer
);
485 reader
.Read(); // one last time
490 return 0; // FIXME return value
493 /******************** EXTERNALtransfer class ********************/
495 ASN_BER_TLV_t
* EXTERNALtransfer::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
498 ASN_BER_TLV_t
*new_tlv
=ASN_BER_TLV_t::construct(NULL
);
499 TTCN_EncDec_ErrorContext
ec_0("Component '");
500 TTCN_EncDec_ErrorContext ec_1
;
501 ec_1
.set_msg("direct-reference': ");
502 new_tlv
->add_TLV(field_direct__reference
.BER_encode_TLV(OBJID_descr_
, p_coding
));
503 ec_1
.set_msg("indirect-reference': ");
504 new_tlv
->add_TLV(field_indirect__reference
.BER_encode_TLV(INTEGER_descr_
, p_coding
));
505 ec_1
.set_msg("data-value-descriptor': ");
506 new_tlv
->add_TLV(field_data__value__descriptor
.BER_encode_TLV(ObjectDescriptor_descr_
, p_coding
));
507 ec_1
.set_msg("encoding': ");
508 new_tlv
->add_TLV(field_encoding
.BER_encode_TLV(EXTERNALtransfer_encoding_descr_
, p_coding
));
509 new_tlv
=ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
513 boolean
EXTERNALtransfer::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
516 ASN_BER_TLV_t stripped_tlv
;
517 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
518 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EXTERNALtransfer' type: ");
519 stripped_tlv
.chk_constructed_flag(TRUE
);
521 ASN_BER_TLV_t tmp_tlv
;
522 boolean tlv_present
=FALSE
;
524 TTCN_EncDec_ErrorContext
ec_1("Component '");
525 TTCN_EncDec_ErrorContext ec_2
;
526 ec_2
.set_msg("direct-reference': ");
527 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
528 if(!tlv_present
) field_direct__reference
=OMIT_VALUE
;
530 field_direct__reference
.BER_decode_TLV(OBJID_descr_
, tmp_tlv
, L_form
);
531 if(field_direct__reference
.ispresent()) tlv_present
=FALSE
;
533 ec_2
.set_msg("indirect-reference': ");
534 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
535 if(!tlv_present
) field_indirect__reference
=OMIT_VALUE
;
537 field_indirect__reference
.BER_decode_TLV(INTEGER_descr_
, tmp_tlv
, L_form
);
538 if(field_indirect__reference
.ispresent()) tlv_present
=FALSE
;
540 ec_2
.set_msg("data-value-descriptor': ");
541 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
542 if(!tlv_present
) field_data__value__descriptor
=OMIT_VALUE
;
544 field_data__value__descriptor
.BER_decode_TLV(ObjectDescriptor_descr_
, tmp_tlv
, L_form
);
545 if(field_data__value__descriptor
.ispresent()) tlv_present
=FALSE
;
547 ec_2
.set_msg("encoding': ");
548 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
549 if(!tlv_present
) return FALSE
;
550 field_encoding
.BER_decode_TLV(EXTERNALtransfer_encoding_descr_
, tmp_tlv
, L_form
);
553 BER_decode_constdTLV_end(stripped_tlv
, V_pos
, L_form
, tmp_tlv
, tlv_present
);
557 int EXTERNALtransfer::XER_encode(const XERdescriptor_t
& p_td
,
558 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
560 int indenting
= !is_canonical(flavor
);
561 int exer
= is_exer(flavor
);
562 int encoded_length
=(int)p_buf
.get_len();
563 if (indenting
) do_indent(p_buf
, indent
);
565 if (exer
) write_ns_prefix(p_td
, p_buf
);
566 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
569 field_direct__reference
.XER_encode(EXTERNAL_direct_reference_xer_
, p_buf
, flavor
, indent
, 0);
570 field_indirect__reference
.XER_encode(EXTERNAL_indirect_reference_xer_
, p_buf
, flavor
, indent
, 0);
571 field_data__value__descriptor
.XER_encode(EXTERNAL_data_value_descriptor_xer_
, p_buf
, flavor
, indent
, 0);
572 field_encoding
.XER_encode(EXTERNAL_encoding_xer_
, p_buf
, flavor
, indent
, 0);
574 if (indenting
) do_indent(p_buf
, --indent
);
577 if (exer
) write_ns_prefix(p_td
, p_buf
);
578 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
579 return (int)p_buf
.get_len() - encoded_length
;
582 int EXTERNALtransfer::XER_decode(const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
,
583 unsigned int flavor
, embed_values_dec_struct_t
*)
585 int exer
= is_exer(flavor
);
586 int success
= reader
.Ok(), depth
= -1;
587 for (; success
== 1; success
= reader
.Read()) {
588 int type
= reader
.NodeType();
589 if (XML_READER_TYPE_ELEMENT
== type
) {
590 verify_name(reader
, p_td
, exer
);
591 depth
= reader
.Depth();
597 field_direct__reference
.XER_decode(EXTERNAL_direct_reference_xer_
, reader
, flavor
, 0);
598 field_indirect__reference
.XER_decode(EXTERNAL_indirect_reference_xer_
, reader
, flavor
, 0);
599 field_data__value__descriptor
.XER_decode(EXTERNAL_data_value_descriptor_xer_
, reader
, flavor
, 0);
600 field_encoding
.XER_decode(EXTERNAL_encoding_xer_
, reader
, flavor
, 0);
602 for (success
= reader
.Read(); success
== 1; success
= reader
.Read()) {
603 int type
= reader
.NodeType();
604 if (XML_READER_TYPE_END_ELEMENT
== type
) {
605 verify_end(reader
, p_td
, depth
, exer
);
606 reader
.Read(); // one more time
610 return 1; // decode successful
612 } // end of anonymous namespace
615 * And this is the EXTERNAL type stuff.
619 * This is written by hand, do not delete it! :)
621 ASN_BER_TLV_t
* EXTERNAL::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
623 EXTERNALtransfer v_tmpmfr
;
624 v_tmpmfr
.load(*this);
625 return v_tmpmfr
.BER_encode_TLV(p_td
, p_coding
);
628 /** Load information from an EXTERNALtransfer
630 * @param x pointer to an EXTERNALtransfer. It is of type void* because
631 * <anonymous-namespace>::EXTERNALtransfer can not appear in the header.
633 * Called by XER_decode() */
634 void EXTERNAL::transfer(void *x
)
636 EXTERNALtransfer
& v_tmpmfr
= *(EXTERNALtransfer
*)x
;
637 if (v_tmpmfr
.direct__reference().ispresent()) {
638 if (v_tmpmfr
.indirect__reference().ispresent()) {
639 EXTERNAL_identification_context__negotiation
& v_tmpjsz
=
640 field_identification
.context__negotiation();
641 v_tmpjsz
.presentation__context__id() = v_tmpmfr
.indirect__reference()();
642 v_tmpjsz
.transfer__syntax() = v_tmpmfr
.direct__reference()();
644 field_identification
.syntax() = v_tmpmfr
.direct__reference()();
647 if (v_tmpmfr
.indirect__reference().ispresent()) {
648 field_identification
.presentation__context__id() =
649 v_tmpmfr
.indirect__reference()();
651 TTCN_EncDec_ErrorContext::warning("Neither direct-reference nor "
652 "indirect-reference is present.");
655 switch (field_identification
.get_selection()) {
656 case EXTERNAL_identification::ALT_syntaxes
:
657 case EXTERNAL_identification::ALT_transfer__syntax
:
658 case EXTERNAL_identification::ALT_fixed
:
659 TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG
,
660 "EXTERNAL type does not allow the syntaxes, transfer-syntax or fixed");
664 break; // rest are OK
667 field_data__value__descriptor
= v_tmpmfr
.data__value__descriptor();
668 const EXTERNALtransfer_encoding
& v_tmpjsz
= v_tmpmfr
.encoding();
669 switch (v_tmpjsz
.get_selection()) {
670 case EXTERNALtransfer_encoding::ALT_single__ASN1__type
:
671 field_data__value
= v_tmpjsz
.single__ASN1__type();
673 case EXTERNALtransfer_encoding::ALT_octet__aligned
:
674 field_data__value
= v_tmpjsz
.octet__aligned();
676 case EXTERNALtransfer_encoding::ALT_arbitrary
:
677 field_data__value
= bit2oct(v_tmpjsz
.arbitrary());
680 TTCN_EncDec_ErrorContext::error_internal("Unknown selection for field "
681 "`encoding' in EXTERNAL type.");
686 * This is written by hand, do not delete it! :)
688 boolean
EXTERNAL::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
690 EXTERNALtransfer v_tmpmfr
;
691 if(!v_tmpmfr
.BER_decode_TLV(p_td
, p_tlv
, L_form
))
697 int EXTERNAL::XER_encode(const XERdescriptor_t
& p_td
,
698 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
701 TTCN_EncDec_ErrorContext::error
702 (TTCN_EncDec::ET_UNBOUND
, "Encoding an unbound value.");
704 EXTERNALtransfer xfer
;
706 return xfer
.XER_encode(p_td
, p_buf
, flavor
, indent
, 0);
709 int EXTERNAL::XER_decode(const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
,
710 unsigned int flavor
, embed_values_dec_struct_t
*)
712 EXTERNALtransfer xfer
;
713 xfer
.XER_decode(p_td
, reader
, flavor
, 0);
715 return 1; // decode successful
718 /* generated stuff */
720 void EXTERNAL_identification::clean_up()
722 switch (union_selection
) {
724 delete field_syntaxes
;
729 case ALT_presentation__context__id
:
730 delete field_presentation__context__id
;
732 case ALT_context__negotiation
:
733 delete field_context__negotiation
;
735 case ALT_transfer__syntax
:
736 delete field_transfer__syntax
;
744 union_selection
= UNBOUND_VALUE
;
747 void EXTERNAL_identification::copy_value(const EXTERNAL_identification
& other_value
)
749 switch (other_value
.union_selection
) {
751 field_syntaxes
= new EXTERNAL_identification_syntaxes(*other_value
.field_syntaxes
);
754 field_syntax
= new OBJID(*other_value
.field_syntax
);
756 case ALT_presentation__context__id
:
757 field_presentation__context__id
= new INTEGER(*other_value
.field_presentation__context__id
);
759 case ALT_context__negotiation
:
760 field_context__negotiation
= new EXTERNAL_identification_context__negotiation(*other_value
.field_context__negotiation
);
762 case ALT_transfer__syntax
:
763 field_transfer__syntax
= new OBJID(*other_value
.field_transfer__syntax
);
766 field_fixed
= new ASN_NULL(*other_value
.field_fixed
);
769 TTCN_error("Assignment of an unbound union value of type EXTERNAL.identification.");
771 union_selection
= other_value
.union_selection
;
774 EXTERNAL_identification::EXTERNAL_identification()
776 union_selection
= UNBOUND_VALUE
;
779 EXTERNAL_identification::EXTERNAL_identification(const EXTERNAL_identification
& other_value
)
780 : Base_Type(other_value
)
782 copy_value(other_value
);
785 EXTERNAL_identification::~EXTERNAL_identification()
790 EXTERNAL_identification
& EXTERNAL_identification::operator=(const EXTERNAL_identification
& other_value
)
792 if (this != &other_value
) {
794 copy_value(other_value
);
799 boolean
EXTERNAL_identification::operator==(const EXTERNAL_identification
& other_value
) const
801 if (union_selection
== UNBOUND_VALUE
) TTCN_error("The left operand of comparison is an unbound value of union type EXTERNAL.identification.");
802 if (other_value
.union_selection
== UNBOUND_VALUE
) TTCN_error("The right operand of comparison is an unbound value of union type EXTERNAL.identification.");
803 if (union_selection
!= other_value
.union_selection
) return FALSE
;
804 switch (union_selection
) {
806 return *field_syntaxes
== *other_value
.field_syntaxes
;
808 return *field_syntax
== *other_value
.field_syntax
;
809 case ALT_presentation__context__id
:
810 return *field_presentation__context__id
== *other_value
.field_presentation__context__id
;
811 case ALT_context__negotiation
:
812 return *field_context__negotiation
== *other_value
.field_context__negotiation
;
813 case ALT_transfer__syntax
:
814 return *field_transfer__syntax
== *other_value
.field_transfer__syntax
;
816 return *field_fixed
== *other_value
.field_fixed
;
822 EXTERNAL_identification_syntaxes
& EXTERNAL_identification::syntaxes()
824 if (union_selection
!= ALT_syntaxes
) {
826 field_syntaxes
= new EXTERNAL_identification_syntaxes
;
827 union_selection
= ALT_syntaxes
;
829 return *field_syntaxes
;
832 const EXTERNAL_identification_syntaxes
& EXTERNAL_identification::syntaxes() const
834 if (union_selection
!= ALT_syntaxes
) TTCN_error("Using non-selected field syntaxes in a value of union type EXTERNAL.identification.");
835 return *field_syntaxes
;
838 OBJID
& EXTERNAL_identification::syntax()
840 if (union_selection
!= ALT_syntax
) {
842 field_syntax
= new OBJID
;
843 union_selection
= ALT_syntax
;
845 return *field_syntax
;
848 const OBJID
& EXTERNAL_identification::syntax() const
850 if (union_selection
!= ALT_syntax
) TTCN_error("Using non-selected field syntax in a value of union type EXTERNAL.identification.");
851 return *field_syntax
;
854 INTEGER
& EXTERNAL_identification::presentation__context__id()
856 if (union_selection
!= ALT_presentation__context__id
) {
858 field_presentation__context__id
= new INTEGER
;
859 union_selection
= ALT_presentation__context__id
;
861 return *field_presentation__context__id
;
864 const INTEGER
& EXTERNAL_identification::presentation__context__id() const
866 if (union_selection
!= ALT_presentation__context__id
) TTCN_error("Using non-selected field presentation_context_id in a value of union type EXTERNAL.identification.");
867 return *field_presentation__context__id
;
870 EXTERNAL_identification_context__negotiation
& EXTERNAL_identification::context__negotiation()
872 if (union_selection
!= ALT_context__negotiation
) {
874 field_context__negotiation
= new EXTERNAL_identification_context__negotiation
;
875 union_selection
= ALT_context__negotiation
;
877 return *field_context__negotiation
;
880 const EXTERNAL_identification_context__negotiation
& EXTERNAL_identification::context__negotiation() const
882 if (union_selection
!= ALT_context__negotiation
) TTCN_error("Using non-selected field context_negotiation in a value of union type EXTERNAL.identification.");
883 return *field_context__negotiation
;
886 OBJID
& EXTERNAL_identification::transfer__syntax()
888 if (union_selection
!= ALT_transfer__syntax
) {
890 field_transfer__syntax
= new OBJID
;
891 union_selection
= ALT_transfer__syntax
;
893 return *field_transfer__syntax
;
896 const OBJID
& EXTERNAL_identification::transfer__syntax() const
898 if (union_selection
!= ALT_transfer__syntax
) TTCN_error("Using non-selected field transfer_syntax in a value of union type EXTERNAL.identification.");
899 return *field_transfer__syntax
;
902 ASN_NULL
& EXTERNAL_identification::fixed()
904 if (union_selection
!= ALT_fixed
) {
906 field_fixed
= new ASN_NULL
;
907 union_selection
= ALT_fixed
;
912 const ASN_NULL
& EXTERNAL_identification::fixed() const
914 if (union_selection
!= ALT_fixed
) TTCN_error("Using non-selected field fixed in a value of union type EXTERNAL.identification.");
918 boolean
EXTERNAL_identification::ischosen(union_selection_type checked_selection
) const
920 if (checked_selection
== UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type EXTERNAL.identification.");
921 if (union_selection
== UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an unbound value of union type EXTERNAL.identification.");
922 return union_selection
== checked_selection
;
925 boolean
EXTERNAL_identification::is_value() const
927 switch (union_selection
) {
929 return field_syntaxes
->is_value();
931 return field_syntax
->is_value();
932 case ALT_presentation__context__id
:
933 return field_presentation__context__id
->is_value();
934 case ALT_context__negotiation
:
935 return field_context__negotiation
->is_value();
936 case ALT_transfer__syntax
:
937 return field_transfer__syntax
->is_value();
939 return field_fixed
->is_value();
945 void EXTERNAL_identification::log() const
947 switch (union_selection
) {
949 TTCN_Logger::log_event_str("{ syntaxes := ");
950 field_syntaxes
->log();
951 TTCN_Logger::log_event_str(" }");
954 TTCN_Logger::log_event_str("{ syntax := ");
956 TTCN_Logger::log_event_str(" }");
958 case ALT_presentation__context__id
:
959 TTCN_Logger::log_event_str("{ presentation_context_id := ");
960 field_presentation__context__id
->log();
961 TTCN_Logger::log_event_str(" }");
963 case ALT_context__negotiation
:
964 TTCN_Logger::log_event_str("{ context_negotiation := ");
965 field_context__negotiation
->log();
966 TTCN_Logger::log_event_str(" }");
968 case ALT_transfer__syntax
:
969 TTCN_Logger::log_event_str("{ transfer_syntax := ");
970 field_transfer__syntax
->log();
971 TTCN_Logger::log_event_str(" }");
974 TTCN_Logger::log_event_str("{ fixed := ");
976 TTCN_Logger::log_event_str(" }");
979 TTCN_Logger::log_event_str("<unbound>");
984 void EXTERNAL_identification::set_param(Module_Param
& param
) {
985 param
.basic_check(Module_Param::BC_VALUE
, "union value");
986 if (param
.get_type()==Module_Param::MP_Value_List
&& param
.get_size()==0) return;
987 if (param
.get_type()!=Module_Param::MP_Assignment_List
) {
988 param
.error("union value with field name was expected");
990 Module_Param
* mp_last
= param
.get_elem(param
.get_size()-1);
991 if (!strcmp(mp_last
->get_id()->get_name(), "syntaxes")) {
992 syntaxes().set_param(*mp_last
);
995 if (!strcmp(mp_last
->get_id()->get_name(), "syntax")) {
996 syntax().set_param(*mp_last
);
999 if (!strcmp(mp_last
->get_id()->get_name(), "presentation_context_id")) {
1000 presentation__context__id().set_param(*mp_last
);
1003 if (!strcmp(mp_last
->get_id()->get_name(), "context_negotiation")) {
1004 context__negotiation().set_param(*mp_last
);
1007 if (!strcmp(mp_last
->get_id()->get_name(), "transfer_syntax")) {
1008 transfer__syntax().set_param(*mp_last
);
1011 if (!strcmp(mp_last
->get_id()->get_name(), "fixed")) {
1012 fixed().set_param(*mp_last
);
1015 mp_last
->error("Field %s does not exist in type EXTERNAL.identification.", mp_last
->get_id()->get_name());
1018 void EXTERNAL_identification_template::set_param(Module_Param
& param
)
1020 param
.basic_check(Module_Param::BC_TEMPLATE
, "union template");
1021 switch (param
.get_type()) {
1022 case Module_Param::MP_Omit
:
1025 case Module_Param::MP_Any
:
1028 case Module_Param::MP_AnyOrNone
:
1029 *this = ANY_OR_OMIT
;
1031 case Module_Param::MP_List_Template
:
1032 case Module_Param::MP_ComplementList_Template
:
1033 set_type(param
.get_type()==Module_Param::MP_List_Template
? VALUE_LIST
: COMPLEMENTED_LIST
, param
.get_size());
1034 for (size_t p_i
=0; p_i
<param
.get_size(); p_i
++) {
1035 list_item(p_i
).set_param(*param
.get_elem(p_i
));
1038 case Module_Param::MP_Value_List
:
1039 if (param
.get_size()==0) break;
1040 param
.type_error("union template", "EXTERNAL.identification");
1042 case Module_Param::MP_Assignment_List
: {
1043 Module_Param
* mp_last
= param
.get_elem(param
.get_size()-1);
1044 if (!strcmp(mp_last
->get_id()->get_name(), "syntaxes")) {
1045 syntaxes().set_param(*mp_last
);
1048 if (!strcmp(mp_last
->get_id()->get_name(), "syntax")) {
1049 syntax().set_param(*mp_last
);
1052 if (!strcmp(mp_last
->get_id()->get_name(), "presentation_context_id")) {
1053 presentation__context__id().set_param(*mp_last
);
1056 if (!strcmp(mp_last
->get_id()->get_name(), "context_negotiation")) {
1057 context__negotiation().set_param(*mp_last
);
1060 if (!strcmp(mp_last
->get_id()->get_name(), "transfer_syntax")) {
1061 transfer__syntax().set_param(*mp_last
);
1064 if (!strcmp(mp_last
->get_id()->get_name(), "fixed")) {
1065 fixed().set_param(*mp_last
);
1068 mp_last
->error("Field %s does not exist in type EXTERNAL.identification.", mp_last
->get_id()->get_name());
1071 param
.type_error("union template", "EXTERNAL.identification");
1073 is_ifpresent
= param
.get_ifpresent();
1076 void EXTERNAL_identification::encode_text(Text_Buf
& text_buf
) const
1078 text_buf
.push_int(union_selection
);
1079 switch (union_selection
) {
1081 field_syntaxes
->encode_text(text_buf
);
1084 field_syntax
->encode_text(text_buf
);
1086 case ALT_presentation__context__id
:
1087 field_presentation__context__id
->encode_text(text_buf
);
1089 case ALT_context__negotiation
:
1090 field_context__negotiation
->encode_text(text_buf
);
1092 case ALT_transfer__syntax
:
1093 field_transfer__syntax
->encode_text(text_buf
);
1096 field_fixed
->encode_text(text_buf
);
1099 TTCN_error("Text encoder: Encoding an unbound value of union type EXTERNAL.identification.");
1103 void EXTERNAL_identification::decode_text(Text_Buf
& text_buf
)
1105 switch ((union_selection_type
)text_buf
.pull_int().get_val()) {
1107 syntaxes().decode_text(text_buf
);
1110 syntax().decode_text(text_buf
);
1112 case ALT_presentation__context__id
:
1113 presentation__context__id().decode_text(text_buf
);
1115 case ALT_context__negotiation
:
1116 context__negotiation().decode_text(text_buf
);
1118 case ALT_transfer__syntax
:
1119 transfer__syntax().decode_text(text_buf
);
1122 fixed().decode_text(text_buf
);
1125 TTCN_error("Text decoder: Unrecognized union selector was received for type EXTERNAL.identification.");
1130 void EXTERNAL_identification_template::clean_up()
1132 switch (template_selection
) {
1133 case SPECIFIC_VALUE
:
1134 switch (single_value
.union_selection
) {
1135 case EXTERNAL_identification::ALT_syntaxes
:
1136 delete single_value
.field_syntaxes
;
1138 case EXTERNAL_identification::ALT_syntax
:
1139 delete single_value
.field_syntax
;
1141 case EXTERNAL_identification::ALT_presentation__context__id
:
1142 delete single_value
.field_presentation__context__id
;
1144 case EXTERNAL_identification::ALT_context__negotiation
:
1145 delete single_value
.field_context__negotiation
;
1147 case EXTERNAL_identification::ALT_transfer__syntax
:
1148 delete single_value
.field_transfer__syntax
;
1150 case EXTERNAL_identification::ALT_fixed
:
1151 delete single_value
.field_fixed
;
1158 case COMPLEMENTED_LIST
:
1159 delete [] value_list
.list_value
;
1164 template_selection
= UNINITIALIZED_TEMPLATE
;
1167 void EXTERNAL_identification_template::copy_value(const EXTERNAL_identification
& other_value
)
1169 single_value
.union_selection
= other_value
.get_selection();
1170 switch (single_value
.union_selection
) {
1171 case EXTERNAL_identification::ALT_syntaxes
:
1172 single_value
.field_syntaxes
= new EXTERNAL_identification_syntaxes_template(other_value
.syntaxes());
1174 case EXTERNAL_identification::ALT_syntax
:
1175 single_value
.field_syntax
= new OBJID_template(other_value
.syntax());
1177 case EXTERNAL_identification::ALT_presentation__context__id
:
1178 single_value
.field_presentation__context__id
= new INTEGER_template(other_value
.presentation__context__id());
1180 case EXTERNAL_identification::ALT_context__negotiation
:
1181 single_value
.field_context__negotiation
= new EXTERNAL_identification_context__negotiation_template(other_value
.context__negotiation());
1183 case EXTERNAL_identification::ALT_transfer__syntax
:
1184 single_value
.field_transfer__syntax
= new OBJID_template(other_value
.transfer__syntax());
1186 case EXTERNAL_identification::ALT_fixed
:
1187 single_value
.field_fixed
= new ASN_NULL_template(other_value
.fixed());
1190 TTCN_error("Initializing a template with an unbound value of type EXTERNAL.identification.");
1192 set_selection(SPECIFIC_VALUE
);
1195 void EXTERNAL_identification_template::copy_template(const EXTERNAL_identification_template
& other_value
)
1197 switch (other_value
.template_selection
) {
1198 case SPECIFIC_VALUE
:
1199 single_value
.union_selection
= other_value
.single_value
.union_selection
;
1200 switch (single_value
.union_selection
) {
1201 case EXTERNAL_identification::ALT_syntaxes
:
1202 single_value
.field_syntaxes
= new EXTERNAL_identification_syntaxes_template(*other_value
.single_value
.field_syntaxes
);
1204 case EXTERNAL_identification::ALT_syntax
:
1205 single_value
.field_syntax
= new OBJID_template(*other_value
.single_value
.field_syntax
);
1207 case EXTERNAL_identification::ALT_presentation__context__id
:
1208 single_value
.field_presentation__context__id
= new INTEGER_template(*other_value
.single_value
.field_presentation__context__id
);
1210 case EXTERNAL_identification::ALT_context__negotiation
:
1211 single_value
.field_context__negotiation
= new EXTERNAL_identification_context__negotiation_template(*other_value
.single_value
.field_context__negotiation
);
1213 case EXTERNAL_identification::ALT_transfer__syntax
:
1214 single_value
.field_transfer__syntax
= new OBJID_template(*other_value
.single_value
.field_transfer__syntax
);
1216 case EXTERNAL_identification::ALT_fixed
:
1217 single_value
.field_fixed
= new ASN_NULL_template(*other_value
.single_value
.field_fixed
);
1220 TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type EXTERNAL.identification.");
1228 case COMPLEMENTED_LIST
:
1229 value_list
.n_values
= other_value
.value_list
.n_values
;
1230 value_list
.list_value
= new EXTERNAL_identification_template
[value_list
.n_values
];
1231 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1232 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
1235 TTCN_error("Copying an uninitialized template of union type EXTERNAL.identification.");
1237 set_selection(other_value
);
1240 EXTERNAL_identification_template::EXTERNAL_identification_template()
1244 EXTERNAL_identification_template::EXTERNAL_identification_template(template_sel other_value
)
1245 : Base_Template(other_value
)
1247 check_single_selection(other_value
);
1250 EXTERNAL_identification_template::EXTERNAL_identification_template(const EXTERNAL_identification
& other_value
)
1252 copy_value(other_value
);
1255 EXTERNAL_identification_template::EXTERNAL_identification_template(const OPTIONAL
<EXTERNAL_identification
>& other_value
)
1257 switch (other_value
.get_selection()) {
1258 case OPTIONAL_PRESENT
:
1259 copy_value((const EXTERNAL_identification
&)other_value
);
1262 set_selection(OMIT_VALUE
);
1265 TTCN_error("Creating a template of union type EXTERNAL.identification from an unbound optional field.");
1269 EXTERNAL_identification_template::EXTERNAL_identification_template(const EXTERNAL_identification_template
& other_value
)
1272 copy_template(other_value
);
1275 EXTERNAL_identification_template::~EXTERNAL_identification_template()
1280 EXTERNAL_identification_template
& EXTERNAL_identification_template::operator=(template_sel other_value
)
1282 check_single_selection(other_value
);
1284 set_selection(other_value
);
1288 EXTERNAL_identification_template
& EXTERNAL_identification_template::operator=(const EXTERNAL_identification
& other_value
)
1291 copy_value(other_value
);
1295 EXTERNAL_identification_template
& EXTERNAL_identification_template::operator=(const OPTIONAL
<EXTERNAL_identification
>& other_value
)
1298 switch (other_value
.get_selection()) {
1299 case OPTIONAL_PRESENT
:
1300 copy_value((const EXTERNAL_identification
&)other_value
);
1303 set_selection(OMIT_VALUE
);
1306 TTCN_error("Assignment of an unbound optional field to a template of union type EXTERNAL.identification.");
1311 EXTERNAL_identification_template
& EXTERNAL_identification_template::operator=(const EXTERNAL_identification_template
& other_value
)
1313 if (&other_value
!= this) {
1315 copy_template(other_value
);
1320 boolean
EXTERNAL_identification_template::match(const EXTERNAL_identification
& other_value
) const
1322 switch (template_selection
) {
1328 case SPECIFIC_VALUE
:
1330 EXTERNAL_identification::union_selection_type value_selection
= other_value
.get_selection();
1331 if (value_selection
== EXTERNAL_identification::UNBOUND_VALUE
) return FALSE
;
1332 if (value_selection
!= single_value
.union_selection
) return FALSE
;
1333 switch (value_selection
) {
1334 case EXTERNAL_identification::ALT_syntaxes
:
1335 return single_value
.field_syntaxes
->match(other_value
.syntaxes());
1336 case EXTERNAL_identification::ALT_syntax
:
1337 return single_value
.field_syntax
->match(other_value
.syntax());
1338 case EXTERNAL_identification::ALT_presentation__context__id
:
1339 return single_value
.field_presentation__context__id
->match(other_value
.presentation__context__id());
1340 case EXTERNAL_identification::ALT_context__negotiation
:
1341 return single_value
.field_context__negotiation
->match(other_value
.context__negotiation());
1342 case EXTERNAL_identification::ALT_transfer__syntax
:
1343 return single_value
.field_transfer__syntax
->match(other_value
.transfer__syntax());
1344 case EXTERNAL_identification::ALT_fixed
:
1345 return single_value
.field_fixed
->match(other_value
.fixed());
1347 TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type EXTERNAL.identification.");
1350 break; // should never get here
1352 case COMPLEMENTED_LIST
:
1353 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1354 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
1355 return template_selection
== COMPLEMENTED_LIST
;
1357 TTCN_error ("Matching an uninitialized template of union type EXTERNAL.identification.");
1362 EXTERNAL_identification
EXTERNAL_identification_template::valueof() const
1364 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
1365 TTCN_error("Performing valueof or send operation on a non-specific template of union type EXTERNAL.identification.");
1366 EXTERNAL_identification ret_val
;
1367 switch (single_value
.union_selection
) {
1368 case EXTERNAL_identification::ALT_syntaxes
:
1369 ret_val
.syntaxes() = single_value
.field_syntaxes
->valueof();
1371 case EXTERNAL_identification::ALT_syntax
:
1372 ret_val
.syntax() = single_value
.field_syntax
->valueof();
1374 case EXTERNAL_identification::ALT_presentation__context__id
:
1375 ret_val
.presentation__context__id() = single_value
.field_presentation__context__id
->valueof();
1377 case EXTERNAL_identification::ALT_context__negotiation
:
1378 ret_val
.context__negotiation() = single_value
.field_context__negotiation
->valueof();
1380 case EXTERNAL_identification::ALT_transfer__syntax
:
1381 ret_val
.transfer__syntax() = single_value
.field_transfer__syntax
->valueof();
1383 case EXTERNAL_identification::ALT_fixed
:
1384 ret_val
.fixed() = single_value
.field_fixed
->valueof();
1387 TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type EXTERNAL.identification.");
1392 EXTERNAL_identification_template
& EXTERNAL_identification_template::list_item(unsigned int list_index
) const
1394 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
) TTCN_error("Internal error: Accessing a list element of a non-list template of union type EXTERNAL.identification.");
1395 if (list_index
>= value_list
.n_values
) TTCN_error("Internal error: Index overflow in a value list template of union type EXTERNAL.identification.");
1396 return value_list
.list_value
[list_index
];
1398 void EXTERNAL_identification_template::set_type(template_sel template_type
, unsigned int list_length
)
1400 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
) TTCN_error ("Internal error: Setting an invalid list for a template of union type EXTERNAL.identification.");
1402 set_selection(template_type
);
1403 value_list
.n_values
= list_length
;
1404 value_list
.list_value
= new EXTERNAL_identification_template
[list_length
];
1407 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_template::syntaxes()
1409 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_syntaxes
) {
1410 template_sel old_selection
= template_selection
;
1412 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_syntaxes
= new EXTERNAL_identification_syntaxes_template(ANY_VALUE
);
1413 else single_value
.field_syntaxes
= new EXTERNAL_identification_syntaxes_template
;
1414 single_value
.union_selection
= EXTERNAL_identification::ALT_syntaxes
;
1415 set_selection(SPECIFIC_VALUE
);
1417 return *single_value
.field_syntaxes
;
1420 const EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_template::syntaxes() const
1422 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field syntaxes in a non-specific template of union type EXTERNAL.identification.");
1423 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_syntaxes
) TTCN_error("Accessing non-selected field syntaxes in a template of union type EXTERNAL.identification.");
1424 return *single_value
.field_syntaxes
;
1427 OBJID_template
& EXTERNAL_identification_template::syntax()
1429 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_syntax
) {
1430 template_sel old_selection
= template_selection
;
1432 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_syntax
= new OBJID_template(ANY_VALUE
);
1433 else single_value
.field_syntax
= new OBJID_template
;
1434 single_value
.union_selection
= EXTERNAL_identification::ALT_syntax
;
1435 set_selection(SPECIFIC_VALUE
);
1437 return *single_value
.field_syntax
;
1440 const OBJID_template
& EXTERNAL_identification_template::syntax() const
1442 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field syntax in a non-specific template of union type EXTERNAL.identification.");
1443 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_syntax
) TTCN_error("Accessing non-selected field syntax in a template of union type EXTERNAL.identification.");
1444 return *single_value
.field_syntax
;
1447 INTEGER_template
& EXTERNAL_identification_template::presentation__context__id()
1449 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_presentation__context__id
) {
1450 template_sel old_selection
= template_selection
;
1452 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_presentation__context__id
= new INTEGER_template(ANY_VALUE
);
1453 else single_value
.field_presentation__context__id
= new INTEGER_template
;
1454 single_value
.union_selection
= EXTERNAL_identification::ALT_presentation__context__id
;
1455 set_selection(SPECIFIC_VALUE
);
1457 return *single_value
.field_presentation__context__id
;
1460 const INTEGER_template
& EXTERNAL_identification_template::presentation__context__id() const
1462 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field presentation_context_id in a non-specific template of union type EXTERNAL.identification.");
1463 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_presentation__context__id
) TTCN_error("Accessing non-selected field presentation_context_id in a template of union type EXTERNAL.identification.");
1464 return *single_value
.field_presentation__context__id
;
1467 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_template::context__negotiation()
1469 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_context__negotiation
) {
1470 template_sel old_selection
= template_selection
;
1472 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_context__negotiation
= new EXTERNAL_identification_context__negotiation_template(ANY_VALUE
);
1473 else single_value
.field_context__negotiation
= new EXTERNAL_identification_context__negotiation_template
;
1474 single_value
.union_selection
= EXTERNAL_identification::ALT_context__negotiation
;
1475 set_selection(SPECIFIC_VALUE
);
1477 return *single_value
.field_context__negotiation
;
1480 const EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_template::context__negotiation() const
1482 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field context_negotiation in a non-specific template of union type EXTERNAL.identification.");
1483 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_context__negotiation
) TTCN_error("Accessing non-selected field context_negotiation in a template of union type EXTERNAL.identification.");
1484 return *single_value
.field_context__negotiation
;
1487 OBJID_template
& EXTERNAL_identification_template::transfer__syntax()
1489 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_transfer__syntax
) {
1490 template_sel old_selection
= template_selection
;
1492 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_transfer__syntax
= new OBJID_template(ANY_VALUE
);
1493 else single_value
.field_transfer__syntax
= new OBJID_template
;
1494 single_value
.union_selection
= EXTERNAL_identification::ALT_transfer__syntax
;
1495 set_selection(SPECIFIC_VALUE
);
1497 return *single_value
.field_transfer__syntax
;
1500 const OBJID_template
& EXTERNAL_identification_template::transfer__syntax() const
1502 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field transfer_syntax in a non-specific template of union type EXTERNAL.identification.");
1503 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_transfer__syntax
) TTCN_error("Accessing non-selected field transfer_syntax in a template of union type EXTERNAL.identification.");
1504 return *single_value
.field_transfer__syntax
;
1507 ASN_NULL_template
& EXTERNAL_identification_template::fixed()
1509 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EXTERNAL_identification::ALT_fixed
) {
1510 template_sel old_selection
= template_selection
;
1512 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_fixed
= new ASN_NULL_template(ANY_VALUE
);
1513 else single_value
.field_fixed
= new ASN_NULL_template
;
1514 single_value
.union_selection
= EXTERNAL_identification::ALT_fixed
;
1515 set_selection(SPECIFIC_VALUE
);
1517 return *single_value
.field_fixed
;
1520 const ASN_NULL_template
& EXTERNAL_identification_template::fixed() const
1522 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field fixed in a non-specific template of union type EXTERNAL.identification.");
1523 if (single_value
.union_selection
!= EXTERNAL_identification::ALT_fixed
) TTCN_error("Accessing non-selected field fixed in a template of union type EXTERNAL.identification.");
1524 return *single_value
.field_fixed
;
1527 boolean
EXTERNAL_identification_template::ischosen(EXTERNAL_identification::union_selection_type checked_selection
) const
1529 if (checked_selection
== EXTERNAL_identification::UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type EXTERNAL.identification.");
1530 switch (template_selection
) {
1531 case SPECIFIC_VALUE
:
1532 if (single_value
.union_selection
== EXTERNAL_identification::UNBOUND_VALUE
) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type EXTERNAL.identification.");
1533 return single_value
.union_selection
== checked_selection
;
1536 if (value_list
.n_values
< 1)
1537 TTCN_error("Internal error: Performing ischosen() operation on a template of union type EXTERNAL.identification containing an empty list.");
1538 boolean ret_val
= value_list
.list_value
[0].ischosen(checked_selection
);
1539 boolean all_same
= TRUE
;
1540 for (unsigned int list_count
= 1; list_count
< value_list
.n_values
; list_count
++) {
1541 if (value_list
.list_value
[list_count
].ischosen(checked_selection
) != ret_val
) {
1546 if (all_same
) return ret_val
;
1548 // FIXME really no break?
1552 case COMPLEMENTED_LIST
:
1553 TTCN_error("Performing ischosen() operation on a template of union type EXTERNAL.identification, which does not determine unambiguously the chosen field of the matching values.");
1555 TTCN_error("Performing ischosen() operation on an uninitialized template of union type EXTERNAL.identification");
1560 void EXTERNAL_identification_template::log() const
1562 switch (template_selection
) {
1563 case SPECIFIC_VALUE
:
1564 switch (single_value
.union_selection
) {
1565 case EXTERNAL_identification::ALT_syntaxes
:
1566 TTCN_Logger::log_event_str("{ syntaxes := ");
1567 single_value
.field_syntaxes
->log();
1568 TTCN_Logger::log_event_str(" }");
1570 case EXTERNAL_identification::ALT_syntax
:
1571 TTCN_Logger::log_event_str("{ syntax := ");
1572 single_value
.field_syntax
->log();
1573 TTCN_Logger::log_event_str(" }");
1575 case EXTERNAL_identification::ALT_presentation__context__id
:
1576 TTCN_Logger::log_event_str("{ presentation_context_id := ");
1577 single_value
.field_presentation__context__id
->log();
1578 TTCN_Logger::log_event_str(" }");
1580 case EXTERNAL_identification::ALT_context__negotiation
:
1581 TTCN_Logger::log_event_str("{ context_negotiation := ");
1582 single_value
.field_context__negotiation
->log();
1583 TTCN_Logger::log_event_str(" }");
1585 case EXTERNAL_identification::ALT_transfer__syntax
:
1586 TTCN_Logger::log_event_str("{ transfer_syntax := ");
1587 single_value
.field_transfer__syntax
->log();
1588 TTCN_Logger::log_event_str(" }");
1590 case EXTERNAL_identification::ALT_fixed
:
1591 TTCN_Logger::log_event_str("{ fixed := ");
1592 single_value
.field_fixed
->log();
1593 TTCN_Logger::log_event_str(" }");
1596 TTCN_Logger::log_event_str("<invalid selector>");
1600 case COMPLEMENTED_LIST
:
1601 TTCN_Logger::log_event_str("complement ");
1604 TTCN_Logger::log_char('(');
1605 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
1606 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
1607 value_list
.list_value
[list_count
].log();
1609 TTCN_Logger::log_char(')');
1618 void EXTERNAL_identification_template::log_match(const EXTERNAL_identification
& match_value
) const
1620 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1621 if(match(match_value
)){
1622 TTCN_Logger::print_logmatch_buffer();
1623 TTCN_Logger::log_event_str(" matched ");
1627 if (template_selection
== SPECIFIC_VALUE
&& single_value
.union_selection
== match_value
.get_selection()) {
1628 switch (single_value
.union_selection
) {
1629 case EXTERNAL_identification::ALT_syntaxes
:
1630 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1631 TTCN_Logger::log_logmatch_info(".syntaxes");
1632 single_value
.field_syntaxes
->log_match(match_value
.syntaxes());
1634 TTCN_Logger::log_event_str("{ syntaxes := ");
1635 single_value
.field_syntaxes
->log_match(match_value
.syntaxes());
1636 TTCN_Logger::log_event_str(" }");
1639 case EXTERNAL_identification::ALT_syntax
:
1640 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1641 TTCN_Logger::log_logmatch_info(".syntax");
1642 single_value
.field_syntax
->log_match(match_value
.syntax());
1644 TTCN_Logger::log_event_str("{ syntax := ");
1645 single_value
.field_syntax
->log_match(match_value
.syntax());
1646 TTCN_Logger::log_event_str(" }");
1649 case EXTERNAL_identification::ALT_presentation__context__id
:
1650 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1651 TTCN_Logger::log_logmatch_info(".presentation_context_id");
1652 single_value
.field_presentation__context__id
->log_match(match_value
.presentation__context__id());
1654 TTCN_Logger::log_event_str("{ presentation_context_id := ");
1655 single_value
.field_presentation__context__id
->log_match(match_value
.presentation__context__id());
1656 TTCN_Logger::log_event_str(" }");
1659 case EXTERNAL_identification::ALT_context__negotiation
:
1660 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1661 TTCN_Logger::log_logmatch_info(".context_negotiation");
1662 single_value
.field_context__negotiation
->log_match(match_value
.context__negotiation());
1664 TTCN_Logger::log_event_str("{ context_negotiation := ");
1665 single_value
.field_context__negotiation
->log_match(match_value
.context__negotiation());
1666 TTCN_Logger::log_event_str(" }");
1669 case EXTERNAL_identification::ALT_transfer__syntax
:
1670 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1671 TTCN_Logger::log_logmatch_info(".transfer_syntax");
1672 single_value
.field_transfer__syntax
->log_match(match_value
.transfer__syntax());
1674 TTCN_Logger::log_event_str("{ transfer_syntax := ");
1675 single_value
.field_transfer__syntax
->log_match(match_value
.transfer__syntax());
1676 TTCN_Logger::log_event_str(" }");
1679 case EXTERNAL_identification::ALT_fixed
:
1680 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1681 TTCN_Logger::log_logmatch_info(".fixed");
1682 single_value
.field_fixed
->log_match(match_value
.fixed());
1684 TTCN_Logger::log_event_str("{ fixed := ");
1685 single_value
.field_fixed
->log_match(match_value
.fixed());
1686 TTCN_Logger::log_event_str(" }");
1690 TTCN_Logger::print_logmatch_buffer();
1691 TTCN_Logger::log_event_str("<invalid selector>");
1695 TTCN_Logger::print_logmatch_buffer();
1697 TTCN_Logger::log_event_str(" with ");
1699 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
1700 else TTCN_Logger::log_event_str(" unmatched");
1704 void EXTERNAL_identification_template::encode_text(Text_Buf
& text_buf
) const
1706 encode_text_base(text_buf
);
1707 switch (template_selection
) {
1708 case SPECIFIC_VALUE
:
1709 text_buf
.push_int(single_value
.union_selection
);
1710 switch (single_value
.union_selection
) {
1711 case EXTERNAL_identification::ALT_syntaxes
:
1712 single_value
.field_syntaxes
->encode_text(text_buf
);
1714 case EXTERNAL_identification::ALT_syntax
:
1715 single_value
.field_syntax
->encode_text(text_buf
);
1717 case EXTERNAL_identification::ALT_presentation__context__id
:
1718 single_value
.field_presentation__context__id
->encode_text(text_buf
);
1720 case EXTERNAL_identification::ALT_context__negotiation
:
1721 single_value
.field_context__negotiation
->encode_text(text_buf
);
1723 case EXTERNAL_identification::ALT_transfer__syntax
:
1724 single_value
.field_transfer__syntax
->encode_text(text_buf
);
1726 case EXTERNAL_identification::ALT_fixed
:
1727 single_value
.field_fixed
->encode_text(text_buf
);
1730 TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type EXTERNAL.identification.");
1738 case COMPLEMENTED_LIST
:
1739 text_buf
.push_int(value_list
.n_values
);
1740 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1741 value_list
.list_value
[list_count
].encode_text(text_buf
);
1744 TTCN_error("Text encoder: Encoding an uninitialized template of type EXTERNAL.identification.");
1748 void EXTERNAL_identification_template::decode_text(Text_Buf
& text_buf
)
1751 decode_text_base(text_buf
);
1752 switch (template_selection
) {
1753 case SPECIFIC_VALUE
:
1755 single_value
.union_selection
= EXTERNAL_identification::UNBOUND_VALUE
;
1756 EXTERNAL_identification::union_selection_type new_selection
= (EXTERNAL_identification::union_selection_type
)text_buf
.pull_int().get_val();
1757 switch (new_selection
) {
1758 case EXTERNAL_identification::ALT_syntaxes
:
1759 single_value
.field_syntaxes
= new EXTERNAL_identification_syntaxes_template
;
1760 single_value
.field_syntaxes
->decode_text(text_buf
);
1762 case EXTERNAL_identification::ALT_syntax
:
1763 single_value
.field_syntax
= new OBJID_template
;
1764 single_value
.field_syntax
->decode_text(text_buf
);
1766 case EXTERNAL_identification::ALT_presentation__context__id
:
1767 single_value
.field_presentation__context__id
= new INTEGER_template
;
1768 single_value
.field_presentation__context__id
->decode_text(text_buf
);
1770 case EXTERNAL_identification::ALT_context__negotiation
:
1771 single_value
.field_context__negotiation
= new EXTERNAL_identification_context__negotiation_template
;
1772 single_value
.field_context__negotiation
->decode_text(text_buf
);
1774 case EXTERNAL_identification::ALT_transfer__syntax
:
1775 single_value
.field_transfer__syntax
= new OBJID_template
;
1776 single_value
.field_transfer__syntax
->decode_text(text_buf
);
1778 case EXTERNAL_identification::ALT_fixed
:
1779 single_value
.field_fixed
= new ASN_NULL_template
;
1780 single_value
.field_fixed
->decode_text(text_buf
);
1783 TTCN_error("Text decoder: Unrecognized union selector was received for a template of type EXTERNAL.identification.");
1785 single_value
.union_selection
= new_selection
;
1793 case COMPLEMENTED_LIST
:
1794 value_list
.n_values
= text_buf
.pull_int().get_val();
1795 value_list
.list_value
= new EXTERNAL_identification_template
[value_list
.n_values
];
1796 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1797 value_list
.list_value
[list_count
].decode_text(text_buf
);
1800 TTCN_error("Text decoder: Unrecognized selector was received in a template of type EXTERNAL.identification.");
1804 boolean
EXTERNAL_identification_template::is_present() const
1806 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
1807 return !match_omit();
1810 boolean
EXTERNAL_identification_template::match_omit() const
1812 if (is_ifpresent
) return TRUE
;
1813 switch (template_selection
) {
1818 case COMPLEMENTED_LIST
:
1819 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
1820 if (value_list
.list_value
[i
].match_omit())
1821 return template_selection
==VALUE_LIST
;
1822 return template_selection
==COMPLEMENTED_LIST
;
1829 #ifndef TITAN_RUNTIME_2
1830 void EXTERNAL_identification_template::check_restriction(template_res t_res
, const char* t_name
) const
1832 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
1833 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
1835 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
1838 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
1839 template_selection
==SPECIFIC_VALUE
)) return;
1842 if (!match_omit()) return;
1847 TTCN_error("Restriction `%s' on template of type %s violated.",
1848 get_res_name(t_res
), t_name
? t_name
: "EXTERNAL.identification");
1852 EXTERNAL_identification_syntaxes::EXTERNAL_identification_syntaxes()
1856 EXTERNAL_identification_syntaxes::EXTERNAL_identification_syntaxes(const OBJID
& par_abstract
,
1857 const OBJID
& par_transfer
)
1858 : field_abstract(par_abstract
),
1859 field_transfer(par_transfer
)
1863 boolean
EXTERNAL_identification_syntaxes::operator==(const EXTERNAL_identification_syntaxes
& other_value
) const
1865 return field_abstract
==other_value
.field_abstract
1866 && field_transfer
==other_value
.field_transfer
;
1869 int EXTERNAL_identification_syntaxes::size_of() const
1875 void EXTERNAL_identification_syntaxes::log() const
1877 TTCN_Logger::log_event_str("{ abstract := ");
1878 field_abstract
.log();
1879 TTCN_Logger::log_event_str(", transfer := ");
1880 field_transfer
.log();
1881 TTCN_Logger::log_event_str(" }");
1884 boolean
EXTERNAL_identification_syntaxes::is_bound() const
1886 if(field_abstract
.is_bound()) return TRUE
;
1887 if(field_transfer
.is_bound()) return TRUE
;
1891 boolean
EXTERNAL_identification_syntaxes::is_value() const
1893 if(!field_abstract
.is_value()) return FALSE
;
1894 if(!field_transfer
.is_value()) return FALSE
;
1898 void EXTERNAL_identification_syntaxes::clean_up()
1900 field_abstract
.clean_up();
1901 field_transfer
.clean_up();
1904 void EXTERNAL_identification_syntaxes::set_param(Module_Param
& param
)
1906 param
.basic_check(Module_Param::BC_VALUE
, "record value");
1907 switch (param
.get_type()) {
1908 case Module_Param::MP_Value_List
:
1909 if (param
.get_size()==0) return;
1910 if (2!=param
.get_size()) {
1911 param
.error("record value of type EXTERNAL.identification.syntaxes has 2 fields but list value has %d fields", (int)param
.get_size());
1913 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) abstract().set_param(*param
.get_elem(0));
1914 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer().set_param(*param
.get_elem(1));
1916 case Module_Param::MP_Assignment_List
: {
1917 Vector
<bool> value_used(param
.get_size());
1918 value_used
.resize(param
.get_size(), false);
1919 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
1920 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
1921 if (!strcmp(curr_param
->get_id()->get_name(), "abstract")) {
1922 abstract().set_param(*curr_param
);
1923 value_used
[val_idx
]=true;
1926 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
1927 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
1928 if (!strcmp(curr_param
->get_id()->get_name(), "transfer")) {
1929 transfer().set_param(*curr_param
);
1930 value_used
[val_idx
]=true;
1933 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
1934 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL.identification.syntaxes: %s", param
.get_elem(val_idx
)->get_id()->get_name());
1939 param
.type_error("record value", "EXTERNAL.identification.syntaxes");
1943 void EXTERNAL_identification_syntaxes_template::set_param(Module_Param
& param
)
1945 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
1946 switch (param
.get_type()) {
1947 case Module_Param::MP_Omit
:
1950 case Module_Param::MP_Any
:
1953 case Module_Param::MP_AnyOrNone
:
1954 *this = ANY_OR_OMIT
;
1956 case Module_Param::MP_List_Template
:
1957 case Module_Param::MP_ComplementList_Template
:
1958 set_type(param
.get_type()==Module_Param::MP_List_Template
? VALUE_LIST
: COMPLEMENTED_LIST
, param
.get_size());
1959 for (size_t p_i
=0; p_i
<param
.get_size(); p_i
++) {
1960 list_item(p_i
).set_param(*param
.get_elem(p_i
));
1963 case Module_Param::MP_Value_List
:
1964 if (param
.get_size()==0) break;
1965 if (2!=param
.get_size()) {
1966 param
.error("record template of type EXTERNAL.identification.syntaxes has 2 fields but list value has %d fields", (int)param
.get_size());
1968 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) abstract().set_param(*param
.get_elem(0));
1969 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer().set_param(*param
.get_elem(1));
1971 case Module_Param::MP_Assignment_List
: {
1972 Vector
<bool> value_used(param
.get_size());
1973 value_used
.resize(param
.get_size(), false);
1974 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
1975 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
1976 if (!strcmp(curr_param
->get_id()->get_name(), "abstract")) {
1977 abstract().set_param(*curr_param
);
1978 value_used
[val_idx
]=true;
1981 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
1982 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
1983 if (!strcmp(curr_param
->get_id()->get_name(), "transfer")) {
1984 transfer().set_param(*curr_param
);
1985 value_used
[val_idx
]=true;
1988 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
1989 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL.identification.syntaxes: %s", param
.get_elem(val_idx
)->get_id()->get_name());
1994 param
.type_error("record template", "EXTERNAL.identification.syntaxes");
1996 is_ifpresent
= param
.get_ifpresent();
1999 void EXTERNAL_identification_syntaxes::encode_text(Text_Buf
& text_buf
) const
2001 field_abstract
.encode_text(text_buf
);
2002 field_transfer
.encode_text(text_buf
);
2005 void EXTERNAL_identification_syntaxes::decode_text(Text_Buf
& text_buf
)
2007 field_abstract
.decode_text(text_buf
);
2008 field_transfer
.decode_text(text_buf
);
2011 struct EXTERNAL_identification_syntaxes_template::single_value_struct
{
2012 OBJID_template field_abstract
;
2013 OBJID_template field_transfer
;
2016 void EXTERNAL_identification_syntaxes_template::clean_up()
2018 switch (template_selection
) {
2019 case SPECIFIC_VALUE
:
2020 delete single_value
;
2023 case COMPLEMENTED_LIST
:
2024 delete [] value_list
.list_value
;
2029 template_selection
= UNINITIALIZED_TEMPLATE
;
2032 void EXTERNAL_identification_syntaxes_template::set_specific()
2034 if (template_selection
!= SPECIFIC_VALUE
) {
2035 template_sel old_selection
= template_selection
;
2037 single_value
= new single_value_struct
;
2038 set_selection(SPECIFIC_VALUE
);
2039 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
2040 single_value
->field_abstract
= ANY_VALUE
;
2041 single_value
->field_transfer
= ANY_VALUE
;
2046 void EXTERNAL_identification_syntaxes_template::copy_value(const EXTERNAL_identification_syntaxes
& other_value
)
2048 single_value
= new single_value_struct
;
2049 single_value
->field_abstract
= other_value
.abstract();
2050 single_value
->field_transfer
= other_value
.transfer();
2051 set_selection(SPECIFIC_VALUE
);
2054 void EXTERNAL_identification_syntaxes_template::copy_template(const EXTERNAL_identification_syntaxes_template
& other_value
)
2056 switch (other_value
.template_selection
) {
2057 case SPECIFIC_VALUE
:
2058 single_value
= new single_value_struct(*other_value
.single_value
);
2065 case COMPLEMENTED_LIST
:
2066 value_list
.n_values
= other_value
.value_list
.n_values
;
2067 value_list
.list_value
= new EXTERNAL_identification_syntaxes_template
[value_list
.n_values
];
2068 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2069 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
2072 TTCN_error("Copying an uninitialized/unsupported template of type EXTERNAL.identification.syntaxes.");
2074 set_selection(other_value
);
2077 EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_template()
2081 EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_template(template_sel other_value
)
2082 : Base_Template(other_value
)
2084 check_single_selection(other_value
);
2087 EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_template(const EXTERNAL_identification_syntaxes
& other_value
)
2089 copy_value(other_value
);
2092 EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_template(const OPTIONAL
<EXTERNAL_identification_syntaxes
>& other_value
)
2094 switch (other_value
.get_selection()) {
2095 case OPTIONAL_PRESENT
:
2096 copy_value((const EXTERNAL_identification_syntaxes
&)other_value
);
2099 set_selection(OMIT_VALUE
);
2102 TTCN_error("Creating a template of type EXTERNAL.identification.syntaxes from an unbound optional field.");
2106 EXTERNAL_identification_syntaxes_template::EXTERNAL_identification_syntaxes_template(const EXTERNAL_identification_syntaxes_template
& other_value
)
2109 copy_template(other_value
);
2112 EXTERNAL_identification_syntaxes_template::~EXTERNAL_identification_syntaxes_template()
2117 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_syntaxes_template::operator=(template_sel other_value
)
2119 check_single_selection(other_value
);
2121 set_selection(other_value
);
2125 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_syntaxes_template::operator=(const EXTERNAL_identification_syntaxes
& other_value
)
2128 copy_value(other_value
);
2132 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_syntaxes_template::operator=(const OPTIONAL
<EXTERNAL_identification_syntaxes
>& other_value
)
2135 switch (other_value
.get_selection()) {
2136 case OPTIONAL_PRESENT
:
2137 copy_value((const EXTERNAL_identification_syntaxes
&)other_value
);
2140 set_selection(OMIT_VALUE
);
2143 TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.identification.syntaxes.");
2148 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_syntaxes_template::operator=(const EXTERNAL_identification_syntaxes_template
& other_value
)
2150 if (&other_value
!= this) {
2152 copy_template(other_value
);
2157 boolean
EXTERNAL_identification_syntaxes_template::match(const EXTERNAL_identification_syntaxes
& other_value
) const
2159 switch (template_selection
) {
2165 case SPECIFIC_VALUE
:
2166 if (!other_value
.abstract().is_bound()) return FALSE
;
2167 if (!single_value
->field_abstract
.match(other_value
.abstract())) return FALSE
;
2168 if (!other_value
.transfer().is_bound()) return FALSE
;
2169 if (!single_value
->field_transfer
.match(other_value
.transfer())) return FALSE
;
2172 case COMPLEMENTED_LIST
:
2173 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2174 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
2175 return template_selection
== COMPLEMENTED_LIST
;
2177 TTCN_error("Matching an uninitialized/unsupported template of type EXTERNAL.identification.syntaxes.");
2182 EXTERNAL_identification_syntaxes
EXTERNAL_identification_syntaxes_template::valueof() const
2184 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
2185 TTCN_error("Performing valueof or send operation on a non-specific template of type EXTERNAL.identification.syntaxes.");
2186 EXTERNAL_identification_syntaxes ret_val
;
2187 ret_val
.abstract() = single_value
->field_abstract
.valueof();
2188 ret_val
.transfer() = single_value
->field_transfer
.valueof();
2192 void EXTERNAL_identification_syntaxes_template::set_type(template_sel template_type
, unsigned int list_length
)
2194 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
2195 TTCN_error("Setting an invalid list for a template of type EXTERNAL.identification.syntaxes.");
2197 set_selection(template_type
);
2198 value_list
.n_values
= list_length
;
2199 value_list
.list_value
= new EXTERNAL_identification_syntaxes_template
[list_length
];
2202 EXTERNAL_identification_syntaxes_template
& EXTERNAL_identification_syntaxes_template::list_item(unsigned int list_index
) const
2204 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
2205 TTCN_error("Accessing a list element of a non-list template of type EXTERNAL.identification.syntaxes.");
2206 if (list_index
>= value_list
.n_values
)
2207 TTCN_error("Index overflow in a value list template of type EXTERNAL.identification.syntaxes.");
2208 return value_list
.list_value
[list_index
];
2211 OBJID_template
& EXTERNAL_identification_syntaxes_template::abstract()
2214 return single_value
->field_abstract
;
2217 const OBJID_template
& EXTERNAL_identification_syntaxes_template::abstract() const
2219 if (template_selection
!= SPECIFIC_VALUE
)
2220 TTCN_error("Accessing field abstract of a non-specific template of type EXTERNAL.identification.syntaxes.");
2221 return single_value
->field_abstract
;
2224 OBJID_template
& EXTERNAL_identification_syntaxes_template::transfer()
2227 return single_value
->field_transfer
;
2230 const OBJID_template
& EXTERNAL_identification_syntaxes_template::transfer() const
2232 if (template_selection
!= SPECIFIC_VALUE
)
2233 TTCN_error("Accessing field transfer of a non-specific template of type EXTERNAL.identification.syntaxes.");
2234 return single_value
->field_transfer
;
2237 int EXTERNAL_identification_syntaxes_template::size_of() const
2239 switch (template_selection
)
2241 case SPECIFIC_VALUE
:
2248 if (value_list
.n_values
<1)
2249 TTCN_error("Internal error: Performing sizeof() operation on a template of type EXTERNAL.identification.syntaxes containing an empty list.");
2250 int item_size
= value_list
.list_value
[0].size_of();
2251 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
2253 if (value_list
.list_value
[i
].size_of()!=item_size
)
2254 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.syntaxes containing a value list with different sizes.");
2259 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.syntaxes containing omit value.");
2262 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.syntaxes containing */? value.");
2263 case COMPLEMENTED_LIST
:
2264 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.syntaxes containing complemented list.");
2266 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EXTERNAL.identification.syntaxes.");
2271 void EXTERNAL_identification_syntaxes_template::log() const
2273 switch (template_selection
) {
2274 case SPECIFIC_VALUE
:
2275 TTCN_Logger::log_event_str("{ abstract := ");
2276 single_value
->field_abstract
.log();
2277 TTCN_Logger::log_event_str(", transfer := ");
2278 single_value
->field_transfer
.log();
2279 TTCN_Logger::log_event_str(" }");
2281 case COMPLEMENTED_LIST
:
2282 TTCN_Logger::log_event_str("complement ");
2285 TTCN_Logger::log_char('(');
2286 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
2287 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
2288 value_list
.list_value
[list_count
].log();
2290 TTCN_Logger::log_char(')');
2299 void EXTERNAL_identification_syntaxes_template::log_match(const EXTERNAL_identification_syntaxes
& match_value
) const
2301 if (template_selection
== SPECIFIC_VALUE
) {
2302 TTCN_Logger::log_event_str("{ abstract := ");
2303 single_value
->field_abstract
.log_match(match_value
.abstract());
2304 TTCN_Logger::log_event_str(", transfer := ");
2305 single_value
->field_transfer
.log_match(match_value
.transfer());
2306 TTCN_Logger::log_event_str(" }");
2309 TTCN_Logger::log_event_str(" with ");
2311 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
2312 else TTCN_Logger::log_event_str(" unmatched");
2316 void EXTERNAL_identification_syntaxes_template::encode_text(Text_Buf
& text_buf
) const
2318 encode_text_base(text_buf
);
2319 switch (template_selection
) {
2320 case SPECIFIC_VALUE
:
2321 single_value
->field_abstract
.encode_text(text_buf
);
2322 single_value
->field_transfer
.encode_text(text_buf
);
2329 case COMPLEMENTED_LIST
:
2330 text_buf
.push_int(value_list
.n_values
);
2331 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2332 value_list
.list_value
[list_count
].encode_text(text_buf
);
2335 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EXTERNAL.identification.syntaxes.");
2339 void EXTERNAL_identification_syntaxes_template::decode_text(Text_Buf
& text_buf
)
2342 decode_text_base(text_buf
);
2343 switch (template_selection
) {
2344 case SPECIFIC_VALUE
:
2345 single_value
= new single_value_struct
;
2346 single_value
->field_abstract
.decode_text(text_buf
);
2347 single_value
->field_transfer
.decode_text(text_buf
);
2354 case COMPLEMENTED_LIST
:
2355 value_list
.n_values
= text_buf
.pull_int().get_val();
2356 value_list
.list_value
= new EXTERNAL_identification_syntaxes_template
[value_list
.n_values
];
2357 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2358 value_list
.list_value
[list_count
].decode_text(text_buf
);
2361 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EXTERNAL.identification.syntaxes.");
2365 boolean
EXTERNAL_identification_syntaxes_template::is_present() const
2367 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
2368 return !match_omit();
2371 boolean
EXTERNAL_identification_syntaxes_template::match_omit() const
2373 if (is_ifpresent
) return TRUE
;
2374 switch (template_selection
) {
2379 case COMPLEMENTED_LIST
:
2380 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
2381 if (value_list
.list_value
[i
].match_omit())
2382 return template_selection
==VALUE_LIST
;
2383 return template_selection
==COMPLEMENTED_LIST
;
2390 #ifndef TITAN_RUNTIME_2
2391 void EXTERNAL_identification_syntaxes_template::check_restriction(template_res t_res
, const char* t_name
) const
2393 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
2394 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
2396 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
2399 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
2400 template_selection
==SPECIFIC_VALUE
)) return;
2403 if (!match_omit()) return;
2408 TTCN_error("Restriction `%s' on template of type %s violated.",
2409 get_res_name(t_res
), t_name
? t_name
: "EXTERNAL.identification.syntaxes");
2413 EXTERNAL_identification_context__negotiation::EXTERNAL_identification_context__negotiation()
2417 EXTERNAL_identification_context__negotiation::EXTERNAL_identification_context__negotiation(const INTEGER
& par_presentation__context__id
,
2418 const OBJID
& par_transfer__syntax
)
2419 : field_presentation__context__id(par_presentation__context__id
),
2420 field_transfer__syntax(par_transfer__syntax
)
2424 boolean
EXTERNAL_identification_context__negotiation::operator==(const EXTERNAL_identification_context__negotiation
& other_value
) const
2426 return field_presentation__context__id
==other_value
.field_presentation__context__id
2427 && field_transfer__syntax
==other_value
.field_transfer__syntax
;
2430 int EXTERNAL_identification_context__negotiation::size_of() const
2436 void EXTERNAL_identification_context__negotiation::log() const
2438 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2439 field_presentation__context__id
.log();
2440 TTCN_Logger::log_event_str(", transfer_syntax := ");
2441 field_transfer__syntax
.log();
2442 TTCN_Logger::log_event_str(" }");
2445 boolean
EXTERNAL_identification_context__negotiation::is_bound() const
2447 if(field_presentation__context__id
.is_bound()) return TRUE
;
2448 if(field_transfer__syntax
.is_bound()) return TRUE
;
2452 boolean
EXTERNAL_identification_context__negotiation::is_value() const
2454 if(!field_presentation__context__id
.is_value()) return FALSE
;
2455 if(!field_transfer__syntax
.is_value()) return FALSE
;
2459 void EXTERNAL_identification_context__negotiation::clean_up()
2461 field_presentation__context__id
.clean_up();
2462 field_transfer__syntax
.clean_up();
2465 void EXTERNAL_identification_context__negotiation::set_param(Module_Param
& param
)
2467 param
.basic_check(Module_Param::BC_VALUE
, "record value");
2468 switch (param
.get_type()) {
2469 case Module_Param::MP_Value_List
:
2470 if (param
.get_size()==0) return;
2471 if (2!=param
.get_size()) {
2472 param
.error("record value of type EXTERNAL.identification.context-negotiation has 2 fields but list value has %d fields", (int)param
.get_size());
2474 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) presentation__context__id().set_param(*param
.get_elem(0));
2475 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer__syntax().set_param(*param
.get_elem(1));
2477 case Module_Param::MP_Assignment_List
: {
2478 Vector
<bool> value_used(param
.get_size());
2479 value_used
.resize(param
.get_size(), false);
2480 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
2481 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
2482 if (!strcmp(curr_param
->get_id()->get_name(), "presentation_context_id")) {
2483 presentation__context__id().set_param(*curr_param
);
2484 value_used
[val_idx
]=true;
2487 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
2488 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
2489 if (!strcmp(curr_param
->get_id()->get_name(), "transfer_syntax")) {
2490 transfer__syntax().set_param(*curr_param
);
2491 value_used
[val_idx
]=true;
2494 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
2495 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL.identification.context-negotiation: %s", param
.get_elem(val_idx
)->get_id()->get_name());
2500 param
.type_error("record value", "EXTERNAL.identification.context-negotiation");
2504 void EXTERNAL_identification_context__negotiation_template::set_param(Module_Param
& param
)
2506 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
2507 switch (param
.get_type()) {
2508 case Module_Param::MP_Omit
:
2511 case Module_Param::MP_Any
:
2514 case Module_Param::MP_AnyOrNone
:
2515 *this = ANY_OR_OMIT
;
2517 case Module_Param::MP_List_Template
:
2518 case Module_Param::MP_ComplementList_Template
:
2519 set_type(param
.get_type()==Module_Param::MP_List_Template
? VALUE_LIST
: COMPLEMENTED_LIST
, param
.get_size());
2520 for (size_t p_i
=0; p_i
<param
.get_size(); p_i
++) {
2521 list_item(p_i
).set_param(*param
.get_elem(p_i
));
2524 case Module_Param::MP_Value_List
:
2525 if (param
.get_size()==0) break;
2526 if (2!=param
.get_size()) {
2527 param
.error("record template of type EXTERNAL.identification.context-negotiation has 2 fields but list value has %d fields", (int)param
.get_size());
2529 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) presentation__context__id().set_param(*param
.get_elem(0));
2530 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer__syntax().set_param(*param
.get_elem(1));
2532 case Module_Param::MP_Assignment_List
: {
2533 Vector
<bool> value_used(param
.get_size());
2534 value_used
.resize(param
.get_size(), false);
2535 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
2536 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
2537 if (!strcmp(curr_param
->get_id()->get_name(), "presentation_context_id")) {
2538 presentation__context__id().set_param(*curr_param
);
2539 value_used
[val_idx
]=true;
2542 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
2543 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
2544 if (!strcmp(curr_param
->get_id()->get_name(), "transfer_syntax")) {
2545 transfer__syntax().set_param(*curr_param
);
2546 value_used
[val_idx
]=true;
2549 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
2550 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL.identification.context-negotiation: %s", param
.get_elem(val_idx
)->get_id()->get_name());
2555 param
.type_error("record template", "EXTERNAL.identification.context-negotiation");
2557 is_ifpresent
= param
.get_ifpresent();
2560 void EXTERNAL_identification_context__negotiation::encode_text(Text_Buf
& text_buf
) const
2562 field_presentation__context__id
.encode_text(text_buf
);
2563 field_transfer__syntax
.encode_text(text_buf
);
2566 void EXTERNAL_identification_context__negotiation::decode_text(Text_Buf
& text_buf
)
2568 field_presentation__context__id
.decode_text(text_buf
);
2569 field_transfer__syntax
.decode_text(text_buf
);
2572 struct EXTERNAL_identification_context__negotiation_template::single_value_struct
{
2573 INTEGER_template field_presentation__context__id
;
2574 OBJID_template field_transfer__syntax
;
2577 void EXTERNAL_identification_context__negotiation_template::clean_up()
2579 switch (template_selection
) {
2580 case SPECIFIC_VALUE
:
2581 delete single_value
;
2584 case COMPLEMENTED_LIST
:
2585 delete [] value_list
.list_value
;
2590 template_selection
= UNINITIALIZED_TEMPLATE
;
2593 void EXTERNAL_identification_context__negotiation_template::set_specific()
2595 if (template_selection
!= SPECIFIC_VALUE
) {
2596 template_sel old_selection
= template_selection
;
2598 single_value
= new single_value_struct
;
2599 set_selection(SPECIFIC_VALUE
);
2600 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
2601 single_value
->field_presentation__context__id
= ANY_VALUE
;
2602 single_value
->field_transfer__syntax
= ANY_VALUE
;
2607 void EXTERNAL_identification_context__negotiation_template::copy_value(const EXTERNAL_identification_context__negotiation
& other_value
)
2609 single_value
= new single_value_struct
;
2610 single_value
->field_presentation__context__id
= other_value
.presentation__context__id();
2611 single_value
->field_transfer__syntax
= other_value
.transfer__syntax();
2612 set_selection(SPECIFIC_VALUE
);
2615 void EXTERNAL_identification_context__negotiation_template::copy_template(const EXTERNAL_identification_context__negotiation_template
& other_value
)
2617 switch (other_value
.template_selection
) {
2618 case SPECIFIC_VALUE
:
2619 single_value
= new single_value_struct(*other_value
.single_value
);
2626 case COMPLEMENTED_LIST
:
2627 value_list
.n_values
= other_value
.value_list
.n_values
;
2628 value_list
.list_value
= new EXTERNAL_identification_context__negotiation_template
[value_list
.n_values
];
2629 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2630 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
2633 TTCN_error("Copying an uninitialized/unsupported template of type EXTERNAL.identification.context-negotiation.");
2635 set_selection(other_value
);
2638 EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_context__negotiation_template()
2642 EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_context__negotiation_template(template_sel other_value
)
2643 : Base_Template(other_value
)
2645 check_single_selection(other_value
);
2648 EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_context__negotiation_template(const EXTERNAL_identification_context__negotiation
& other_value
)
2650 copy_value(other_value
);
2653 EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_context__negotiation_template(const OPTIONAL
<EXTERNAL_identification_context__negotiation
>& other_value
)
2655 switch (other_value
.get_selection()) {
2656 case OPTIONAL_PRESENT
:
2657 copy_value((const EXTERNAL_identification_context__negotiation
&)other_value
);
2660 set_selection(OMIT_VALUE
);
2663 TTCN_error("Creating a template of type EXTERNAL.identification.context-negotiation from an unbound optional field.");
2667 EXTERNAL_identification_context__negotiation_template::EXTERNAL_identification_context__negotiation_template(const EXTERNAL_identification_context__negotiation_template
& other_value
)
2670 copy_template(other_value
);
2673 EXTERNAL_identification_context__negotiation_template::~EXTERNAL_identification_context__negotiation_template()
2678 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_context__negotiation_template::operator=(template_sel other_value
)
2680 check_single_selection(other_value
);
2682 set_selection(other_value
);
2686 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_context__negotiation_template::operator=(const EXTERNAL_identification_context__negotiation
& other_value
)
2689 copy_value(other_value
);
2693 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_context__negotiation_template::operator=(const OPTIONAL
<EXTERNAL_identification_context__negotiation
>& other_value
)
2696 switch (other_value
.get_selection()) {
2697 case OPTIONAL_PRESENT
:
2698 copy_value((const EXTERNAL_identification_context__negotiation
&)other_value
);
2701 set_selection(OMIT_VALUE
);
2704 TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.identification.context-negotiation.");
2709 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_context__negotiation_template::operator=(const EXTERNAL_identification_context__negotiation_template
& other_value
)
2711 if (&other_value
!= this) {
2713 copy_template(other_value
);
2718 boolean
EXTERNAL_identification_context__negotiation_template::match(const EXTERNAL_identification_context__negotiation
& other_value
) const
2720 switch (template_selection
) {
2726 case SPECIFIC_VALUE
:
2727 if (!other_value
.presentation__context__id().is_bound()) return FALSE
;
2728 if (!single_value
->field_presentation__context__id
.match(other_value
.presentation__context__id())) return FALSE
;
2729 if (!other_value
.transfer__syntax().is_bound()) return FALSE
;
2730 if (!single_value
->field_transfer__syntax
.match(other_value
.transfer__syntax())) return FALSE
;
2733 case COMPLEMENTED_LIST
:
2734 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2735 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
2736 return template_selection
== COMPLEMENTED_LIST
;
2738 TTCN_error("Matching an uninitialized/unsupported template of type EXTERNAL.identification.context-negotiation.");
2743 EXTERNAL_identification_context__negotiation
EXTERNAL_identification_context__negotiation_template::valueof() const
2745 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
2746 TTCN_error("Performing valueof or send operation on a non-specific template of type EXTERNAL.identification.context-negotiation.");
2747 EXTERNAL_identification_context__negotiation ret_val
;
2748 ret_val
.presentation__context__id() = single_value
->field_presentation__context__id
.valueof();
2749 ret_val
.transfer__syntax() = single_value
->field_transfer__syntax
.valueof();
2753 void EXTERNAL_identification_context__negotiation_template::set_type(template_sel template_type
, unsigned int list_length
)
2755 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
2756 TTCN_error("Setting an invalid list for a template of type EXTERNAL.identification.context-negotiation.");
2758 set_selection(template_type
);
2759 value_list
.n_values
= list_length
;
2760 value_list
.list_value
= new EXTERNAL_identification_context__negotiation_template
[list_length
];
2763 EXTERNAL_identification_context__negotiation_template
& EXTERNAL_identification_context__negotiation_template::list_item(unsigned int list_index
) const
2765 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
2766 TTCN_error("Accessing a list element of a non-list template of type EXTERNAL.identification.context-negotiation.");
2767 if (list_index
>= value_list
.n_values
)
2768 TTCN_error("Index overflow in a value list template of type EXTERNAL.identification.context-negotiation.");
2769 return value_list
.list_value
[list_index
];
2772 INTEGER_template
& EXTERNAL_identification_context__negotiation_template::presentation__context__id()
2775 return single_value
->field_presentation__context__id
;
2778 const INTEGER_template
& EXTERNAL_identification_context__negotiation_template::presentation__context__id() const
2780 if (template_selection
!= SPECIFIC_VALUE
)
2781 TTCN_error("Accessing field presentation_context_id of a non-specific template of type EXTERNAL.identification.context-negotiation.");
2782 return single_value
->field_presentation__context__id
;
2785 OBJID_template
& EXTERNAL_identification_context__negotiation_template::transfer__syntax()
2788 return single_value
->field_transfer__syntax
;
2791 const OBJID_template
& EXTERNAL_identification_context__negotiation_template::transfer__syntax() const
2793 if (template_selection
!= SPECIFIC_VALUE
)
2794 TTCN_error("Accessing field transfer_syntax of a non-specific template of type EXTERNAL.identification.context-negotiation.");
2795 return single_value
->field_transfer__syntax
;
2798 int EXTERNAL_identification_context__negotiation_template::size_of() const
2800 switch (template_selection
)
2802 case SPECIFIC_VALUE
:
2809 if (value_list
.n_values
<1)
2810 TTCN_error("Internal error: Performing sizeof() operation on a template of type EXTERNAL.identification.context-negotiation containing an empty list.");
2811 int item_size
= value_list
.list_value
[0].size_of();
2812 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
2814 if (value_list
.list_value
[i
].size_of()!=item_size
)
2815 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.context-negotiation containing a value list with different sizes.");
2820 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.context-negotiation containing omit value.");
2823 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.context-negotiation containing */? value.");
2824 case COMPLEMENTED_LIST
:
2825 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL.identification.context-negotiation containing complemented list.");
2827 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EXTERNAL.identification.context-negotiation.");
2832 void EXTERNAL_identification_context__negotiation_template::log() const
2834 switch (template_selection
) {
2835 case SPECIFIC_VALUE
:
2836 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2837 single_value
->field_presentation__context__id
.log();
2838 TTCN_Logger::log_event_str(", transfer_syntax := ");
2839 single_value
->field_transfer__syntax
.log();
2840 TTCN_Logger::log_event_str(" }");
2842 case COMPLEMENTED_LIST
:
2843 TTCN_Logger::log_event_str("complement ");
2846 TTCN_Logger::log_char('(');
2847 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
2848 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
2849 value_list
.list_value
[list_count
].log();
2851 TTCN_Logger::log_char(')');
2860 void EXTERNAL_identification_context__negotiation_template::log_match(const EXTERNAL_identification_context__negotiation
& match_value
) const
2862 if (template_selection
== SPECIFIC_VALUE
) {
2863 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2864 single_value
->field_presentation__context__id
.log_match(match_value
.presentation__context__id());
2865 TTCN_Logger::log_event_str(", transfer_syntax := ");
2866 single_value
->field_transfer__syntax
.log_match(match_value
.transfer__syntax());
2867 TTCN_Logger::log_event_str(" }");
2870 TTCN_Logger::log_event_str(" with ");
2872 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
2873 else TTCN_Logger::log_event_str(" unmatched");
2877 void EXTERNAL_identification_context__negotiation_template::encode_text(Text_Buf
& text_buf
) const
2879 encode_text_base(text_buf
);
2880 switch (template_selection
) {
2881 case SPECIFIC_VALUE
:
2882 single_value
->field_presentation__context__id
.encode_text(text_buf
);
2883 single_value
->field_transfer__syntax
.encode_text(text_buf
);
2890 case COMPLEMENTED_LIST
:
2891 text_buf
.push_int(value_list
.n_values
);
2892 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2893 value_list
.list_value
[list_count
].encode_text(text_buf
);
2896 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EXTERNAL.identification.context-negotiation.");
2900 void EXTERNAL_identification_context__negotiation_template::decode_text(Text_Buf
& text_buf
)
2903 decode_text_base(text_buf
);
2904 switch (template_selection
) {
2905 case SPECIFIC_VALUE
:
2906 single_value
= new single_value_struct
;
2907 single_value
->field_presentation__context__id
.decode_text(text_buf
);
2908 single_value
->field_transfer__syntax
.decode_text(text_buf
);
2915 case COMPLEMENTED_LIST
:
2916 value_list
.n_values
= text_buf
.pull_int().get_val();
2917 value_list
.list_value
= new EXTERNAL_identification_context__negotiation_template
[value_list
.n_values
];
2918 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2919 value_list
.list_value
[list_count
].decode_text(text_buf
);
2922 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EXTERNAL.identification.context-negotiation.");
2926 boolean
EXTERNAL_identification_context__negotiation_template::is_present() const
2928 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
2929 return !match_omit();
2932 boolean
EXTERNAL_identification_context__negotiation_template::match_omit() const
2934 if (is_ifpresent
) return TRUE
;
2935 switch (template_selection
) {
2940 case COMPLEMENTED_LIST
:
2941 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
2942 if (value_list
.list_value
[i
].match_omit())
2943 return template_selection
==VALUE_LIST
;
2944 return template_selection
==COMPLEMENTED_LIST
;
2951 #ifndef TITAN_RUNTIME_2
2952 void EXTERNAL_identification_context__negotiation_template::check_restriction(template_res t_res
, const char* t_name
) const
2954 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
2955 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
2957 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
2960 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
2961 template_selection
==SPECIFIC_VALUE
)) return;
2964 if (!match_omit()) return;
2969 TTCN_error("Restriction `%s' on template of type %s violated.",
2970 get_res_name(t_res
), t_name
? t_name
: "EXTERNAL.identification.context-negotiation");
2974 EXTERNAL::EXTERNAL()
2978 EXTERNAL::EXTERNAL(const EXTERNAL_identification
& par_identification
,
2979 const OPTIONAL
<UNIVERSAL_CHARSTRING
>& par_data__value__descriptor
,
2980 const OCTETSTRING
& par_data__value
)
2981 : field_identification(par_identification
),
2982 field_data__value__descriptor(par_data__value__descriptor
),
2983 field_data__value(par_data__value
)
2987 boolean
EXTERNAL::operator==(const EXTERNAL
& other_value
) const
2989 return field_identification
==other_value
.field_identification
2990 && field_data__value__descriptor
==other_value
.field_data__value__descriptor
2991 && field_data__value
==other_value
.field_data__value
;
2994 int EXTERNAL::size_of() const
2997 if (field_data__value__descriptor
.ispresent()) ret_val
++;
3001 void EXTERNAL::log() const
3003 TTCN_Logger::log_event_str("{ identification := ");
3004 field_identification
.log();
3005 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3006 field_data__value__descriptor
.log();
3007 TTCN_Logger::log_event_str(", data_value := ");
3008 field_data__value
.log();
3009 TTCN_Logger::log_event_str(" }");
3012 boolean
EXTERNAL::is_bound() const
3014 if(field_identification
.is_bound()) return TRUE
;
3015 if(OPTIONAL_OMIT
== field_data__value__descriptor
.get_selection() || field_data__value__descriptor
.is_bound()) return TRUE
;
3016 if(field_data__value
.is_bound()) return TRUE
;
3020 boolean
EXTERNAL::is_value() const
3022 if(!field_identification
.is_value()) return FALSE
;
3023 if(OPTIONAL_OMIT
!= field_data__value__descriptor
.get_selection() && !field_data__value__descriptor
.is_value()) return FALSE
;
3024 if(!field_data__value
.is_value()) return FALSE
;
3028 void EXTERNAL::clean_up()
3030 field_identification
.clean_up();
3031 field_data__value__descriptor
.clean_up();
3032 field_data__value
.clean_up();
3035 void EXTERNAL::set_param(Module_Param
& param
)
3037 param
.basic_check(Module_Param::BC_VALUE
, "record value");
3038 switch (param
.get_type()) {
3039 case Module_Param::MP_Value_List
:
3040 if (param
.get_size()==0) return;
3041 if (3!=param
.get_size()) {
3042 param
.error("record value of type EXTERNAL has 3 fields but list value has %d fields", (int)param
.get_size());
3044 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) identification().set_param(*param
.get_elem(0));
3045 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) data__value__descriptor().set_param(*param
.get_elem(1));
3046 if (param
.get_elem(2)->get_type()!=Module_Param::MP_NotUsed
) data__value().set_param(*param
.get_elem(2));
3048 case Module_Param::MP_Assignment_List
: {
3049 Vector
<bool> value_used(param
.get_size());
3050 value_used
.resize(param
.get_size(), false);
3051 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3052 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3053 if (!strcmp(curr_param
->get_id()->get_name(), "identification")) {
3054 identification().set_param(*curr_param
);
3055 value_used
[val_idx
]=true;
3058 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3059 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3060 if (!strcmp(curr_param
->get_id()->get_name(), "data_value_descriptor")) {
3061 data__value__descriptor().set_param(*curr_param
);
3062 value_used
[val_idx
]=true;
3065 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3066 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3067 if (!strcmp(curr_param
->get_id()->get_name(), "data_value")) {
3068 data__value().set_param(*curr_param
);
3069 value_used
[val_idx
]=true;
3072 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
3073 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL: %s", param
.get_elem(val_idx
)->get_id()->get_name());
3078 param
.type_error("record value", "EXTERNAL");
3082 void EXTERNAL_template::set_param(Module_Param
& param
)
3084 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
3085 switch (param
.get_type()) {
3086 case Module_Param::MP_Omit
:
3089 case Module_Param::MP_Any
:
3092 case Module_Param::MP_AnyOrNone
:
3093 *this = ANY_OR_OMIT
;
3095 case Module_Param::MP_List_Template
:
3096 case Module_Param::MP_ComplementList_Template
:
3097 set_type(param
.get_type()==Module_Param::MP_List_Template
? VALUE_LIST
: COMPLEMENTED_LIST
, param
.get_size());
3098 for (size_t p_i
=0; p_i
<param
.get_size(); p_i
++) {
3099 list_item(p_i
).set_param(*param
.get_elem(p_i
));
3102 case Module_Param::MP_Value_List
:
3103 if (param
.get_size()==0) break;
3104 if (3!=param
.get_size()) {
3105 param
.error("record template of type EXTERNAL has 3 fields but list value has %d fields", (int)param
.get_size());
3107 if (param
.get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) identification().set_param(*param
.get_elem(0));
3108 if (param
.get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) data__value__descriptor().set_param(*param
.get_elem(1));
3109 if (param
.get_elem(2)->get_type()!=Module_Param::MP_NotUsed
) data__value().set_param(*param
.get_elem(2));
3111 case Module_Param::MP_Assignment_List
: {
3112 Vector
<bool> value_used(param
.get_size());
3113 value_used
.resize(param
.get_size(), false);
3114 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3115 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3116 if (!strcmp(curr_param
->get_id()->get_name(), "identification")) {
3117 identification().set_param(*curr_param
);
3118 value_used
[val_idx
]=true;
3121 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3122 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3123 if (!strcmp(curr_param
->get_id()->get_name(), "data_value_descriptor")) {
3124 data__value__descriptor().set_param(*curr_param
);
3125 value_used
[val_idx
]=true;
3128 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) {
3129 Module_Param
* const curr_param
= param
.get_elem(val_idx
);
3130 if (!strcmp(curr_param
->get_id()->get_name(), "data_value")) {
3131 data__value().set_param(*curr_param
);
3132 value_used
[val_idx
]=true;
3135 for (size_t val_idx
=0; val_idx
<param
.get_size(); val_idx
++) if (!value_used
[val_idx
]) {
3136 param
.get_elem(val_idx
)->error("Non existent field name in type EXTERNAL: %s", param
.get_elem(val_idx
)->get_id()->get_name());
3141 param
.type_error("record template", "EXTERNAL");
3143 is_ifpresent
= param
.get_ifpresent();
3146 void EXTERNAL::encode_text(Text_Buf
& text_buf
) const
3148 field_identification
.encode_text(text_buf
);
3149 field_data__value__descriptor
.encode_text(text_buf
);
3150 field_data__value
.encode_text(text_buf
);
3153 void EXTERNAL::decode_text(Text_Buf
& text_buf
)
3155 field_identification
.decode_text(text_buf
);
3156 field_data__value__descriptor
.decode_text(text_buf
);
3157 field_data__value
.decode_text(text_buf
);
3160 void EXTERNAL::encode(const TTCN_Typedescriptor_t
& p_td
, TTCN_Buffer
& p_buf
, TTCN_EncDec::coding_t p_coding
, ...) const
3163 va_start(pvar
, p_coding
);
3165 case TTCN_EncDec::CT_BER
: {
3166 TTCN_EncDec_ErrorContext
ec("While BER-encoding type '%s': ", p_td
.name
);
3167 unsigned BER_coding
=va_arg(pvar
, unsigned);
3168 BER_encode_chk_coding(BER_coding
);
3169 ASN_BER_TLV_t
*tlv
=BER_encode_TLV(p_td
, BER_coding
);
3170 tlv
->put_in_buffer(p_buf
);
3171 ASN_BER_TLV_t::destruct(tlv
);
3173 case TTCN_EncDec::CT_RAW
: {
3174 TTCN_EncDec_ErrorContext
ec("While RAW-encoding type '%s': ", p_td
.name
);
3175 TTCN_EncDec_ErrorContext::error_internal
3176 ("No RAW descriptor available for type '%s'.", p_td
.name
);
3178 case TTCN_EncDec::CT_TEXT
: {
3179 TTCN_EncDec_ErrorContext
ec("While TEXT-encoding type '%s': ", p_td
.name
);
3180 TTCN_EncDec_ErrorContext::error_internal
3181 ("No TEXT descriptor available for type '%s'.", p_td
.name
);
3183 case TTCN_EncDec::CT_XER
: {
3184 TTCN_EncDec_ErrorContext
ec("While XER-encoding type '%s': ", p_td
.name
);
3185 unsigned XER_coding
=va_arg(pvar
, unsigned);
3186 XER_encode(*p_td
.xer
, p_buf
, XER_coding
, 0, 0);
3188 case TTCN_EncDec::CT_JSON
: {
3189 TTCN_EncDec_ErrorContext
ec("While JSON-encoding type '%s': ", p_td
.name
);
3190 TTCN_EncDec_ErrorContext::error_internal
3191 ("No JSON descriptor available for type '%s'.", p_td
.name
);
3194 TTCN_error("Unknown coding method requested to encode type '%s'", p_td
.name
);
3199 void EXTERNAL::decode(const TTCN_Typedescriptor_t
& p_td
, TTCN_Buffer
& p_buf
, TTCN_EncDec::coding_t p_coding
, ...)
3202 va_start(pvar
, p_coding
);
3204 case TTCN_EncDec::CT_BER
: {
3205 TTCN_EncDec_ErrorContext
ec("While BER-decoding type '%s': ", p_td
.name
);
3206 unsigned L_form
=va_arg(pvar
, unsigned);
3208 BER_decode_str2TLV(p_buf
, tlv
, L_form
);
3209 BER_decode_TLV(p_td
, tlv
, L_form
);
3210 if(tlv
.isComplete
) p_buf
.increase_pos(tlv
.get_len());
3212 case TTCN_EncDec::CT_RAW
: {
3213 TTCN_EncDec_ErrorContext
ec("While RAW-decoding type '%s': ", p_td
.name
);
3214 TTCN_EncDec_ErrorContext::error_internal
3215 ("No RAW descriptor available for type '%s'.", p_td
.name
);
3217 case TTCN_EncDec::CT_TEXT
: {
3218 TTCN_EncDec_ErrorContext
ec("While TEXT-decoding type '%s': ", p_td
.name
);
3219 TTCN_EncDec_ErrorContext::error_internal
3220 ("No TEXT descriptor available for type '%s'.", p_td
.name
);
3222 case TTCN_EncDec::CT_XER
: {
3223 TTCN_EncDec_ErrorContext
ec("While XER-decoding type '%s': ", p_td
.name
);
3224 unsigned XER_coding
=va_arg(pvar
, unsigned);
3225 XmlReaderWrap
reader(p_buf
);
3226 int success
= reader
.Read();
3227 for (; success
==1; success
=reader
.Read()) {
3228 int type
= reader
.NodeType();
3229 if (type
==XML_READER_TYPE_ELEMENT
)
3232 XER_decode(*p_td
.xer
, reader
, XER_coding
, 0);
3233 size_t bytes
= reader
.ByteConsumed();
3234 p_buf
.set_pos(bytes
);
3236 case TTCN_EncDec::CT_JSON
: {
3237 TTCN_EncDec_ErrorContext
ec("While JSON-decoding type '%s': ", p_td
.name
);
3238 TTCN_EncDec_ErrorContext::error_internal
3239 ("No JSON descriptor available for type '%s'.", p_td
.name
);
3242 TTCN_error("Unknown coding method requested to decode type '%s'", p_td
.name
);
3247 struct EXTERNAL_template::single_value_struct
{
3248 EXTERNAL_identification_template field_identification
;
3249 UNIVERSAL_CHARSTRING_template field_data__value__descriptor
;
3250 OCTETSTRING_template field_data__value
;
3253 void EXTERNAL_template::clean_up()
3255 switch (template_selection
) {
3256 case SPECIFIC_VALUE
:
3257 delete single_value
;
3260 case COMPLEMENTED_LIST
:
3261 delete [] value_list
.list_value
;
3266 template_selection
= UNINITIALIZED_TEMPLATE
;
3269 void EXTERNAL_template::set_specific()
3271 if (template_selection
!= SPECIFIC_VALUE
) {
3272 template_sel old_selection
= template_selection
;
3274 single_value
= new single_value_struct
;
3275 set_selection(SPECIFIC_VALUE
);
3276 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
3277 single_value
->field_identification
= ANY_VALUE
;
3278 single_value
->field_data__value__descriptor
= ANY_OR_OMIT
;
3279 single_value
->field_data__value
= ANY_VALUE
;
3284 void EXTERNAL_template::copy_value(const EXTERNAL
& other_value
)
3286 single_value
= new single_value_struct
;
3287 single_value
->field_identification
= other_value
.identification();
3288 if (other_value
.data__value__descriptor().ispresent()) single_value
->field_data__value__descriptor
= (const UNIVERSAL_CHARSTRING
&)(other_value
.data__value__descriptor());
3289 else single_value
->field_data__value__descriptor
= OMIT_VALUE
;
3290 single_value
->field_data__value
= other_value
.data__value();
3291 set_selection(SPECIFIC_VALUE
);
3294 void EXTERNAL_template::copy_template(const EXTERNAL_template
& other_value
)
3296 switch (other_value
.template_selection
) {
3297 case SPECIFIC_VALUE
:
3298 single_value
= new single_value_struct(*other_value
.single_value
);
3305 case COMPLEMENTED_LIST
:
3306 value_list
.n_values
= other_value
.value_list
.n_values
;
3307 value_list
.list_value
= new EXTERNAL_template
[value_list
.n_values
];
3308 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3309 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
3312 TTCN_error("Copying an uninitialized/unsupported template of type EXTERNAL.");
3314 set_selection(other_value
);
3317 EXTERNAL_template::EXTERNAL_template()
3321 EXTERNAL_template::EXTERNAL_template(template_sel other_value
)
3322 : Base_Template(other_value
)
3324 check_single_selection(other_value
);
3327 EXTERNAL_template::EXTERNAL_template(const EXTERNAL
& other_value
)
3329 copy_value(other_value
);
3332 EXTERNAL_template::EXTERNAL_template(const OPTIONAL
<EXTERNAL
>& other_value
)
3334 switch (other_value
.get_selection()) {
3335 case OPTIONAL_PRESENT
:
3336 copy_value((const EXTERNAL
&)other_value
);
3339 set_selection(OMIT_VALUE
);
3342 TTCN_error("Creating a template of type EXTERNAL from an unbound optional field.");
3346 EXTERNAL_template::EXTERNAL_template(const EXTERNAL_template
& other_value
)
3349 copy_template(other_value
);
3352 EXTERNAL_template::~EXTERNAL_template()
3357 EXTERNAL_template
& EXTERNAL_template::operator=(template_sel other_value
)
3359 check_single_selection(other_value
);
3361 set_selection(other_value
);
3365 EXTERNAL_template
& EXTERNAL_template::operator=(const EXTERNAL
& other_value
)
3368 copy_value(other_value
);
3372 EXTERNAL_template
& EXTERNAL_template::operator=(const OPTIONAL
<EXTERNAL
>& other_value
)
3375 switch (other_value
.get_selection()) {
3376 case OPTIONAL_PRESENT
:
3377 copy_value((const EXTERNAL
&)other_value
);
3380 set_selection(OMIT_VALUE
);
3383 TTCN_error("Assignment of an unbound optional field to a template of type EXTERNAL.");
3388 EXTERNAL_template
& EXTERNAL_template::operator=(const EXTERNAL_template
& other_value
)
3390 if (&other_value
!= this) {
3392 copy_template(other_value
);
3397 boolean
EXTERNAL_template::match(const EXTERNAL
& other_value
) const
3399 switch (template_selection
) {
3405 case SPECIFIC_VALUE
:
3406 if (!other_value
.identification().is_bound()) return FALSE
;
3407 if (!single_value
->field_identification
.match(other_value
.identification())) return FALSE
;
3408 if (!other_value
.data__value__descriptor().is_bound()) return FALSE
;
3409 if (other_value
.data__value__descriptor().ispresent() ? !single_value
->field_data__value__descriptor
.match((const UNIVERSAL_CHARSTRING
&)other_value
.data__value__descriptor()) : !single_value
->field_data__value__descriptor
.match_omit()) return FALSE
;
3410 if (!other_value
.data__value().is_bound()) return FALSE
;
3411 if (!single_value
->field_data__value
.match(other_value
.data__value())) return FALSE
;
3414 case COMPLEMENTED_LIST
:
3415 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3416 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
3417 return template_selection
== COMPLEMENTED_LIST
;
3419 TTCN_error("Matching an uninitialized/unsupported template of type EXTERNAL.");
3424 EXTERNAL
EXTERNAL_template::valueof() const
3426 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
3427 TTCN_error("Performing valueof or send operation on a non-specific template of type EXTERNAL.");
3429 ret_val
.identification() = single_value
->field_identification
.valueof();
3430 if (single_value
->field_data__value__descriptor
.is_omit()) ret_val
.data__value__descriptor() = OMIT_VALUE
;
3431 else ret_val
.data__value__descriptor() = single_value
->field_data__value__descriptor
.valueof();
3432 ret_val
.data__value() = single_value
->field_data__value
.valueof();
3436 void EXTERNAL_template::set_type(template_sel template_type
, unsigned int list_length
)
3438 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
3439 TTCN_error("Setting an invalid list for a template of type EXTERNAL.");
3441 set_selection(template_type
);
3442 value_list
.n_values
= list_length
;
3443 value_list
.list_value
= new EXTERNAL_template
[list_length
];
3446 EXTERNAL_template
& EXTERNAL_template::list_item(unsigned int list_index
) const
3448 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
3449 TTCN_error("Accessing a list element of a non-list template of type EXTERNAL.");
3450 if (list_index
>= value_list
.n_values
)
3451 TTCN_error("Index overflow in a value list template of type EXTERNAL.");
3452 return value_list
.list_value
[list_index
];
3455 EXTERNAL_identification_template
& EXTERNAL_template::identification()
3458 return single_value
->field_identification
;
3461 const EXTERNAL_identification_template
& EXTERNAL_template::identification() const
3463 if (template_selection
!= SPECIFIC_VALUE
)
3464 TTCN_error("Accessing field identification of a non-specific template of type EXTERNAL.");
3465 return single_value
->field_identification
;
3468 UNIVERSAL_CHARSTRING_template
& EXTERNAL_template::data__value__descriptor()
3471 return single_value
->field_data__value__descriptor
;
3474 const UNIVERSAL_CHARSTRING_template
& EXTERNAL_template::data__value__descriptor() const
3476 if (template_selection
!= SPECIFIC_VALUE
)
3477 TTCN_error("Accessing field data_value_descriptor of a non-specific template of type EXTERNAL.");
3478 return single_value
->field_data__value__descriptor
;
3481 OCTETSTRING_template
& EXTERNAL_template::data__value()
3484 return single_value
->field_data__value
;
3487 const OCTETSTRING_template
& EXTERNAL_template::data__value() const
3489 if (template_selection
!= SPECIFIC_VALUE
)
3490 TTCN_error("Accessing field data_value of a non-specific template of type EXTERNAL.");
3491 return single_value
->field_data__value
;
3494 int EXTERNAL_template::size_of() const
3496 switch (template_selection
)
3498 case SPECIFIC_VALUE
:
3501 if (single_value
->field_data__value__descriptor
.is_present()) ret_val
++;
3506 if (value_list
.n_values
<1)
3507 TTCN_error("Internal error: Performing sizeof() operation on a template of type EXTERNAL containing an empty list.");
3508 int item_size
= value_list
.list_value
[0].size_of();
3509 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
3511 if (value_list
.list_value
[i
].size_of()!=item_size
)
3512 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL containing a value list with different sizes.");
3517 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL containing omit value.");
3520 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL containing */? value.");
3521 case COMPLEMENTED_LIST
:
3522 TTCN_error("Performing sizeof() operation on a template of type EXTERNAL containing complemented list.");
3524 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EXTERNAL.");
3529 void EXTERNAL_template::log() const
3531 switch (template_selection
) {
3532 case SPECIFIC_VALUE
:
3533 TTCN_Logger::log_event_str("{ identification := ");
3534 single_value
->field_identification
.log();
3535 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3536 single_value
->field_data__value__descriptor
.log();
3537 TTCN_Logger::log_event_str(", data_value := ");
3538 single_value
->field_data__value
.log();
3539 TTCN_Logger::log_event_str(" }");
3541 case COMPLEMENTED_LIST
:
3542 TTCN_Logger::log_event_str("complement ");
3545 TTCN_Logger::log_char('(');
3546 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
3547 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
3548 value_list
.list_value
[list_count
].log();
3550 TTCN_Logger::log_char(')');
3559 void EXTERNAL_template::log_match(const EXTERNAL
& match_value
) const
3561 if (template_selection
== SPECIFIC_VALUE
) {
3562 TTCN_Logger::log_event_str("{ identification := ");
3563 single_value
->field_identification
.log_match(match_value
.identification());
3564 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3565 if (match_value
.data__value__descriptor().ispresent()) single_value
->field_data__value__descriptor
.log_match(match_value
.data__value__descriptor());
3567 single_value
->field_data__value__descriptor
.log();
3568 if (single_value
->field_data__value__descriptor
.match_omit()) TTCN_Logger::log_event_str(" matched");
3569 else TTCN_Logger::log_event_str(" unmatched");
3571 TTCN_Logger::log_event_str(", data_value := ");
3572 single_value
->field_data__value
.log_match(match_value
.data__value());
3573 TTCN_Logger::log_event_str(" }");
3576 TTCN_Logger::log_event_str(" with ");
3578 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
3579 else TTCN_Logger::log_event_str(" unmatched");
3583 void EXTERNAL_template::encode_text(Text_Buf
& text_buf
) const
3585 encode_text_base(text_buf
);
3586 switch (template_selection
) {
3587 case SPECIFIC_VALUE
:
3588 single_value
->field_identification
.encode_text(text_buf
);
3589 single_value
->field_data__value__descriptor
.encode_text(text_buf
);
3590 single_value
->field_data__value
.encode_text(text_buf
);
3597 case COMPLEMENTED_LIST
:
3598 text_buf
.push_int(value_list
.n_values
);
3599 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3600 value_list
.list_value
[list_count
].encode_text(text_buf
);
3603 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EXTERNAL.");
3607 void EXTERNAL_template::decode_text(Text_Buf
& text_buf
)
3610 decode_text_base(text_buf
);
3611 switch (template_selection
) {
3612 case SPECIFIC_VALUE
:
3613 single_value
= new single_value_struct
;
3614 single_value
->field_identification
.decode_text(text_buf
);
3615 single_value
->field_data__value__descriptor
.decode_text(text_buf
);
3616 single_value
->field_data__value
.decode_text(text_buf
);
3623 case COMPLEMENTED_LIST
:
3624 value_list
.n_values
= text_buf
.pull_int().get_val();
3625 value_list
.list_value
= new EXTERNAL_template
[value_list
.n_values
];
3626 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3627 value_list
.list_value
[list_count
].decode_text(text_buf
);
3630 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EXTERNAL.");
3634 boolean
EXTERNAL_template::is_present() const
3636 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
3637 return !match_omit();
3640 boolean
EXTERNAL_template::match_omit() const
3642 if (is_ifpresent
) return TRUE
;
3643 switch (template_selection
) {
3648 case COMPLEMENTED_LIST
:
3649 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
3650 if (value_list
.list_value
[i
].match_omit())
3651 return template_selection
==VALUE_LIST
;
3652 return template_selection
==COMPLEMENTED_LIST
;
3659 #ifndef TITAN_RUNTIME_2
3660 void EXTERNAL_template::check_restriction(template_res t_res
, const char* t_name
) const
3662 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
3663 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
3665 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
3668 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
3669 template_selection
==SPECIFIC_VALUE
)) return;
3672 if (!match_omit()) return;
3677 TTCN_error("Restriction `%s' on template of type %s violated.",
3678 get_res_name(t_res
), t_name
? t_name
: "EXTERNAL");