1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
18 * Szabo, Janos Zoltan – initial implementation
21 ******************************************************************************/
28 #include "Param_Types.hh"
30 #include "ASN_EmbeddedPDV.hh"
32 #include "../common/dbgnew.hh"
36 to do when regenerating:
40 add __SUNPRO_CC ifdefs for single_value_struct
44 replace '@EMBEDDED PDV' with 'EMBEDDED PDV'
46 remove RAW and TEXT enc/dec functions
48 make the type descriptors of embedded types static
52 static const ASN_Tag_t EMBEDDED_PDV_identification_tag_
[] = { { ASN_TAG_CONT
, 0u }};
53 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_ber_
= { 1u, EMBEDDED_PDV_identification_tag_
};
54 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_descr_
= { "EMBEDDED PDV.identification", &EMBEDDED_PDV_identification_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
56 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_abstract_tag_
[] = { { ASN_TAG_CONT
, 0u }};
57 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_ber_
= { 1u, EMBEDDED_PDV_identification_syntaxes_abstract_tag_
};
58 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_descr_
= { "EMBEDDED PDV.identification.syntaxes.abstract", &EMBEDDED_PDV_identification_syntaxes_abstract_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::OBJID
};
60 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_transfer_tag_
[] = { { ASN_TAG_CONT
, 1u }};
61 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_ber_
= { 1u, EMBEDDED_PDV_identification_syntaxes_transfer_tag_
};
62 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_descr_
= { "EMBEDDED PDV.identification.syntaxes.transfer", &EMBEDDED_PDV_identification_syntaxes_transfer_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::OBJID
};
64 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_tag_
[] = { { ASN_TAG_CONT
, 0u }};
65 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_ber_
= { 1u, EMBEDDED_PDV_identification_syntaxes_tag_
};
66 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_descr_
= { "EMBEDDED PDV.identification.syntaxes", &EMBEDDED_PDV_identification_syntaxes_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
68 static const ASN_Tag_t EMBEDDED_PDV_identification_syntax_tag_
[] = { { ASN_TAG_CONT
, 1u }};
69 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntax_ber_
= { 1u, EMBEDDED_PDV_identification_syntax_tag_
};
70 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntax_descr_
= { "EMBEDDED PDV.identification.syntax", &EMBEDDED_PDV_identification_syntax_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::OBJID
};
72 static const ASN_Tag_t EMBEDDED_PDV_identification_presentation__context__id_tag_
[] = { { ASN_TAG_CONT
, 2u }};
73 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_presentation__context__id_ber_
= { 1u, EMBEDDED_PDV_identification_presentation__context__id_tag_
};
74 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_presentation__context__id_descr_
= { "EMBEDDED PDV.identification.presentation-context-id", &EMBEDDED_PDV_identification_presentation__context__id_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
76 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_
[] = { { ASN_TAG_CONT
, 0u }};
77 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_
= { 1u, EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_
};
78 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_
= { "EMBEDDED PDV.identification.context-negotiation.presentation-context-id", &EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
80 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_
[] = { { ASN_TAG_CONT
, 1u }};
81 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_
= { 1u, EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_
};
82 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_
= { "EMBEDDED PDV.identification.context-negotiation.transfer-syntax", &EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::OBJID
};
84 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_tag_
[] = { { ASN_TAG_CONT
, 3u }};
85 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_ber_
= { 1u, EMBEDDED_PDV_identification_context__negotiation_tag_
};
86 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_descr_
= { "EMBEDDED PDV.identification.context-negotiation", &EMBEDDED_PDV_identification_context__negotiation_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
88 static const ASN_Tag_t EMBEDDED_PDV_identification_transfer__syntax_tag_
[] = { { ASN_TAG_CONT
, 4u }};
89 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_transfer__syntax_ber_
= { 1u, EMBEDDED_PDV_identification_transfer__syntax_tag_
};
90 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_transfer__syntax_descr_
= { "EMBEDDED PDV.identification.transfer-syntax", &EMBEDDED_PDV_identification_transfer__syntax_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::OBJID
};
92 static const ASN_Tag_t EMBEDDED_PDV_identification_fixed_tag_
[] = { { ASN_TAG_CONT
, 5u }};
93 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_fixed_ber_
= { 1u, EMBEDDED_PDV_identification_fixed_tag_
};
94 static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_fixed_descr_
= { "EMBEDDED PDV.identification.fixed", &EMBEDDED_PDV_identification_fixed_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
96 static const ASN_Tag_t EMBEDDED_PDV_data__value_tag_
[] = { { ASN_TAG_CONT
, 2u }};
97 static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value_ber_
= { 1u, EMBEDDED_PDV_data__value_tag_
};
98 static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value_descr_
= { "EMBEDDED PDV.data-value", &EMBEDDED_PDV_data__value_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::DONTCARE
};
100 static const ASN_Tag_t EMBEDDED_PDV_data__value__descriptor_tag_
[] = { { ASN_TAG_CONT
, 1u }};
101 static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value__descriptor_ber_
= { 1u, EMBEDDED_PDV_data__value__descriptor_tag_
};
102 static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value__descriptor_descr_
= { "EMBEDDED PDV.data-value-descriptor", &EMBEDDED_PDV_data__value__descriptor_ber_
, NULL
, NULL
, NULL
, NULL
, NULL
, TTCN_Typedescriptor_t::GRAPHICSTRING
};
104 /******************** EMBEDDED_PDV_identification ********************/
106 void EMBEDDED_PDV_identification::clean_up()
108 switch (union_selection
) {
110 delete field_syntaxes
;
115 case ALT_presentation__context__id
:
116 delete field_presentation__context__id
;
118 case ALT_context__negotiation
:
119 delete field_context__negotiation
;
121 case ALT_transfer__syntax
:
122 delete field_transfer__syntax
;
130 union_selection
= UNBOUND_VALUE
;
133 void EMBEDDED_PDV_identification::copy_value(const EMBEDDED_PDV_identification
& other_value
)
135 switch (other_value
.union_selection
) {
137 field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes(*other_value
.field_syntaxes
);
140 field_syntax
= new OBJID(*other_value
.field_syntax
);
142 case ALT_presentation__context__id
:
143 field_presentation__context__id
= new INTEGER(*other_value
.field_presentation__context__id
);
145 case ALT_context__negotiation
:
146 field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation(*other_value
.field_context__negotiation
);
148 case ALT_transfer__syntax
:
149 field_transfer__syntax
= new OBJID(*other_value
.field_transfer__syntax
);
152 field_fixed
= new ASN_NULL(*other_value
.field_fixed
);
155 TTCN_error("Assignment of an unbound union value of type EMBEDDED PDV.identification.");
157 union_selection
= other_value
.union_selection
;
160 EMBEDDED_PDV_identification::EMBEDDED_PDV_identification()
162 union_selection
= UNBOUND_VALUE
;
165 EMBEDDED_PDV_identification::EMBEDDED_PDV_identification(const EMBEDDED_PDV_identification
& other_value
)
166 : Base_Type(other_value
)
168 copy_value(other_value
);
171 EMBEDDED_PDV_identification::~EMBEDDED_PDV_identification()
176 EMBEDDED_PDV_identification
& EMBEDDED_PDV_identification::operator=(const EMBEDDED_PDV_identification
& other_value
)
178 if (this != &other_value
) {
180 copy_value(other_value
);
185 boolean
EMBEDDED_PDV_identification::operator==(const EMBEDDED_PDV_identification
& other_value
) const
187 if (union_selection
== UNBOUND_VALUE
) TTCN_error("The left operand of comparison is an unbound value of union type EMBEDDED PDV.identification.");
188 if (other_value
.union_selection
== UNBOUND_VALUE
) TTCN_error("The right operand of comparison is an unbound value of union type EMBEDDED PDV.identification.");
189 if (union_selection
!= other_value
.union_selection
) return FALSE
;
190 switch (union_selection
) {
192 return *field_syntaxes
== *other_value
.field_syntaxes
;
194 return *field_syntax
== *other_value
.field_syntax
;
195 case ALT_presentation__context__id
:
196 return *field_presentation__context__id
== *other_value
.field_presentation__context__id
;
197 case ALT_context__negotiation
:
198 return *field_context__negotiation
== *other_value
.field_context__negotiation
;
199 case ALT_transfer__syntax
:
200 return *field_transfer__syntax
== *other_value
.field_transfer__syntax
;
202 return *field_fixed
== *other_value
.field_fixed
;
208 EMBEDDED_PDV_identification_syntaxes
& EMBEDDED_PDV_identification::syntaxes()
210 if (union_selection
!= ALT_syntaxes
) {
212 field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes
;
213 union_selection
= ALT_syntaxes
;
215 return *field_syntaxes
;
218 const EMBEDDED_PDV_identification_syntaxes
& EMBEDDED_PDV_identification::syntaxes() const
220 if (union_selection
!= ALT_syntaxes
) TTCN_error("Using non-selected field syntaxes in a value of union type EMBEDDED PDV.identification.");
221 return *field_syntaxes
;
224 OBJID
& EMBEDDED_PDV_identification::syntax()
226 if (union_selection
!= ALT_syntax
) {
228 field_syntax
= new OBJID
;
229 union_selection
= ALT_syntax
;
231 return *field_syntax
;
234 const OBJID
& EMBEDDED_PDV_identification::syntax() const
236 if (union_selection
!= ALT_syntax
) TTCN_error("Using non-selected field syntax in a value of union type EMBEDDED PDV.identification.");
237 return *field_syntax
;
240 INTEGER
& EMBEDDED_PDV_identification::presentation__context__id()
242 if (union_selection
!= ALT_presentation__context__id
) {
244 field_presentation__context__id
= new INTEGER
;
245 union_selection
= ALT_presentation__context__id
;
247 return *field_presentation__context__id
;
250 const INTEGER
& EMBEDDED_PDV_identification::presentation__context__id() const
252 if (union_selection
!= ALT_presentation__context__id
) TTCN_error("Using non-selected field presentation_context_id in a value of union type EMBEDDED PDV.identification.");
253 return *field_presentation__context__id
;
256 EMBEDDED_PDV_identification_context__negotiation
& EMBEDDED_PDV_identification::context__negotiation()
258 if (union_selection
!= ALT_context__negotiation
) {
260 field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation
;
261 union_selection
= ALT_context__negotiation
;
263 return *field_context__negotiation
;
266 const EMBEDDED_PDV_identification_context__negotiation
& EMBEDDED_PDV_identification::context__negotiation() const
268 if (union_selection
!= ALT_context__negotiation
) TTCN_error("Using non-selected field context_negotiation in a value of union type EMBEDDED PDV.identification.");
269 return *field_context__negotiation
;
272 OBJID
& EMBEDDED_PDV_identification::transfer__syntax()
274 if (union_selection
!= ALT_transfer__syntax
) {
276 field_transfer__syntax
= new OBJID
;
277 union_selection
= ALT_transfer__syntax
;
279 return *field_transfer__syntax
;
282 const OBJID
& EMBEDDED_PDV_identification::transfer__syntax() const
284 if (union_selection
!= ALT_transfer__syntax
) TTCN_error("Using non-selected field transfer_syntax in a value of union type EMBEDDED PDV.identification.");
285 return *field_transfer__syntax
;
288 ASN_NULL
& EMBEDDED_PDV_identification::fixed()
290 if (union_selection
!= ALT_fixed
) {
292 field_fixed
= new ASN_NULL
;
293 union_selection
= ALT_fixed
;
298 const ASN_NULL
& EMBEDDED_PDV_identification::fixed() const
300 if (union_selection
!= ALT_fixed
) TTCN_error("Using non-selected field fixed in a value of union type EMBEDDED PDV.identification.");
304 boolean
EMBEDDED_PDV_identification::ischosen(union_selection_type checked_selection
) const
306 if (checked_selection
== UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type EMBEDDED PDV.identification.");
307 if (union_selection
== UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an unbound value of union type EMBEDDED PDV.identification.");
308 return union_selection
== checked_selection
;
311 boolean
EMBEDDED_PDV_identification::is_bound() const
313 return UNBOUND_VALUE
!= union_selection
;
316 boolean
EMBEDDED_PDV_identification::is_value() const
318 switch (union_selection
) {
320 return field_syntaxes
->is_value();
322 return field_syntax
->is_value();
323 case ALT_presentation__context__id
:
324 return field_presentation__context__id
->is_value();
325 case ALT_context__negotiation
:
326 return field_context__negotiation
->is_value();
327 case ALT_transfer__syntax
:
328 return field_transfer__syntax
->is_value();
330 return field_fixed
->is_value();
336 void EMBEDDED_PDV_identification::log() const
338 switch (union_selection
) {
340 TTCN_Logger::log_event_str("{ syntaxes := ");
341 field_syntaxes
->log();
342 TTCN_Logger::log_event_str(" }");
345 TTCN_Logger::log_event_str("{ syntax := ");
347 TTCN_Logger::log_event_str(" }");
349 case ALT_presentation__context__id
:
350 TTCN_Logger::log_event_str("{ presentation_context_id := ");
351 field_presentation__context__id
->log();
352 TTCN_Logger::log_event_str(" }");
354 case ALT_context__negotiation
:
355 TTCN_Logger::log_event_str("{ context_negotiation := ");
356 field_context__negotiation
->log();
357 TTCN_Logger::log_event_str(" }");
359 case ALT_transfer__syntax
:
360 TTCN_Logger::log_event_str("{ transfer_syntax := ");
361 field_transfer__syntax
->log();
362 TTCN_Logger::log_event_str(" }");
365 TTCN_Logger::log_event_str("{ fixed := ");
367 TTCN_Logger::log_event_str(" }");
370 TTCN_Logger::log_event_str("<unbound>");
375 void EMBEDDED_PDV_identification::set_param(Module_Param
& param
)
377 param
.basic_check(Module_Param::BC_VALUE
, "union value");
378 Module_Param_Ptr mp
= ¶m
;
379 if (param
.get_type() == Module_Param::MP_Reference
) {
380 mp
= param
.get_referenced_param();
382 if (mp
->get_type()==Module_Param::MP_Value_List
&& mp
->get_size()==0) return;
383 if (mp
->get_type()!=Module_Param::MP_Assignment_List
) {
384 param
.error("union value with field name was expected");
386 Module_Param
* mp_last
= mp
->get_elem(mp
->get_size()-1);
387 if (!strcmp(mp_last
->get_id()->get_name(), "syntaxes")) {
388 syntaxes().set_param(*mp_last
);
391 if (!strcmp(mp_last
->get_id()->get_name(), "syntax")) {
392 syntax().set_param(*mp_last
);
395 if (!strcmp(mp_last
->get_id()->get_name(), "presentation_context_id")) {
396 presentation__context__id().set_param(*mp_last
);
399 if (!strcmp(mp_last
->get_id()->get_name(), "context_negotiation")) {
400 context__negotiation().set_param(*mp_last
);
403 if (!strcmp(mp_last
->get_id()->get_name(), "transfer_syntax")) {
404 transfer__syntax().set_param(*mp_last
);
407 if (!strcmp(mp_last
->get_id()->get_name(), "fixed")) {
408 fixed().set_param(*mp_last
);
411 mp_last
->error("Field %s does not exist in type EMBEDDED PDV.identification.", mp_last
->get_id()->get_name());
414 Module_Param
* EMBEDDED_PDV_identification::get_param(Module_Param_Name
& param_name
) const
417 return new Module_Param_Unbound();
419 Module_Param
* mp_field
= NULL
;
420 switch(get_selection()) {
422 mp_field
= field_syntaxes
->get_param(param_name
);
423 mp_field
->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
426 mp_field
= field_syntax
->get_param(param_name
);
427 mp_field
->set_id(new Module_Param_FieldName(mcopystr("syntax")));
429 case ALT_presentation__context__id
:
430 mp_field
= field_presentation__context__id
->get_param(param_name
);
431 mp_field
->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
433 case ALT_context__negotiation
:
434 mp_field
= field_context__negotiation
->get_param(param_name
);
435 mp_field
->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
437 case ALT_transfer__syntax
:
438 mp_field
= field_transfer__syntax
->get_param(param_name
);
439 mp_field
->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
442 mp_field
= field_fixed
->get_param(param_name
);
443 mp_field
->set_id(new Module_Param_FieldName(mcopystr("fixed")));
448 Module_Param_Assignment_List
* mp
= new Module_Param_Assignment_List();
449 mp
->add_elem(mp_field
);
453 void EMBEDDED_PDV_identification_template::set_param(Module_Param
& param
)
455 param
.basic_check(Module_Param::BC_TEMPLATE
, "union template");
456 Module_Param_Ptr mp
= ¶m
;
457 if (param
.get_type() == Module_Param::MP_Reference
) {
458 mp
= param
.get_referenced_param();
460 switch (mp
->get_type()) {
461 case Module_Param::MP_Omit
:
464 case Module_Param::MP_Any
:
467 case Module_Param::MP_AnyOrNone
:
470 case Module_Param::MP_List_Template
:
471 case Module_Param::MP_ComplementList_Template
: {
472 EMBEDDED_PDV_identification_template temp
;
473 temp
.set_type(mp
->get_type() == Module_Param::MP_List_Template
?
474 VALUE_LIST
: COMPLEMENTED_LIST
, mp
->get_size());
475 for (size_t i
=0; i
<mp
->get_size(); i
++) {
476 temp
.list_item(i
).set_param(*mp
->get_elem(i
));
480 case Module_Param::MP_Value_List
:
481 if (mp
->get_size()==0) break;
482 param
.type_error("union template", "EMBEDDED PDV.identification");
484 case Module_Param::MP_Assignment_List
: {
485 Module_Param
* mp_last
= mp
->get_elem(mp
->get_size()-1);
486 if (!strcmp(mp_last
->get_id()->get_name(), "syntaxes")) {
487 syntaxes().set_param(*mp_last
);
490 if (!strcmp(mp_last
->get_id()->get_name(), "syntax")) {
491 syntax().set_param(*mp_last
);
494 if (!strcmp(mp_last
->get_id()->get_name(), "presentation_context_id")) {
495 presentation__context__id().set_param(*mp_last
);
498 if (!strcmp(mp_last
->get_id()->get_name(), "context_negotiation")) {
499 context__negotiation().set_param(*mp_last
);
502 if (!strcmp(mp_last
->get_id()->get_name(), "transfer_syntax")) {
503 transfer__syntax().set_param(*mp_last
);
506 if (!strcmp(mp_last
->get_id()->get_name(), "fixed")) {
507 fixed().set_param(*mp_last
);
510 mp_last
->error("Field %s does not exist in type EMBEDDED PDV.identification.", mp_last
->get_id()->get_name());
513 param
.type_error("union template", "EMBEDDED PDV.identification");
515 is_ifpresent
= param
.get_ifpresent() || mp
->get_ifpresent();
518 Module_Param
* EMBEDDED_PDV_identification_template::get_param(Module_Param_Name
& param_name
) const
520 Module_Param
* mp
= NULL
;
521 switch (template_selection
) {
522 case UNINITIALIZED_TEMPLATE
:
523 mp
= new Module_Param_Unbound();
526 mp
= new Module_Param_Omit();
529 mp
= new Module_Param_Any();
532 mp
= new Module_Param_AnyOrNone();
534 case SPECIFIC_VALUE
: {
535 Module_Param
* mp_field
= NULL
;
536 switch(single_value
.union_selection
) {
537 case EMBEDDED_PDV_identification::ALT_syntaxes
:
538 mp_field
= single_value
.field_syntaxes
->get_param(param_name
);
539 mp_field
->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
541 case EMBEDDED_PDV_identification::ALT_syntax
:
542 mp_field
= single_value
.field_syntax
->get_param(param_name
);
543 mp_field
->set_id(new Module_Param_FieldName(mcopystr("syntax")));
545 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
546 mp_field
= single_value
.field_presentation__context__id
->get_param(param_name
);
547 mp_field
->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
549 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
550 mp_field
= single_value
.field_context__negotiation
->get_param(param_name
);
551 mp_field
->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
553 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
554 mp_field
= single_value
.field_transfer__syntax
->get_param(param_name
);
555 mp_field
->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
557 case EMBEDDED_PDV_identification::ALT_fixed
:
558 mp_field
= single_value
.field_fixed
->get_param(param_name
);
559 mp_field
->set_id(new Module_Param_FieldName(mcopystr("fixed")));
564 mp
= new Module_Param_Assignment_List();
565 mp
->add_elem(mp_field
);
568 case COMPLEMENTED_LIST
: {
569 if (template_selection
== VALUE_LIST
) {
570 mp
= new Module_Param_List_Template();
573 mp
= new Module_Param_ComplementList_Template();
575 for (size_t i
= 0; i
< value_list
.n_values
; ++i
) {
576 mp
->add_elem(value_list
.list_value
[i
].get_param(param_name
));
588 void EMBEDDED_PDV_identification::encode_text(Text_Buf
& text_buf
) const
590 text_buf
.push_int(union_selection
);
591 switch (union_selection
) {
593 field_syntaxes
->encode_text(text_buf
);
596 field_syntax
->encode_text(text_buf
);
598 case ALT_presentation__context__id
:
599 field_presentation__context__id
->encode_text(text_buf
);
601 case ALT_context__negotiation
:
602 field_context__negotiation
->encode_text(text_buf
);
604 case ALT_transfer__syntax
:
605 field_transfer__syntax
->encode_text(text_buf
);
608 field_fixed
->encode_text(text_buf
);
611 TTCN_error("Text encoder: Encoding an unbound value of union type EMBEDDED PDV.identification.");
615 void EMBEDDED_PDV_identification::decode_text(Text_Buf
& text_buf
)
617 switch ((union_selection_type
)text_buf
.pull_int().get_val()) {
619 syntaxes().decode_text(text_buf
);
622 syntax().decode_text(text_buf
);
624 case ALT_presentation__context__id
:
625 presentation__context__id().decode_text(text_buf
);
627 case ALT_context__negotiation
:
628 context__negotiation().decode_text(text_buf
);
630 case ALT_transfer__syntax
:
631 transfer__syntax().decode_text(text_buf
);
634 fixed().decode_text(text_buf
);
637 TTCN_error("Text decoder: Unrecognized union selector was received for type EMBEDDED PDV.identification.");
641 // No encode/decode for this implementation class
642 //void EMBEDDED_PDV_identification::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const
643 //void EMBEDDED_PDV_identification::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
645 ASN_BER_TLV_t
*EMBEDDED_PDV_identification::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
648 ASN_BER_TLV_t
*new_tlv
;
649 TTCN_EncDec_ErrorContext
ec_0("Alternative '");
650 TTCN_EncDec_ErrorContext ec_1
;
651 switch (union_selection
) {
653 ec_1
.set_msg("syntaxes': ");
654 new_tlv
= field_syntaxes
->BER_encode_TLV(EMBEDDED_PDV_identification_syntaxes_descr_
, p_coding
);
657 ec_1
.set_msg("syntax': ");
658 new_tlv
= field_syntax
->BER_encode_TLV(EMBEDDED_PDV_identification_syntax_descr_
, p_coding
);
660 case ALT_presentation__context__id
:
661 ec_1
.set_msg("presentation_context_id': ");
662 new_tlv
= field_presentation__context__id
->BER_encode_TLV(EMBEDDED_PDV_identification_presentation__context__id_descr_
, p_coding
);
664 case ALT_context__negotiation
:
665 ec_1
.set_msg("context_negotiation': ");
666 new_tlv
= field_context__negotiation
->BER_encode_TLV(EMBEDDED_PDV_identification_context__negotiation_descr_
, p_coding
);
668 case ALT_transfer__syntax
:
669 ec_1
.set_msg("transfer_syntax': ");
670 new_tlv
= field_transfer__syntax
->BER_encode_TLV(EMBEDDED_PDV_identification_transfer__syntax_descr_
, p_coding
);
673 ec_1
.set_msg("fixed': ");
674 new_tlv
= field_fixed
->BER_encode_TLV(EMBEDDED_PDV_identification_fixed_descr_
, p_coding
);
677 new_tlv
= BER_encode_chk_bound(FALSE
);
680 TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
684 return ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
687 boolean
EMBEDDED_PDV_identification::BER_decode_set_selection(const ASN_BER_TLV_t
& p_tlv
)
690 field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes
;
691 union_selection
= ALT_syntaxes
;
692 if (field_syntaxes
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_syntaxes_descr_
, p_tlv
)) return TRUE
;
693 delete field_syntaxes
;
694 field_syntax
= new OBJID
;
695 union_selection
= ALT_syntax
;
696 if (field_syntax
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_syntax_descr_
, p_tlv
)) return TRUE
;
698 field_presentation__context__id
= new INTEGER
;
699 union_selection
= ALT_presentation__context__id
;
700 if (field_presentation__context__id
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_presentation__context__id_descr_
, p_tlv
)) return TRUE
;
701 delete field_presentation__context__id
;
702 field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation
;
703 union_selection
= ALT_context__negotiation
;
704 if (field_context__negotiation
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_context__negotiation_descr_
, p_tlv
)) return TRUE
;
705 delete field_context__negotiation
;
706 field_transfer__syntax
= new OBJID
;
707 union_selection
= ALT_transfer__syntax
;
708 if (field_transfer__syntax
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_transfer__syntax_descr_
, p_tlv
)) return TRUE
;
709 delete field_transfer__syntax
;
710 field_fixed
= new ASN_NULL
;
711 union_selection
= ALT_fixed
;
712 if (field_fixed
->BER_decode_isMyMsg(EMBEDDED_PDV_identification_fixed_descr_
, p_tlv
)) return TRUE
;
714 union_selection
= UNBOUND_VALUE
;
718 boolean
EMBEDDED_PDV_identification::BER_decode_isMyMsg(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
)
720 if (p_td
.ber
->n_tags
== 0) {
721 EMBEDDED_PDV_identification tmp_type
;
722 return tmp_type
.BER_decode_set_selection(p_tlv
);
723 } else return Base_Type::BER_decode_isMyMsg(p_td
, p_tlv
);
726 boolean
EMBEDDED_PDV_identification::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
729 ASN_BER_TLV_t stripped_tlv
;
730 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
731 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EMBEDDED PDV.identification' type: ");
732 ASN_BER_TLV_t tmp_tlv
;
733 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
)) return FALSE
;
734 TTCN_EncDec_ErrorContext
ec_1("Alternative '");
735 TTCN_EncDec_ErrorContext ec_2
;
736 switch (union_selection
) {
738 ec_2
.set_msg("syntaxes': ");
739 field_syntaxes
->BER_decode_TLV(EMBEDDED_PDV_identification_syntaxes_descr_
, tmp_tlv
, L_form
);
742 ec_2
.set_msg("syntax': ");
743 field_syntax
->BER_decode_TLV(EMBEDDED_PDV_identification_syntax_descr_
, tmp_tlv
, L_form
);
745 case ALT_presentation__context__id
:
746 ec_2
.set_msg("presentation_context_id': ");
747 field_presentation__context__id
->BER_decode_TLV(EMBEDDED_PDV_identification_presentation__context__id_descr_
, tmp_tlv
, L_form
);
749 case ALT_context__negotiation
:
750 ec_2
.set_msg("context_negotiation': ");
751 field_context__negotiation
->BER_decode_TLV(EMBEDDED_PDV_identification_context__negotiation_descr_
, tmp_tlv
, L_form
);
753 case ALT_transfer__syntax
:
754 ec_2
.set_msg("transfer_syntax': ");
755 field_transfer__syntax
->BER_decode_TLV(EMBEDDED_PDV_identification_transfer__syntax_descr_
, tmp_tlv
, L_form
);
758 ec_2
.set_msg("fixed': ");
759 field_fixed
->BER_decode_TLV(EMBEDDED_PDV_identification_fixed_descr_
, tmp_tlv
, L_form
);
767 // FIXME maybe: XER_encode and decode is virtually identical to CHARACTER_STRING
769 int EMBEDDED_PDV_identification::XER_encode(const XERdescriptor_t
& p_td
,
770 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
772 int indenting
= !is_canonical(flavor
);
773 int exer
= is_exer(flavor
);
774 int encoded_length
=(int)p_buf
.get_len();
775 if (indenting
) do_indent(p_buf
, indent
);
777 if (exer
) write_ns_prefix(p_td
, p_buf
);
778 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
781 switch (union_selection
) {
783 field_syntaxes
->XER_encode(EMBEDDED_PDV_identification_sxs_xer_
, p_buf
, flavor
, indent
, 0);;
786 field_syntax
->XER_encode(EMBEDDED_PDV_identification_sx_xer_
, p_buf
, flavor
, indent
, 0);;
788 case ALT_presentation__context__id
:
789 field_presentation__context__id
->XER_encode(EMBEDDED_PDV_identification_pci_xer_
, p_buf
, flavor
, indent
, 0);;
791 case ALT_context__negotiation
:
792 field_context__negotiation
->XER_encode(EMBEDDED_PDV_identification_cn_xer_
, p_buf
, flavor
, indent
, 0);;
794 case ALT_transfer__syntax
:
795 field_transfer__syntax
->XER_encode(EMBEDDED_PDV_identification_ts_xer_
, p_buf
, flavor
, indent
, 0);;
798 field_fixed
->XER_encode(EMBEDDED_PDV_identification_fix_xer_
, p_buf
, flavor
, indent
, 0);;
801 TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
805 if (indenting
) do_indent(p_buf
, --indent
);
808 if (exer
) write_ns_prefix(p_td
, p_buf
);
809 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
810 return (int)p_buf
.get_len() - encoded_length
;
813 int EMBEDDED_PDV_identification::XER_decode(const XERdescriptor_t
& p_td
,
814 XmlReaderWrap
& reader
, unsigned int flavor
, unsigned int flavor2
, embed_values_dec_struct_t
*)
816 int exer
= is_exer(flavor
);
817 // we are supposed to be parked on our element
818 for (int success
= 1; success
== 1; success
= reader
.Read()) {
819 int type
= reader
.NodeType();
821 case XML_READER_TYPE_ELEMENT
: {
822 if (verify_name(reader
, p_td
, exer
)) {
824 for (success
= reader
.Read(); success
== 1; success
= reader
.Read()) {
825 type
= reader
.NodeType();
826 if (XML_READER_TYPE_ELEMENT
== type
) break;
827 else if (XML_READER_TYPE_END_ELEMENT
== type
) goto bail
;
829 const char *name
= (const char*)reader
.Name();
830 // Avoid chained if-else on strcmp. Use the length as a hash.
831 size_t namelen
= strlen(name
);
834 syntaxes().XER_decode(EMBEDDED_PDV_identification_sxs_xer_
, reader
, flavor
, flavor2
, 0);
838 syntax().XER_decode(EMBEDDED_PDV_identification_sx_xer_
, reader
, flavor
, flavor2
, 0);
841 case 23: // presentation-context-id
842 presentation__context__id().XER_decode(EMBEDDED_PDV_identification_pci_xer_
, reader
, flavor
, flavor2
, 0);
845 case 19: // context-negotiation
846 context__negotiation().XER_decode(EMBEDDED_PDV_identification_cn_xer_
, reader
, flavor
, flavor2
, 0);
849 case 15: // transfer-syntax
850 transfer__syntax().XER_decode(EMBEDDED_PDV_identification_ts_xer_
, reader
, flavor
, flavor2
, 0);
854 fixed().XER_decode(EMBEDDED_PDV_identification_fix_xer_
, reader
, flavor
, flavor2
, 0);
861 else { // it belongs to somebody else
865 case XML_READER_TYPE_END_ELEMENT
: {
866 // advance to the next thing and bail
875 /******************** EMBEDDED_PDV_identification_template ********************/
877 void EMBEDDED_PDV_identification_template::clean_up()
879 switch (template_selection
) {
881 switch (single_value
.union_selection
) {
882 case EMBEDDED_PDV_identification::ALT_syntaxes
:
883 delete single_value
.field_syntaxes
;
885 case EMBEDDED_PDV_identification::ALT_syntax
:
886 delete single_value
.field_syntax
;
888 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
889 delete single_value
.field_presentation__context__id
;
891 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
892 delete single_value
.field_context__negotiation
;
894 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
895 delete single_value
.field_transfer__syntax
;
897 case EMBEDDED_PDV_identification::ALT_fixed
:
898 delete single_value
.field_fixed
;
905 case COMPLEMENTED_LIST
:
906 delete [] value_list
.list_value
;
911 template_selection
= UNINITIALIZED_TEMPLATE
;
914 void EMBEDDED_PDV_identification_template::copy_value(const EMBEDDED_PDV_identification
& other_value
)
916 single_value
.union_selection
= other_value
.get_selection();
917 switch (single_value
.union_selection
) {
918 case EMBEDDED_PDV_identification::ALT_syntaxes
:
919 single_value
.field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes_template(other_value
.syntaxes());
921 case EMBEDDED_PDV_identification::ALT_syntax
:
922 single_value
.field_syntax
= new OBJID_template(other_value
.syntax());
924 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
925 single_value
.field_presentation__context__id
= new INTEGER_template(other_value
.presentation__context__id());
927 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
928 single_value
.field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation_template(other_value
.context__negotiation());
930 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
931 single_value
.field_transfer__syntax
= new OBJID_template(other_value
.transfer__syntax());
933 case EMBEDDED_PDV_identification::ALT_fixed
:
934 single_value
.field_fixed
= new ASN_NULL_template(other_value
.fixed());
937 TTCN_error("Initializing a template with an unbound value of type EMBEDDED PDV.identification.");
939 set_selection(SPECIFIC_VALUE
);
942 void EMBEDDED_PDV_identification_template::copy_template(const EMBEDDED_PDV_identification_template
& other_value
)
944 switch (other_value
.template_selection
) {
946 single_value
.union_selection
= other_value
.single_value
.union_selection
;
947 switch (single_value
.union_selection
) {
948 case EMBEDDED_PDV_identification::ALT_syntaxes
:
949 single_value
.field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes_template(*other_value
.single_value
.field_syntaxes
);
951 case EMBEDDED_PDV_identification::ALT_syntax
:
952 single_value
.field_syntax
= new OBJID_template(*other_value
.single_value
.field_syntax
);
954 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
955 single_value
.field_presentation__context__id
= new INTEGER_template(*other_value
.single_value
.field_presentation__context__id
);
957 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
958 single_value
.field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation_template(*other_value
.single_value
.field_context__negotiation
);
960 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
961 single_value
.field_transfer__syntax
= new OBJID_template(*other_value
.single_value
.field_transfer__syntax
);
963 case EMBEDDED_PDV_identification::ALT_fixed
:
964 single_value
.field_fixed
= new ASN_NULL_template(*other_value
.single_value
.field_fixed
);
967 TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type EMBEDDED PDV.identification.");
975 case COMPLEMENTED_LIST
:
976 value_list
.n_values
= other_value
.value_list
.n_values
;
977 value_list
.list_value
= new EMBEDDED_PDV_identification_template
[value_list
.n_values
];
978 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
979 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
982 TTCN_error("Copying an uninitialized template of union type EMBEDDED PDV.identification.");
984 set_selection(other_value
);
987 EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template()
991 EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template(template_sel other_value
)
992 : Base_Template(other_value
)
994 check_single_selection(other_value
);
997 EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template(const EMBEDDED_PDV_identification
& other_value
)
999 copy_value(other_value
);
1002 EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template(const OPTIONAL
<EMBEDDED_PDV_identification
>& other_value
)
1004 switch (other_value
.get_selection()) {
1005 case OPTIONAL_PRESENT
:
1006 copy_value((const EMBEDDED_PDV_identification
&)other_value
);
1009 set_selection(OMIT_VALUE
);
1012 TTCN_error("Creating a template of union type EMBEDDED PDV.identification from an unbound optional field.");
1016 EMBEDDED_PDV_identification_template::EMBEDDED_PDV_identification_template(const EMBEDDED_PDV_identification_template
& other_value
)
1019 copy_template(other_value
);
1022 EMBEDDED_PDV_identification_template::~EMBEDDED_PDV_identification_template()
1027 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_identification_template::operator=(template_sel other_value
)
1029 check_single_selection(other_value
);
1031 set_selection(other_value
);
1035 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_identification_template::operator=(const EMBEDDED_PDV_identification
& other_value
)
1038 copy_value(other_value
);
1042 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_identification_template::operator=(const OPTIONAL
<EMBEDDED_PDV_identification
>& other_value
)
1045 switch (other_value
.get_selection()) {
1046 case OPTIONAL_PRESENT
:
1047 copy_value((const EMBEDDED_PDV_identification
&)other_value
);
1050 set_selection(OMIT_VALUE
);
1053 TTCN_error("Assignment of an unbound optional field to a template of union type EMBEDDED PDV.identification.");
1058 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_identification_template::operator=(const EMBEDDED_PDV_identification_template
& other_value
)
1060 if (&other_value
!= this) {
1062 copy_template(other_value
);
1067 boolean
EMBEDDED_PDV_identification_template::match(const EMBEDDED_PDV_identification
& other_value
,
1068 boolean
/* legacy */) const
1070 switch (template_selection
) {
1076 case SPECIFIC_VALUE
:
1078 EMBEDDED_PDV_identification::union_selection_type value_selection
= other_value
.get_selection();
1079 if (value_selection
== EMBEDDED_PDV_identification::UNBOUND_VALUE
) return FALSE
;
1080 if (value_selection
!= single_value
.union_selection
) return FALSE
;
1081 switch (value_selection
) {
1082 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1083 return single_value
.field_syntaxes
->match(other_value
.syntaxes());
1084 case EMBEDDED_PDV_identification::ALT_syntax
:
1085 return single_value
.field_syntax
->match(other_value
.syntax());
1086 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1087 return single_value
.field_presentation__context__id
->match(other_value
.presentation__context__id());
1088 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1089 return single_value
.field_context__negotiation
->match(other_value
.context__negotiation());
1090 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1091 return single_value
.field_transfer__syntax
->match(other_value
.transfer__syntax());
1092 case EMBEDDED_PDV_identification::ALT_fixed
:
1093 return single_value
.field_fixed
->match(other_value
.fixed());
1095 TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type EMBEDDED PDV.identification.");
1098 break; // should never get here
1100 case COMPLEMENTED_LIST
:
1101 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1102 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
1103 return template_selection
== COMPLEMENTED_LIST
;
1105 TTCN_error ("Matching an uninitialized template of union type EMBEDDED PDV.identification.");
1110 EMBEDDED_PDV_identification
EMBEDDED_PDV_identification_template::valueof() const
1112 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
1113 TTCN_error("Performing valueof or send operation on a non-specific template of union type EMBEDDED PDV.identification.");
1114 EMBEDDED_PDV_identification ret_val
;
1115 switch (single_value
.union_selection
) {
1116 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1117 ret_val
.syntaxes() = single_value
.field_syntaxes
->valueof();
1119 case EMBEDDED_PDV_identification::ALT_syntax
:
1120 ret_val
.syntax() = single_value
.field_syntax
->valueof();
1122 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1123 ret_val
.presentation__context__id() = single_value
.field_presentation__context__id
->valueof();
1125 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1126 ret_val
.context__negotiation() = single_value
.field_context__negotiation
->valueof();
1128 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1129 ret_val
.transfer__syntax() = single_value
.field_transfer__syntax
->valueof();
1131 case EMBEDDED_PDV_identification::ALT_fixed
:
1132 ret_val
.fixed() = single_value
.field_fixed
->valueof();
1135 TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type EMBEDDED PDV.identification.");
1140 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_identification_template::list_item(unsigned int list_index
) const
1142 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 EMBEDDED PDV.identification.");
1143 if (list_index
>= value_list
.n_values
) TTCN_error("Internal error: Index overflow in a value list template of union type EMBEDDED PDV.identification.");
1144 return value_list
.list_value
[list_index
];
1146 void EMBEDDED_PDV_identification_template::set_type(template_sel template_type
, unsigned int list_length
)
1148 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
) TTCN_error ("Internal error: Setting an invalid list for a template of union type EMBEDDED PDV.identification.");
1150 set_selection(template_type
);
1151 value_list
.n_values
= list_length
;
1152 value_list
.list_value
= new EMBEDDED_PDV_identification_template
[list_length
];
1155 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_template::syntaxes()
1157 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_syntaxes
) {
1158 template_sel old_selection
= template_selection
;
1160 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes_template(ANY_VALUE
);
1161 else single_value
.field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes_template
;
1162 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_syntaxes
;
1163 set_selection(SPECIFIC_VALUE
);
1165 return *single_value
.field_syntaxes
;
1168 const EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_template::syntaxes() const
1170 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field syntaxes in a non-specific template of union type EMBEDDED PDV.identification.");
1171 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_syntaxes
) TTCN_error("Accessing non-selected field syntaxes in a template of union type EMBEDDED PDV.identification.");
1172 return *single_value
.field_syntaxes
;
1175 OBJID_template
& EMBEDDED_PDV_identification_template::syntax()
1177 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_syntax
) {
1178 template_sel old_selection
= template_selection
;
1180 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_syntax
= new OBJID_template(ANY_VALUE
);
1181 else single_value
.field_syntax
= new OBJID_template
;
1182 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_syntax
;
1183 set_selection(SPECIFIC_VALUE
);
1185 return *single_value
.field_syntax
;
1188 const OBJID_template
& EMBEDDED_PDV_identification_template::syntax() const
1190 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field syntax in a non-specific template of union type EMBEDDED PDV.identification.");
1191 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_syntax
) TTCN_error("Accessing non-selected field syntax in a template of union type EMBEDDED PDV.identification.");
1192 return *single_value
.field_syntax
;
1195 INTEGER_template
& EMBEDDED_PDV_identification_template::presentation__context__id()
1197 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_presentation__context__id
) {
1198 template_sel old_selection
= template_selection
;
1200 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_presentation__context__id
= new INTEGER_template(ANY_VALUE
);
1201 else single_value
.field_presentation__context__id
= new INTEGER_template
;
1202 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_presentation__context__id
;
1203 set_selection(SPECIFIC_VALUE
);
1205 return *single_value
.field_presentation__context__id
;
1208 const INTEGER_template
& EMBEDDED_PDV_identification_template::presentation__context__id() const
1210 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field presentation_context_id in a non-specific template of union type EMBEDDED PDV.identification.");
1211 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_presentation__context__id
) TTCN_error("Accessing non-selected field presentation_context_id in a template of union type EMBEDDED PDV.identification.");
1212 return *single_value
.field_presentation__context__id
;
1215 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_template::context__negotiation()
1217 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_context__negotiation
) {
1218 template_sel old_selection
= template_selection
;
1220 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation_template(ANY_VALUE
);
1221 else single_value
.field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation_template
;
1222 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_context__negotiation
;
1223 set_selection(SPECIFIC_VALUE
);
1225 return *single_value
.field_context__negotiation
;
1228 const EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_template::context__negotiation() const
1230 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field context_negotiation in a non-specific template of union type EMBEDDED PDV.identification.");
1231 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_context__negotiation
) TTCN_error("Accessing non-selected field context_negotiation in a template of union type EMBEDDED PDV.identification.");
1232 return *single_value
.field_context__negotiation
;
1235 OBJID_template
& EMBEDDED_PDV_identification_template::transfer__syntax()
1237 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_transfer__syntax
) {
1238 template_sel old_selection
= template_selection
;
1240 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_transfer__syntax
= new OBJID_template(ANY_VALUE
);
1241 else single_value
.field_transfer__syntax
= new OBJID_template
;
1242 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_transfer__syntax
;
1243 set_selection(SPECIFIC_VALUE
);
1245 return *single_value
.field_transfer__syntax
;
1248 const OBJID_template
& EMBEDDED_PDV_identification_template::transfer__syntax() const
1250 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field transfer_syntax in a non-specific template of union type EMBEDDED PDV.identification.");
1251 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_transfer__syntax
) TTCN_error("Accessing non-selected field transfer_syntax in a template of union type EMBEDDED PDV.identification.");
1252 return *single_value
.field_transfer__syntax
;
1255 ASN_NULL_template
& EMBEDDED_PDV_identification_template::fixed()
1257 if (template_selection
!= SPECIFIC_VALUE
|| single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_fixed
) {
1258 template_sel old_selection
= template_selection
;
1260 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) single_value
.field_fixed
= new ASN_NULL_template(ANY_VALUE
);
1261 else single_value
.field_fixed
= new ASN_NULL_template
;
1262 single_value
.union_selection
= EMBEDDED_PDV_identification::ALT_fixed
;
1263 set_selection(SPECIFIC_VALUE
);
1265 return *single_value
.field_fixed
;
1268 const ASN_NULL_template
& EMBEDDED_PDV_identification_template::fixed() const
1270 if (template_selection
!= SPECIFIC_VALUE
) TTCN_error("Accessing field fixed in a non-specific template of union type EMBEDDED PDV.identification.");
1271 if (single_value
.union_selection
!= EMBEDDED_PDV_identification::ALT_fixed
) TTCN_error("Accessing non-selected field fixed in a template of union type EMBEDDED PDV.identification.");
1272 return *single_value
.field_fixed
;
1275 boolean
EMBEDDED_PDV_identification_template::ischosen(EMBEDDED_PDV_identification::union_selection_type checked_selection
) const
1277 if (checked_selection
== EMBEDDED_PDV_identification::UNBOUND_VALUE
) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type EMBEDDED PDV.identification.");
1278 switch (template_selection
) {
1279 case SPECIFIC_VALUE
:
1280 if (single_value
.union_selection
== EMBEDDED_PDV_identification::UNBOUND_VALUE
) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type EMBEDDED PDV.identification.");
1281 return single_value
.union_selection
== checked_selection
;
1284 if (value_list
.n_values
< 1)
1285 TTCN_error("Internal error: Performing ischosen() operation on a template of union type EMBEDDED PDV.identification containing an empty list.");
1286 boolean ret_val
= value_list
.list_value
[0].ischosen(checked_selection
);
1287 boolean all_same
= TRUE
;
1288 for (unsigned int list_count
= 1; list_count
< value_list
.n_values
; list_count
++) {
1289 if (value_list
.list_value
[list_count
].ischosen(checked_selection
) != ret_val
) {
1294 if (all_same
) return ret_val
;
1296 // FIXME really no break?
1300 case COMPLEMENTED_LIST
:
1301 TTCN_error("Performing ischosen() operation on a template of union type EMBEDDED PDV.identification, which does not determine unambiguously the chosen field of the matching values.");
1303 TTCN_error("Performing ischosen() operation on an uninitialized template of union type EMBEDDED PDV.identification");
1308 void EMBEDDED_PDV_identification_template::log() const
1310 switch (template_selection
) {
1311 case SPECIFIC_VALUE
:
1312 switch (single_value
.union_selection
) {
1313 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1314 TTCN_Logger::log_event_str("{ syntaxes := ");
1315 single_value
.field_syntaxes
->log();
1316 TTCN_Logger::log_event_str(" }");
1318 case EMBEDDED_PDV_identification::ALT_syntax
:
1319 TTCN_Logger::log_event_str("{ syntax := ");
1320 single_value
.field_syntax
->log();
1321 TTCN_Logger::log_event_str(" }");
1323 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1324 TTCN_Logger::log_event_str("{ presentation_context_id := ");
1325 single_value
.field_presentation__context__id
->log();
1326 TTCN_Logger::log_event_str(" }");
1328 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1329 TTCN_Logger::log_event_str("{ context_negotiation := ");
1330 single_value
.field_context__negotiation
->log();
1331 TTCN_Logger::log_event_str(" }");
1333 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1334 TTCN_Logger::log_event_str("{ transfer_syntax := ");
1335 single_value
.field_transfer__syntax
->log();
1336 TTCN_Logger::log_event_str(" }");
1338 case EMBEDDED_PDV_identification::ALT_fixed
:
1339 TTCN_Logger::log_event_str("{ fixed := ");
1340 single_value
.field_fixed
->log();
1341 TTCN_Logger::log_event_str(" }");
1344 TTCN_Logger::log_event_str("<invalid selector>");
1348 case COMPLEMENTED_LIST
:
1349 TTCN_Logger::log_event_str("complement ");
1352 TTCN_Logger::log_char('(');
1353 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
1354 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
1355 value_list
.list_value
[list_count
].log();
1357 TTCN_Logger::log_char(')');
1366 void EMBEDDED_PDV_identification_template::log_match(const EMBEDDED_PDV_identification
& match_value
,
1367 boolean
/* legacy */) const
1369 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1370 if(match(match_value
)){
1371 TTCN_Logger::print_logmatch_buffer();
1372 TTCN_Logger::log_event_str(" matched ");
1376 if (template_selection
== SPECIFIC_VALUE
&& single_value
.union_selection
== match_value
.get_selection()) {
1377 switch (single_value
.union_selection
) {
1378 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1379 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1380 TTCN_Logger::log_logmatch_info(".syntaxes");
1381 single_value
.field_syntaxes
->log_match(match_value
.syntaxes());
1383 TTCN_Logger::log_event_str("{ syntaxes := ");
1384 single_value
.field_syntaxes
->log_match(match_value
.syntaxes());
1385 TTCN_Logger::log_event_str(" }");
1388 case EMBEDDED_PDV_identification::ALT_syntax
:
1389 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1390 TTCN_Logger::log_logmatch_info(".syntax");
1391 single_value
.field_syntax
->log_match(match_value
.syntax());
1393 TTCN_Logger::log_event_str("{ syntax := ");
1394 single_value
.field_syntax
->log_match(match_value
.syntax());
1395 TTCN_Logger::log_event_str(" }");
1398 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1399 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1400 TTCN_Logger::log_logmatch_info(".presentation_context_id");
1401 single_value
.field_presentation__context__id
->log_match(match_value
.presentation__context__id());
1403 TTCN_Logger::log_event_str("{ presentation_context_id := ");
1404 single_value
.field_presentation__context__id
->log_match(match_value
.presentation__context__id());
1405 TTCN_Logger::log_event_str(" }");
1408 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1409 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1410 TTCN_Logger::log_logmatch_info(".context_negotiation");
1411 single_value
.field_context__negotiation
->log_match(match_value
.context__negotiation());
1413 TTCN_Logger::log_event_str("{ context_negotiation := ");
1414 single_value
.field_context__negotiation
->log_match(match_value
.context__negotiation());
1415 TTCN_Logger::log_event_str(" }");
1418 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1419 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1420 TTCN_Logger::log_logmatch_info(".transfer_syntax");
1421 single_value
.field_transfer__syntax
->log_match(match_value
.transfer__syntax());
1423 TTCN_Logger::log_event_str("{ transfer_syntax := ");
1424 single_value
.field_transfer__syntax
->log_match(match_value
.transfer__syntax());
1425 TTCN_Logger::log_event_str(" }");
1428 case EMBEDDED_PDV_identification::ALT_fixed
:
1429 if(TTCN_Logger::VERBOSITY_COMPACT
== TTCN_Logger::get_matching_verbosity()){
1430 TTCN_Logger::log_logmatch_info(".fixed");
1431 single_value
.field_fixed
->log_match(match_value
.fixed());
1433 TTCN_Logger::log_event_str("{ fixed := ");
1434 single_value
.field_fixed
->log_match(match_value
.fixed());
1435 TTCN_Logger::log_event_str(" }");
1439 TTCN_Logger::print_logmatch_buffer();
1440 TTCN_Logger::log_event_str("<invalid selector>");
1443 TTCN_Logger::print_logmatch_buffer();
1445 TTCN_Logger::log_event_str(" with ");
1447 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
1448 else TTCN_Logger::log_event_str(" unmatched");
1452 void EMBEDDED_PDV_identification_template::encode_text(Text_Buf
& text_buf
) const
1454 encode_text_base(text_buf
);
1455 switch (template_selection
) {
1456 case SPECIFIC_VALUE
:
1457 text_buf
.push_int(single_value
.union_selection
);
1458 switch (single_value
.union_selection
) {
1459 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1460 single_value
.field_syntaxes
->encode_text(text_buf
);
1462 case EMBEDDED_PDV_identification::ALT_syntax
:
1463 single_value
.field_syntax
->encode_text(text_buf
);
1465 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1466 single_value
.field_presentation__context__id
->encode_text(text_buf
);
1468 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1469 single_value
.field_context__negotiation
->encode_text(text_buf
);
1471 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1472 single_value
.field_transfer__syntax
->encode_text(text_buf
);
1474 case EMBEDDED_PDV_identification::ALT_fixed
:
1475 single_value
.field_fixed
->encode_text(text_buf
);
1478 TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type EMBEDDED PDV.identification.");
1486 case COMPLEMENTED_LIST
:
1487 text_buf
.push_int(value_list
.n_values
);
1488 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1489 value_list
.list_value
[list_count
].encode_text(text_buf
);
1492 TTCN_error("Text encoder: Encoding an uninitialized template of type EMBEDDED PDV.identification.");
1496 void EMBEDDED_PDV_identification_template::decode_text(Text_Buf
& text_buf
)
1499 decode_text_base(text_buf
);
1500 switch (template_selection
) {
1501 case SPECIFIC_VALUE
:
1503 single_value
.union_selection
= EMBEDDED_PDV_identification::UNBOUND_VALUE
;
1504 EMBEDDED_PDV_identification::union_selection_type new_selection
= (EMBEDDED_PDV_identification::union_selection_type
)text_buf
.pull_int().get_val();
1505 switch (new_selection
) {
1506 case EMBEDDED_PDV_identification::ALT_syntaxes
:
1507 single_value
.field_syntaxes
= new EMBEDDED_PDV_identification_syntaxes_template
;
1508 single_value
.field_syntaxes
->decode_text(text_buf
);
1510 case EMBEDDED_PDV_identification::ALT_syntax
:
1511 single_value
.field_syntax
= new OBJID_template
;
1512 single_value
.field_syntax
->decode_text(text_buf
);
1514 case EMBEDDED_PDV_identification::ALT_presentation__context__id
:
1515 single_value
.field_presentation__context__id
= new INTEGER_template
;
1516 single_value
.field_presentation__context__id
->decode_text(text_buf
);
1518 case EMBEDDED_PDV_identification::ALT_context__negotiation
:
1519 single_value
.field_context__negotiation
= new EMBEDDED_PDV_identification_context__negotiation_template
;
1520 single_value
.field_context__negotiation
->decode_text(text_buf
);
1522 case EMBEDDED_PDV_identification::ALT_transfer__syntax
:
1523 single_value
.field_transfer__syntax
= new OBJID_template
;
1524 single_value
.field_transfer__syntax
->decode_text(text_buf
);
1526 case EMBEDDED_PDV_identification::ALT_fixed
:
1527 single_value
.field_fixed
= new ASN_NULL_template
;
1528 single_value
.field_fixed
->decode_text(text_buf
);
1531 TTCN_error("Text decoder: Unrecognized union selector was received for a template of type EMBEDDED PDV.identification.");
1533 single_value
.union_selection
= new_selection
;
1541 case COMPLEMENTED_LIST
:
1542 value_list
.n_values
= text_buf
.pull_int().get_val();
1543 value_list
.list_value
= new EMBEDDED_PDV_identification_template
[value_list
.n_values
];
1544 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1545 value_list
.list_value
[list_count
].decode_text(text_buf
);
1548 TTCN_error("Text decoder: Unrecognized selector was received in a template of type EMBEDDED PDV.identification.");
1552 boolean
EMBEDDED_PDV_identification_template::is_present(boolean legacy
/* = FALSE */) const
1554 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
1555 return !match_omit(legacy
);
1558 boolean
EMBEDDED_PDV_identification_template::match_omit(boolean legacy
/* = FALSE */) const
1560 if (is_ifpresent
) return TRUE
;
1561 switch (template_selection
) {
1566 case COMPLEMENTED_LIST
:
1568 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
1569 if (value_list
.list_value
[i
].match_omit())
1570 return template_selection
==VALUE_LIST
;
1571 return template_selection
==COMPLEMENTED_LIST
;
1572 } // else fall through
1579 #ifndef TITAN_RUNTIME_2
1580 void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res
, const char* t_name
,
1581 boolean legacy
/* = FALSE */) const
1583 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
1584 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
1586 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
1589 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
1590 template_selection
==SPECIFIC_VALUE
)) return;
1593 if (!match_omit(legacy
)) return;
1598 TTCN_error("Restriction `%s' on template of type %s violated.",
1599 get_res_name(t_res
), t_name
? t_name
: "EMBEDDED PDV.identification");
1603 EMBEDDED_PDV_identification_syntaxes::EMBEDDED_PDV_identification_syntaxes()
1607 EMBEDDED_PDV_identification_syntaxes::EMBEDDED_PDV_identification_syntaxes(const OBJID
& par_abstract
,
1608 const OBJID
& par_transfer
)
1609 : field_abstract(par_abstract
),
1610 field_transfer(par_transfer
)
1614 boolean
EMBEDDED_PDV_identification_syntaxes::operator==(const EMBEDDED_PDV_identification_syntaxes
& other_value
) const
1616 return field_abstract
==other_value
.field_abstract
1617 && field_transfer
==other_value
.field_transfer
;
1620 int EMBEDDED_PDV_identification_syntaxes::size_of() const
1626 void EMBEDDED_PDV_identification_syntaxes::log() const
1628 TTCN_Logger::log_event_str("{ abstract := ");
1629 field_abstract
.log();
1630 TTCN_Logger::log_event_str(", transfer := ");
1631 field_transfer
.log();
1632 TTCN_Logger::log_event_str(" }");
1635 boolean
EMBEDDED_PDV_identification_syntaxes::is_bound() const
1637 if(field_abstract
.is_bound()) return TRUE
;
1638 if(field_transfer
.is_bound()) return TRUE
;
1642 boolean
EMBEDDED_PDV_identification_syntaxes::is_value() const
1644 if(!field_abstract
.is_value()) return FALSE
;
1645 if(!field_transfer
.is_value()) return FALSE
;
1649 void EMBEDDED_PDV_identification_syntaxes::clean_up()
1651 field_abstract
.clean_up();
1652 field_transfer
.clean_up();
1655 void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param
& param
)
1657 param
.basic_check(Module_Param::BC_VALUE
, "record value");
1658 Module_Param_Ptr mp
= ¶m
;
1659 if (param
.get_type() == Module_Param::MP_Reference
) {
1660 mp
= param
.get_referenced_param();
1662 switch (mp
->get_type()) {
1663 case Module_Param::MP_Value_List
:
1664 if (mp
->get_size()==0) return;
1665 if (2!=mp
->get_size()) {
1666 param
.error("record value of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp
->get_size());
1668 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) abstract().set_param(*mp
->get_elem(0));
1669 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer().set_param(*mp
->get_elem(1));
1671 case Module_Param::MP_Assignment_List
: {
1672 Vector
<bool> value_used(mp
->get_size());
1673 value_used
.resize(mp
->get_size(), false);
1674 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
1675 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
1676 if (!strcmp(curr_param
->get_id()->get_name(), "abstract")) {
1677 abstract().set_param(*curr_param
);
1678 value_used
[val_idx
]=true;
1681 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
1682 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
1683 if (!strcmp(curr_param
->get_id()->get_name(), "transfer")) {
1684 transfer().set_param(*curr_param
);
1685 value_used
[val_idx
]=true;
1688 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
1689 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
1694 param
.type_error("record value", "EMBEDDED PDV.identification.syntaxes");
1698 Module_Param
* EMBEDDED_PDV_identification_syntaxes::get_param(Module_Param_Name
& param_name
) const
1701 return new Module_Param_Unbound();
1703 Module_Param
* mp_field_abstract
= field_abstract
.get_param(param_name
);
1704 mp_field_abstract
->set_id(new Module_Param_FieldName(mcopystr("abstract")));
1705 Module_Param
* mp_field_transfer
= field_transfer
.get_param(param_name
);
1706 mp_field_transfer
->set_id(new Module_Param_FieldName(mcopystr("transfer")));
1707 Module_Param_Assignment_List
* mp
= new Module_Param_Assignment_List();
1708 mp
->add_elem(mp_field_abstract
);
1709 mp
->add_elem(mp_field_transfer
);
1713 void EMBEDDED_PDV_identification_syntaxes::encode_text(Text_Buf
& text_buf
) const
1715 field_abstract
.encode_text(text_buf
);
1716 field_transfer
.encode_text(text_buf
);
1719 void EMBEDDED_PDV_identification_syntaxes::decode_text(Text_Buf
& text_buf
)
1721 field_abstract
.decode_text(text_buf
);
1722 field_transfer
.decode_text(text_buf
);
1725 // No encode/decode for this implementation class
1726 //void EMBEDDED_PDV_identification_syntaxes::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const
1727 //void EMBEDDED_PDV_identification_syntaxes::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
1729 ASN_BER_TLV_t
* EMBEDDED_PDV_identification_syntaxes::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
1731 BER_chk_descr(p_td
);
1732 ASN_BER_TLV_t
*new_tlv
=ASN_BER_TLV_t::construct(NULL
);
1733 TTCN_EncDec_ErrorContext
ec_0("Component '");
1734 TTCN_EncDec_ErrorContext ec_1
;
1735 ec_1
.set_msg("abstract': ");
1736 new_tlv
->add_TLV(field_abstract
.BER_encode_TLV(EMBEDDED_PDV_identification_syntaxes_abstract_descr_
, p_coding
));
1737 ec_1
.set_msg("transfer': ");
1738 new_tlv
->add_TLV(field_transfer
.BER_encode_TLV(EMBEDDED_PDV_identification_syntaxes_transfer_descr_
, p_coding
));
1739 new_tlv
=ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
1743 boolean
EMBEDDED_PDV_identification_syntaxes::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
1745 BER_chk_descr(p_td
);
1746 ASN_BER_TLV_t stripped_tlv
;
1747 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
1748 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EMBEDDED PDV.identification.syntaxes' type: ");
1749 stripped_tlv
.chk_constructed_flag(TRUE
);
1751 ASN_BER_TLV_t tmp_tlv
;
1752 boolean tlv_present
=FALSE
;
1754 TTCN_EncDec_ErrorContext
ec_1("Component '");
1755 TTCN_EncDec_ErrorContext ec_2
;
1756 ec_2
.set_msg("abstract': ");
1757 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
1758 if(!tlv_present
) return FALSE
;
1759 field_abstract
.BER_decode_TLV(EMBEDDED_PDV_identification_syntaxes_abstract_descr_
, tmp_tlv
, L_form
);
1761 ec_2
.set_msg("transfer': ");
1762 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
1763 if(!tlv_present
) return FALSE
;
1764 field_transfer
.BER_decode_TLV(EMBEDDED_PDV_identification_syntaxes_transfer_descr_
, tmp_tlv
, L_form
);
1767 BER_decode_constdTLV_end(stripped_tlv
, V_pos
, L_form
, tmp_tlv
, tlv_present
);
1771 int EMBEDDED_PDV_identification_syntaxes::XER_encode(const XERdescriptor_t
& p_td
,
1772 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
1774 int indenting
= !is_canonical(flavor
);
1775 int exer
= is_exer(flavor
);
1776 int encoded_length
=(int)p_buf
.get_len();
1777 if (indenting
) do_indent(p_buf
, indent
);
1779 if (exer
) write_ns_prefix(p_td
, p_buf
);
1780 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
1783 field_abstract
.XER_encode(EMBEDDED_PDV_identification_sxs_abs_xer_
, p_buf
, flavor
, indent
, 0);
1784 field_transfer
.XER_encode(EMBEDDED_PDV_identification_sxs_xfr_xer_
, p_buf
, flavor
, indent
, 0);
1786 if (indenting
) do_indent(p_buf
, --indent
);
1789 if (exer
) write_ns_prefix(p_td
, p_buf
);
1790 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
1791 return (int)p_buf
.get_len() - encoded_length
;
1794 int EMBEDDED_PDV_identification_syntaxes::XER_decode(const XERdescriptor_t
& /*p_td*/,
1795 XmlReaderWrap
& reader
, unsigned int flavor
, unsigned int flavor2
, embed_values_dec_struct_t
*)
1796 { // we stand on <syntaxes>, move ahead first
1798 for (int success
= reader
.Read(); success
== 1; success
= reader
.Read())
1800 type
= reader
.NodeType();
1801 if (XML_READER_TYPE_ELEMENT
== type
)
1802 // no verify_name for a CHOICE
1805 // FIXME this assumes the right element
1806 field_abstract
.XER_decode(EMBEDDED_PDV_identification_sxs_abs_xer_
, reader
, flavor
, flavor2
, 0);
1807 field_transfer
.XER_decode(EMBEDDED_PDV_identification_sxs_xfr_xer_
, reader
, flavor
, flavor2
, 0);
1808 for (int success
= 1; success
== 1; success
= reader
.Read())
1810 type
= reader
.NodeType();
1811 if (XML_READER_TYPE_END_ELEMENT
== type
)
1814 return 0; // TODO maybe return proper value
1817 /******************** EMBEDDED_PDV_identification_syntaxes_template ********************/
1819 struct EMBEDDED_PDV_identification_syntaxes_template::single_value_struct
{
1820 OBJID_template field_abstract
;
1821 OBJID_template field_transfer
;
1824 void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param
& param
)
1826 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
1827 Module_Param_Ptr mp
= ¶m
;
1828 if (param
.get_type() == Module_Param::MP_Reference
) {
1829 mp
= param
.get_referenced_param();
1831 switch (mp
->get_type()) {
1832 case Module_Param::MP_Omit
:
1835 case Module_Param::MP_Any
:
1838 case Module_Param::MP_AnyOrNone
:
1839 *this = ANY_OR_OMIT
;
1841 case Module_Param::MP_List_Template
:
1842 case Module_Param::MP_ComplementList_Template
: {
1843 EMBEDDED_PDV_identification_syntaxes_template temp
;
1844 temp
.set_type(mp
->get_type() == Module_Param::MP_List_Template
?
1845 VALUE_LIST
: COMPLEMENTED_LIST
, mp
->get_size());
1846 for (size_t i
=0; i
<mp
->get_size(); i
++) {
1847 temp
.list_item(i
).set_param(*mp
->get_elem(i
));
1851 case Module_Param::MP_Value_List
:
1852 if (mp
->get_size()==0) break;
1853 if (2!=mp
->get_size()) {
1854 param
.error("record template of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp
->get_size());
1856 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) abstract().set_param(*mp
->get_elem(0));
1857 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer().set_param(*mp
->get_elem(1));
1859 case Module_Param::MP_Assignment_List
: {
1860 Vector
<bool> value_used(mp
->get_size());
1861 value_used
.resize(mp
->get_size(), false);
1862 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
1863 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
1864 if (!strcmp(curr_param
->get_id()->get_name(), "abstract")) {
1865 abstract().set_param(*curr_param
);
1866 value_used
[val_idx
]=true;
1869 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
1870 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
1871 if (!strcmp(curr_param
->get_id()->get_name(), "transfer")) {
1872 transfer().set_param(*curr_param
);
1873 value_used
[val_idx
]=true;
1876 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
1877 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
1882 param
.type_error("record template", "EMBEDDED PDV.identification.syntaxes");
1884 is_ifpresent
= param
.get_ifpresent() || mp
->get_ifpresent();
1887 Module_Param
* EMBEDDED_PDV_identification_syntaxes_template::get_param(Module_Param_Name
& param_name
) const
1889 Module_Param
* mp
= NULL
;
1890 switch (template_selection
) {
1891 case UNINITIALIZED_TEMPLATE
:
1892 mp
= new Module_Param_Unbound();
1895 mp
= new Module_Param_Omit();
1898 mp
= new Module_Param_Any();
1901 mp
= new Module_Param_AnyOrNone();
1903 case SPECIFIC_VALUE
: {
1904 Module_Param
* mp_field_abstract
= single_value
->field_abstract
.get_param(param_name
);
1905 mp_field_abstract
->set_id(new Module_Param_FieldName(mcopystr("abstract")));
1906 Module_Param
* mp_field_transfer
= single_value
->field_transfer
.get_param(param_name
);
1907 mp_field_transfer
->set_id(new Module_Param_FieldName(mcopystr("transfer")));
1908 mp
= new Module_Param_Assignment_List();
1909 mp
->add_elem(mp_field_abstract
);
1910 mp
->add_elem(mp_field_transfer
);
1913 case COMPLEMENTED_LIST
: {
1914 if (template_selection
== VALUE_LIST
) {
1915 mp
= new Module_Param_List_Template();
1918 mp
= new Module_Param_ComplementList_Template();
1920 for (size_t i
= 0; i
< value_list
.n_values
; ++i
) {
1921 mp
->add_elem(value_list
.list_value
[i
].get_param(param_name
));
1928 mp
->set_ifpresent();
1933 void EMBEDDED_PDV_identification_syntaxes_template::clean_up()
1935 switch (template_selection
) {
1936 case SPECIFIC_VALUE
:
1937 delete single_value
;
1940 case COMPLEMENTED_LIST
:
1941 delete [] value_list
.list_value
;
1946 template_selection
= UNINITIALIZED_TEMPLATE
;
1949 void EMBEDDED_PDV_identification_syntaxes_template::set_specific()
1951 if (template_selection
!= SPECIFIC_VALUE
) {
1952 template_sel old_selection
= template_selection
;
1954 single_value
= new single_value_struct
;
1955 set_selection(SPECIFIC_VALUE
);
1956 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
1957 single_value
->field_abstract
= ANY_VALUE
;
1958 single_value
->field_transfer
= ANY_VALUE
;
1963 void EMBEDDED_PDV_identification_syntaxes_template::copy_value(const EMBEDDED_PDV_identification_syntaxes
& other_value
)
1965 single_value
= new single_value_struct
;
1966 single_value
->field_abstract
= other_value
.abstract();
1967 single_value
->field_transfer
= other_value
.transfer();
1968 set_selection(SPECIFIC_VALUE
);
1971 void EMBEDDED_PDV_identification_syntaxes_template::copy_template(const EMBEDDED_PDV_identification_syntaxes_template
& other_value
)
1973 switch (other_value
.template_selection
) {
1974 case SPECIFIC_VALUE
:
1975 single_value
= new single_value_struct(*other_value
.single_value
);
1982 case COMPLEMENTED_LIST
:
1983 value_list
.n_values
= other_value
.value_list
.n_values
;
1984 value_list
.list_value
= new EMBEDDED_PDV_identification_syntaxes_template
[value_list
.n_values
];
1985 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
1986 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
1989 TTCN_error("Copying an uninitialized/unsupported template of type EMBEDDED PDV.identification.syntaxes.");
1991 set_selection(other_value
);
1994 EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_syntaxes_template()
1998 EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_syntaxes_template(template_sel other_value
)
1999 : Base_Template(other_value
)
2001 check_single_selection(other_value
);
2004 EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_syntaxes_template(const EMBEDDED_PDV_identification_syntaxes
& other_value
)
2006 copy_value(other_value
);
2009 EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_syntaxes_template(const OPTIONAL
<EMBEDDED_PDV_identification_syntaxes
>& other_value
)
2011 switch (other_value
.get_selection()) {
2012 case OPTIONAL_PRESENT
:
2013 copy_value((const EMBEDDED_PDV_identification_syntaxes
&)other_value
);
2016 set_selection(OMIT_VALUE
);
2019 TTCN_error("Creating a template of type EMBEDDED PDV.identification.syntaxes from an unbound optional field.");
2023 EMBEDDED_PDV_identification_syntaxes_template::EMBEDDED_PDV_identification_syntaxes_template(const EMBEDDED_PDV_identification_syntaxes_template
& other_value
)
2026 copy_template(other_value
);
2029 EMBEDDED_PDV_identification_syntaxes_template::~EMBEDDED_PDV_identification_syntaxes_template()
2034 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_syntaxes_template::operator=(template_sel other_value
)
2036 check_single_selection(other_value
);
2038 set_selection(other_value
);
2042 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_syntaxes_template::operator=(const EMBEDDED_PDV_identification_syntaxes
& other_value
)
2045 copy_value(other_value
);
2049 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_syntaxes_template::operator=(const OPTIONAL
<EMBEDDED_PDV_identification_syntaxes
>& other_value
)
2052 switch (other_value
.get_selection()) {
2053 case OPTIONAL_PRESENT
:
2054 copy_value((const EMBEDDED_PDV_identification_syntaxes
&)other_value
);
2057 set_selection(OMIT_VALUE
);
2060 TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.identification.syntaxes.");
2065 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_syntaxes_template::operator=(const EMBEDDED_PDV_identification_syntaxes_template
& other_value
)
2067 if (&other_value
!= this) {
2069 copy_template(other_value
);
2074 boolean
EMBEDDED_PDV_identification_syntaxes_template::match(const EMBEDDED_PDV_identification_syntaxes
& other_value
,
2075 boolean
/* legacy */) const
2077 switch (template_selection
) {
2083 case SPECIFIC_VALUE
:
2084 if (!other_value
.abstract().is_bound()) return FALSE
;
2085 if (!single_value
->field_abstract
.match(other_value
.abstract())) return FALSE
;
2086 if (!other_value
.transfer().is_bound()) return FALSE
;
2087 if (!single_value
->field_transfer
.match(other_value
.transfer())) return FALSE
;
2090 case COMPLEMENTED_LIST
:
2091 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2092 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
2093 return template_selection
== COMPLEMENTED_LIST
;
2095 TTCN_error("Matching an uninitialized/unsupported template of type EMBEDDED PDV.identification.syntaxes.");
2100 EMBEDDED_PDV_identification_syntaxes
EMBEDDED_PDV_identification_syntaxes_template::valueof() const
2102 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
2103 TTCN_error("Performing valueof or send operation on a non-specific template of type EMBEDDED PDV.identification.syntaxes.");
2104 EMBEDDED_PDV_identification_syntaxes ret_val
;
2105 ret_val
.abstract() = single_value
->field_abstract
.valueof();
2106 ret_val
.transfer() = single_value
->field_transfer
.valueof();
2110 void EMBEDDED_PDV_identification_syntaxes_template::set_type(template_sel template_type
, unsigned int list_length
)
2112 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
2113 TTCN_error("Setting an invalid list for a template of type EMBEDDED PDV.identification.syntaxes.");
2115 set_selection(template_type
);
2116 value_list
.n_values
= list_length
;
2117 value_list
.list_value
= new EMBEDDED_PDV_identification_syntaxes_template
[list_length
];
2120 EMBEDDED_PDV_identification_syntaxes_template
& EMBEDDED_PDV_identification_syntaxes_template::list_item(unsigned int list_index
) const
2122 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
2123 TTCN_error("Accessing a list element of a non-list template of type EMBEDDED PDV.identification.syntaxes.");
2124 if (list_index
>= value_list
.n_values
)
2125 TTCN_error("Index overflow in a value list template of type EMBEDDED PDV.identification.syntaxes.");
2126 return value_list
.list_value
[list_index
];
2129 OBJID_template
& EMBEDDED_PDV_identification_syntaxes_template::abstract()
2132 return single_value
->field_abstract
;
2135 const OBJID_template
& EMBEDDED_PDV_identification_syntaxes_template::abstract() const
2137 if (template_selection
!= SPECIFIC_VALUE
)
2138 TTCN_error("Accessing field abstract of a non-specific template of type EMBEDDED PDV.identification.syntaxes.");
2139 return single_value
->field_abstract
;
2142 OBJID_template
& EMBEDDED_PDV_identification_syntaxes_template::transfer()
2145 return single_value
->field_transfer
;
2148 const OBJID_template
& EMBEDDED_PDV_identification_syntaxes_template::transfer() const
2150 if (template_selection
!= SPECIFIC_VALUE
)
2151 TTCN_error("Accessing field transfer of a non-specific template of type EMBEDDED PDV.identification.syntaxes.");
2152 return single_value
->field_transfer
;
2155 int EMBEDDED_PDV_identification_syntaxes_template::size_of() const
2157 switch (template_selection
)
2159 case SPECIFIC_VALUE
:
2166 if (value_list
.n_values
<1)
2167 TTCN_error("Internal error: Performing sizeof() operation on a template of type EMBEDDED PDV.identification.syntaxes containing an empty list.");
2168 int item_size
= value_list
.list_value
[0].size_of();
2169 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
2171 if (value_list
.list_value
[i
].size_of()!=item_size
)
2172 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.syntaxes containing a value list with different sizes.");
2177 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.syntaxes containing omit value.");
2180 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.syntaxes containing */? value.");
2181 case COMPLEMENTED_LIST
:
2182 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.syntaxes containing complemented list.");
2184 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EMBEDDED PDV.identification.syntaxes.");
2189 void EMBEDDED_PDV_identification_syntaxes_template::log() const
2191 switch (template_selection
) {
2192 case SPECIFIC_VALUE
:
2193 TTCN_Logger::log_event_str("{ abstract := ");
2194 single_value
->field_abstract
.log();
2195 TTCN_Logger::log_event_str(", transfer := ");
2196 single_value
->field_transfer
.log();
2197 TTCN_Logger::log_event_str(" }");
2199 case COMPLEMENTED_LIST
:
2200 TTCN_Logger::log_event_str("complement ");
2203 TTCN_Logger::log_char('(');
2204 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
2205 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
2206 value_list
.list_value
[list_count
].log();
2208 TTCN_Logger::log_char(')');
2217 void EMBEDDED_PDV_identification_syntaxes_template::log_match(const EMBEDDED_PDV_identification_syntaxes
& match_value
,
2218 boolean
/* legacy */) const
2220 if (template_selection
== SPECIFIC_VALUE
) {
2221 TTCN_Logger::log_event_str("{ abstract := ");
2222 single_value
->field_abstract
.log_match(match_value
.abstract());
2223 TTCN_Logger::log_event_str(", transfer := ");
2224 single_value
->field_transfer
.log_match(match_value
.transfer());
2225 TTCN_Logger::log_event_str(" }");
2228 TTCN_Logger::log_event_str(" with ");
2230 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
2231 else TTCN_Logger::log_event_str(" unmatched");
2235 void EMBEDDED_PDV_identification_syntaxes_template::encode_text(Text_Buf
& text_buf
) const
2237 encode_text_base(text_buf
);
2238 switch (template_selection
) {
2239 case SPECIFIC_VALUE
:
2240 single_value
->field_abstract
.encode_text(text_buf
);
2241 single_value
->field_transfer
.encode_text(text_buf
);
2248 case COMPLEMENTED_LIST
:
2249 text_buf
.push_int(value_list
.n_values
);
2250 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2251 value_list
.list_value
[list_count
].encode_text(text_buf
);
2254 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EMBEDDED PDV.identification.syntaxes.");
2258 void EMBEDDED_PDV_identification_syntaxes_template::decode_text(Text_Buf
& text_buf
)
2261 decode_text_base(text_buf
);
2262 switch (template_selection
) {
2263 case SPECIFIC_VALUE
:
2264 single_value
= new single_value_struct
;
2265 single_value
->field_abstract
.decode_text(text_buf
);
2266 single_value
->field_transfer
.decode_text(text_buf
);
2273 case COMPLEMENTED_LIST
:
2274 value_list
.n_values
= text_buf
.pull_int().get_val();
2275 value_list
.list_value
= new EMBEDDED_PDV_identification_syntaxes_template
[value_list
.n_values
];
2276 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2277 value_list
.list_value
[list_count
].decode_text(text_buf
);
2280 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EMBEDDED PDV.identification.syntaxes.");
2284 boolean
EMBEDDED_PDV_identification_syntaxes_template::is_present(boolean legacy
/* = FALSE */) const
2286 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
2287 return !match_omit(legacy
);
2290 boolean
EMBEDDED_PDV_identification_syntaxes_template::match_omit(boolean legacy
/* = FALSE */) const
2292 if (is_ifpresent
) return TRUE
;
2293 switch (template_selection
) {
2298 case COMPLEMENTED_LIST
:
2300 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
2301 if (value_list
.list_value
[i
].match_omit())
2302 return template_selection
==VALUE_LIST
;
2303 return template_selection
==COMPLEMENTED_LIST
;
2304 } // else fall through
2311 #ifndef TITAN_RUNTIME_2
2312 void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_res t_res
, const char* t_name
,
2313 boolean legacy
/* = FALSE */) const
2315 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
2316 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
2318 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
2321 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
2322 template_selection
==SPECIFIC_VALUE
)) return;
2325 if (!match_omit(legacy
)) return;
2330 TTCN_error("Restriction `%s' on template of type %s violated.",
2331 get_res_name(t_res
), t_name
? t_name
: "EMBEDDED PDV.identification.syntaxes");
2335 EMBEDDED_PDV_identification_context__negotiation::EMBEDDED_PDV_identification_context__negotiation()
2339 EMBEDDED_PDV_identification_context__negotiation::EMBEDDED_PDV_identification_context__negotiation(const INTEGER
& par_presentation__context__id
,
2340 const OBJID
& par_transfer__syntax
)
2341 : field_presentation__context__id(par_presentation__context__id
),
2342 field_transfer__syntax(par_transfer__syntax
)
2346 boolean
EMBEDDED_PDV_identification_context__negotiation::operator==(const EMBEDDED_PDV_identification_context__negotiation
& other_value
) const
2348 return field_presentation__context__id
==other_value
.field_presentation__context__id
2349 && field_transfer__syntax
==other_value
.field_transfer__syntax
;
2352 int EMBEDDED_PDV_identification_context__negotiation::size_of() const
2358 void EMBEDDED_PDV_identification_context__negotiation::log() const
2360 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2361 field_presentation__context__id
.log();
2362 TTCN_Logger::log_event_str(", transfer_syntax := ");
2363 field_transfer__syntax
.log();
2364 TTCN_Logger::log_event_str(" }");
2367 boolean
EMBEDDED_PDV_identification_context__negotiation::is_bound() const
2369 if(field_presentation__context__id
.is_bound()) return TRUE
;
2370 if(field_transfer__syntax
.is_bound()) return TRUE
;
2374 boolean
EMBEDDED_PDV_identification_context__negotiation::is_value() const
2376 if(!field_presentation__context__id
.is_value()) return FALSE
;
2377 if(!field_transfer__syntax
.is_value()) return FALSE
;
2381 void EMBEDDED_PDV_identification_context__negotiation::clean_up()
2383 field_presentation__context__id
.clean_up();
2384 field_transfer__syntax
.clean_up();
2387 void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param
& param
)
2389 param
.basic_check(Module_Param::BC_VALUE
, "record value");
2390 Module_Param_Ptr mp
= ¶m
;
2391 if (param
.get_type() == Module_Param::MP_Reference
) {
2392 mp
= param
.get_referenced_param();
2394 switch (mp
->get_type()) {
2395 case Module_Param::MP_Value_List
:
2396 if (mp
->get_size()==0) return;
2397 if (2!=mp
->get_size()) {
2398 param
.error("record value of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp
->get_size());
2400 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) presentation__context__id().set_param(*mp
->get_elem(0));
2401 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer__syntax().set_param(*mp
->get_elem(1));
2403 case Module_Param::MP_Assignment_List
: {
2404 Vector
<bool> value_used(mp
->get_size());
2405 value_used
.resize(mp
->get_size(), false);
2406 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
2407 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
2408 if (!strcmp(curr_param
->get_id()->get_name(), "presentation_context_id")) {
2409 presentation__context__id().set_param(*curr_param
);
2410 value_used
[val_idx
]=true;
2413 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
2414 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
2415 if (!strcmp(curr_param
->get_id()->get_name(), "transfer_syntax")) {
2416 transfer__syntax().set_param(*curr_param
);
2417 value_used
[val_idx
]=true;
2420 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
2421 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
2426 param
.type_error("record value", "EMBEDDED PDV.identification.context-negotiation");
2430 Module_Param
* EMBEDDED_PDV_identification_context__negotiation::get_param(Module_Param_Name
& param_name
) const
2433 return new Module_Param_Unbound();
2435 Module_Param
* mp_field_presentation_context_id
= field_presentation__context__id
.get_param(param_name
);
2436 mp_field_presentation_context_id
->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
2437 Module_Param
* mp_field_transfer_syntax
= field_transfer__syntax
.get_param(param_name
);
2438 mp_field_transfer_syntax
->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
2439 Module_Param_Assignment_List
* mp
= new Module_Param_Assignment_List();
2440 mp
->add_elem(mp_field_presentation_context_id
);
2441 mp
->add_elem(mp_field_transfer_syntax
);
2445 void EMBEDDED_PDV_identification_context__negotiation::encode_text(Text_Buf
& text_buf
) const
2447 field_presentation__context__id
.encode_text(text_buf
);
2448 field_transfer__syntax
.encode_text(text_buf
);
2451 void EMBEDDED_PDV_identification_context__negotiation::decode_text(Text_Buf
& text_buf
)
2453 field_presentation__context__id
.decode_text(text_buf
);
2454 field_transfer__syntax
.decode_text(text_buf
);
2457 // No encode/decode for this implementation class
2458 //void EMBEDDED_PDV_identification_context__negotiation::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const
2459 //void EMBEDDED_PDV_identification_context__negotiation::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
2462 ASN_BER_TLV_t
* EMBEDDED_PDV_identification_context__negotiation::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
2464 BER_chk_descr(p_td
);
2465 ASN_BER_TLV_t
*new_tlv
=ASN_BER_TLV_t::construct(NULL
);
2466 TTCN_EncDec_ErrorContext
ec_0("Component '");
2467 TTCN_EncDec_ErrorContext ec_1
;
2468 ec_1
.set_msg("presentation_context_id': ");
2469 new_tlv
->add_TLV(field_presentation__context__id
.BER_encode_TLV(EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_
, p_coding
));
2470 ec_1
.set_msg("transfer_syntax': ");
2471 new_tlv
->add_TLV(field_transfer__syntax
.BER_encode_TLV(EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_
, p_coding
));
2472 new_tlv
=ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
2476 boolean
EMBEDDED_PDV_identification_context__negotiation::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
2478 BER_chk_descr(p_td
);
2479 ASN_BER_TLV_t stripped_tlv
;
2480 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
2481 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EMBEDDED PDV.identification.context-negotiation' type: ");
2482 stripped_tlv
.chk_constructed_flag(TRUE
);
2484 ASN_BER_TLV_t tmp_tlv
;
2485 boolean tlv_present
=FALSE
;
2487 TTCN_EncDec_ErrorContext
ec_1("Component '");
2488 TTCN_EncDec_ErrorContext ec_2
;
2489 ec_2
.set_msg("presentation_context_id': ");
2490 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
2491 if(!tlv_present
) return FALSE
;
2492 field_presentation__context__id
.BER_decode_TLV(EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_
, tmp_tlv
, L_form
);
2494 ec_2
.set_msg("transfer_syntax': ");
2495 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
2496 if(!tlv_present
) return FALSE
;
2497 field_transfer__syntax
.BER_decode_TLV(EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_
, tmp_tlv
, L_form
);
2500 BER_decode_constdTLV_end(stripped_tlv
, V_pos
, L_form
, tmp_tlv
, tlv_present
);
2504 int EMBEDDED_PDV_identification_context__negotiation::XER_encode(const XERdescriptor_t
& p_td
,
2505 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const
2507 int indenting
= !is_canonical(flavor
);
2508 int exer
= is_exer(flavor
);
2509 int encoded_length
=(int)p_buf
.get_len();
2510 if (indenting
) do_indent(p_buf
, indent
);
2512 if (exer
) write_ns_prefix(p_td
, p_buf
);
2513 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
2516 field_presentation__context__id
.XER_encode(EMBEDDED_PDV_identification_cn_pci_xer_
, p_buf
, flavor
, indent
, 0);
2517 field_transfer__syntax
.XER_encode(EMBEDDED_PDV_identification_cn_tsx_xer_
, p_buf
, flavor
, indent
, 0);
2519 if (indenting
) do_indent(p_buf
, --indent
);
2522 if (exer
) write_ns_prefix(p_td
, p_buf
);
2523 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
2524 return (int)p_buf
.get_len() - encoded_length
;
2527 int EMBEDDED_PDV_identification_context__negotiation::XER_decode(
2528 const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
, unsigned int flavor
, unsigned int flavor2
, embed_values_dec_struct_t
*)
2530 int exer
= is_exer(flavor
);
2531 int type
= reader
.NodeType(), depth
= -1;
2532 const char* name
= (const char*)reader
.Name();
2533 int success
= reader
.Ok();
2534 if (type
==XML_READER_TYPE_ELEMENT
&& check_name(name
, p_td
, exer
)) {
2535 verify_name(reader
, p_td
, exer
);
2536 depth
= reader
.Depth();
2537 success
= reader
.Read();
2539 field_presentation__context__id
.XER_decode(EMBEDDED_PDV_identification_cn_pci_xer_
, reader
, flavor
, flavor2
, 0);
2540 field_transfer__syntax
.XER_decode(EMBEDDED_PDV_identification_cn_tsx_xer_
, reader
, flavor
, flavor2
, 0);
2541 for (; success
== 1; success
= reader
.Read()) {
2542 type
= reader
.NodeType();
2543 if (XML_READER_TYPE_END_ELEMENT
== type
) {
2544 verify_end(reader
, p_td
, depth
, exer
);
2549 return 0; // TODO sensible return value
2552 struct EMBEDDED_PDV_identification_context__negotiation_template::single_value_struct
{
2553 INTEGER_template field_presentation__context__id
;
2554 OBJID_template field_transfer__syntax
;
2557 void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module_Param
& param
)
2559 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
2560 Module_Param_Ptr mp
= ¶m
;
2561 if (param
.get_type() == Module_Param::MP_Reference
) {
2562 mp
= param
.get_referenced_param();
2564 switch (mp
->get_type()) {
2565 case Module_Param::MP_Omit
:
2568 case Module_Param::MP_Any
:
2571 case Module_Param::MP_AnyOrNone
:
2572 *this = ANY_OR_OMIT
;
2574 case Module_Param::MP_List_Template
:
2575 case Module_Param::MP_ComplementList_Template
: {
2576 EMBEDDED_PDV_identification_context__negotiation_template temp
;
2577 temp
.set_type(mp
->get_type() == Module_Param::MP_List_Template
?
2578 VALUE_LIST
: COMPLEMENTED_LIST
, mp
->get_size());
2579 for (size_t i
=0; i
<mp
->get_size(); i
++) {
2580 temp
.list_item(i
).set_param(*mp
->get_elem(i
));
2584 case Module_Param::MP_Value_List
:
2585 if (mp
->get_size()==0) break;
2586 if (2!=mp
->get_size()) {
2587 param
.error("record template of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp
->get_size());
2589 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) presentation__context__id().set_param(*mp
->get_elem(0));
2590 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) transfer__syntax().set_param(*mp
->get_elem(1));
2592 case Module_Param::MP_Assignment_List
: {
2593 Vector
<bool> value_used(mp
->get_size());
2594 value_used
.resize(mp
->get_size(), false);
2595 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
2596 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
2597 if (!strcmp(curr_param
->get_id()->get_name(), "presentation_context_id")) {
2598 presentation__context__id().set_param(*curr_param
);
2599 value_used
[val_idx
]=true;
2602 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
2603 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
2604 if (!strcmp(curr_param
->get_id()->get_name(), "transfer_syntax")) {
2605 transfer__syntax().set_param(*curr_param
);
2606 value_used
[val_idx
]=true;
2609 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
2610 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
2615 param
.type_error("record template", "EMBEDDED PDV.identification.context-negotiation");
2617 is_ifpresent
= param
.get_ifpresent() || mp
->get_ifpresent();
2620 Module_Param
* EMBEDDED_PDV_identification_context__negotiation_template::get_param(Module_Param_Name
& param_name
) const
2622 Module_Param
* mp
= NULL
;
2623 switch (template_selection
) {
2624 case UNINITIALIZED_TEMPLATE
:
2625 mp
= new Module_Param_Unbound();
2628 mp
= new Module_Param_Omit();
2631 mp
= new Module_Param_Any();
2634 mp
= new Module_Param_AnyOrNone();
2636 case SPECIFIC_VALUE
: {
2637 Module_Param
* mp_field_presentation_context_id
= single_value
->field_presentation__context__id
.get_param(param_name
);
2638 mp_field_presentation_context_id
->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
2639 Module_Param
* mp_field_transfer_syntax
= single_value
->field_transfer__syntax
.get_param(param_name
);
2640 mp_field_transfer_syntax
->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
2641 mp
= new Module_Param_Assignment_List();
2642 mp
->add_elem(mp_field_presentation_context_id
);
2643 mp
->add_elem(mp_field_transfer_syntax
);
2646 case COMPLEMENTED_LIST
: {
2647 if (template_selection
== VALUE_LIST
) {
2648 mp
= new Module_Param_List_Template();
2651 mp
= new Module_Param_ComplementList_Template();
2653 for (size_t i
= 0; i
< value_list
.n_values
; ++i
) {
2654 mp
->add_elem(value_list
.list_value
[i
].get_param(param_name
));
2661 mp
->set_ifpresent();
2666 void EMBEDDED_PDV_identification_context__negotiation_template::clean_up()
2668 switch (template_selection
) {
2669 case SPECIFIC_VALUE
:
2670 delete single_value
;
2673 case COMPLEMENTED_LIST
:
2674 delete [] value_list
.list_value
;
2679 template_selection
= UNINITIALIZED_TEMPLATE
;
2682 void EMBEDDED_PDV_identification_context__negotiation_template::set_specific()
2684 if (template_selection
!= SPECIFIC_VALUE
) {
2685 template_sel old_selection
= template_selection
;
2687 single_value
= new single_value_struct
;
2688 set_selection(SPECIFIC_VALUE
);
2689 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
2690 single_value
->field_presentation__context__id
= ANY_VALUE
;
2691 single_value
->field_transfer__syntax
= ANY_VALUE
;
2696 void EMBEDDED_PDV_identification_context__negotiation_template::copy_value(const EMBEDDED_PDV_identification_context__negotiation
& other_value
)
2698 single_value
= new single_value_struct
;
2699 single_value
->field_presentation__context__id
= other_value
.presentation__context__id();
2700 single_value
->field_transfer__syntax
= other_value
.transfer__syntax();
2701 set_selection(SPECIFIC_VALUE
);
2704 void EMBEDDED_PDV_identification_context__negotiation_template::copy_template(const EMBEDDED_PDV_identification_context__negotiation_template
& other_value
)
2706 switch (other_value
.template_selection
) {
2707 case SPECIFIC_VALUE
:
2708 single_value
= new single_value_struct(*other_value
.single_value
);
2715 case COMPLEMENTED_LIST
:
2716 value_list
.n_values
= other_value
.value_list
.n_values
;
2717 value_list
.list_value
= new EMBEDDED_PDV_identification_context__negotiation_template
[value_list
.n_values
];
2718 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2719 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
2722 TTCN_error("Copying an uninitialized/unsupported template of type EMBEDDED PDV.identification.context-negotiation.");
2724 set_selection(other_value
);
2727 EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identification_context__negotiation_template()
2731 EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identification_context__negotiation_template(template_sel other_value
)
2732 : Base_Template(other_value
)
2734 check_single_selection(other_value
);
2737 EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identification_context__negotiation_template(const EMBEDDED_PDV_identification_context__negotiation
& other_value
)
2739 copy_value(other_value
);
2742 EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identification_context__negotiation_template(const OPTIONAL
<EMBEDDED_PDV_identification_context__negotiation
>& other_value
)
2744 switch (other_value
.get_selection()) {
2745 case OPTIONAL_PRESENT
:
2746 copy_value((const EMBEDDED_PDV_identification_context__negotiation
&)other_value
);
2749 set_selection(OMIT_VALUE
);
2752 TTCN_error("Creating a template of type EMBEDDED PDV.identification.context-negotiation from an unbound optional field.");
2756 EMBEDDED_PDV_identification_context__negotiation_template::EMBEDDED_PDV_identification_context__negotiation_template(const EMBEDDED_PDV_identification_context__negotiation_template
& other_value
)
2759 copy_template(other_value
);
2762 EMBEDDED_PDV_identification_context__negotiation_template::~EMBEDDED_PDV_identification_context__negotiation_template()
2767 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_context__negotiation_template::operator=(template_sel other_value
)
2769 check_single_selection(other_value
);
2771 set_selection(other_value
);
2775 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_context__negotiation_template::operator=(const EMBEDDED_PDV_identification_context__negotiation
& other_value
)
2778 copy_value(other_value
);
2782 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_context__negotiation_template::operator=(const OPTIONAL
<EMBEDDED_PDV_identification_context__negotiation
>& other_value
)
2785 switch (other_value
.get_selection()) {
2786 case OPTIONAL_PRESENT
:
2787 copy_value((const EMBEDDED_PDV_identification_context__negotiation
&)other_value
);
2790 set_selection(OMIT_VALUE
);
2793 TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.identification.context-negotiation.");
2798 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_context__negotiation_template::operator=(const EMBEDDED_PDV_identification_context__negotiation_template
& other_value
)
2800 if (&other_value
!= this) {
2802 copy_template(other_value
);
2807 boolean
EMBEDDED_PDV_identification_context__negotiation_template::match(const EMBEDDED_PDV_identification_context__negotiation
& other_value
,
2808 boolean
/* legacy */) const
2810 switch (template_selection
) {
2816 case SPECIFIC_VALUE
:
2817 if (!other_value
.presentation__context__id().is_bound()) return FALSE
;
2818 if (!single_value
->field_presentation__context__id
.match(other_value
.presentation__context__id())) return FALSE
;
2819 if (!other_value
.transfer__syntax().is_bound()) return FALSE
;
2820 if (!single_value
->field_transfer__syntax
.match(other_value
.transfer__syntax())) return FALSE
;
2823 case COMPLEMENTED_LIST
:
2824 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2825 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
2826 return template_selection
== COMPLEMENTED_LIST
;
2828 TTCN_error("Matching an uninitialized/unsupported template of type EMBEDDED PDV.identification.context-negotiation.");
2833 EMBEDDED_PDV_identification_context__negotiation
EMBEDDED_PDV_identification_context__negotiation_template::valueof() const
2835 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
2836 TTCN_error("Performing valueof or send operation on a non-specific template of type EMBEDDED PDV.identification.context-negotiation.");
2837 EMBEDDED_PDV_identification_context__negotiation ret_val
;
2838 ret_val
.presentation__context__id() = single_value
->field_presentation__context__id
.valueof();
2839 ret_val
.transfer__syntax() = single_value
->field_transfer__syntax
.valueof();
2843 void EMBEDDED_PDV_identification_context__negotiation_template::set_type(template_sel template_type
, unsigned int list_length
)
2845 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
2846 TTCN_error("Setting an invalid list for a template of type EMBEDDED PDV.identification.context-negotiation.");
2848 set_selection(template_type
);
2849 value_list
.n_values
= list_length
;
2850 value_list
.list_value
= new EMBEDDED_PDV_identification_context__negotiation_template
[list_length
];
2853 EMBEDDED_PDV_identification_context__negotiation_template
& EMBEDDED_PDV_identification_context__negotiation_template::list_item(unsigned int list_index
) const
2855 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
2856 TTCN_error("Accessing a list element of a non-list template of type EMBEDDED PDV.identification.context-negotiation.");
2857 if (list_index
>= value_list
.n_values
)
2858 TTCN_error("Index overflow in a value list template of type EMBEDDED PDV.identification.context-negotiation.");
2859 return value_list
.list_value
[list_index
];
2862 INTEGER_template
& EMBEDDED_PDV_identification_context__negotiation_template::presentation__context__id()
2865 return single_value
->field_presentation__context__id
;
2868 const INTEGER_template
& EMBEDDED_PDV_identification_context__negotiation_template::presentation__context__id() const
2870 if (template_selection
!= SPECIFIC_VALUE
)
2871 TTCN_error("Accessing field presentation_context_id of a non-specific template of type EMBEDDED PDV.identification.context-negotiation.");
2872 return single_value
->field_presentation__context__id
;
2875 OBJID_template
& EMBEDDED_PDV_identification_context__negotiation_template::transfer__syntax()
2878 return single_value
->field_transfer__syntax
;
2881 const OBJID_template
& EMBEDDED_PDV_identification_context__negotiation_template::transfer__syntax() const
2883 if (template_selection
!= SPECIFIC_VALUE
)
2884 TTCN_error("Accessing field transfer_syntax of a non-specific template of type EMBEDDED PDV.identification.context-negotiation.");
2885 return single_value
->field_transfer__syntax
;
2888 int EMBEDDED_PDV_identification_context__negotiation_template::size_of() const
2890 switch (template_selection
)
2892 case SPECIFIC_VALUE
:
2899 if (value_list
.n_values
<1)
2900 TTCN_error("Internal error: Performing sizeof() operation on a template of type EMBEDDED PDV.identification.context-negotiation containing an empty list.");
2901 int item_size
= value_list
.list_value
[0].size_of();
2902 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
2904 if (value_list
.list_value
[i
].size_of()!=item_size
)
2905 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.context-negotiation containing a value list with different sizes.");
2910 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.context-negotiation containing omit value.");
2913 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.context-negotiation containing */? value.");
2914 case COMPLEMENTED_LIST
:
2915 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV.identification.context-negotiation containing complemented list.");
2917 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EMBEDDED PDV.identification.context-negotiation.");
2922 void EMBEDDED_PDV_identification_context__negotiation_template::log() const
2924 switch (template_selection
) {
2925 case SPECIFIC_VALUE
:
2926 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2927 single_value
->field_presentation__context__id
.log();
2928 TTCN_Logger::log_event_str(", transfer_syntax := ");
2929 single_value
->field_transfer__syntax
.log();
2930 TTCN_Logger::log_event_str(" }");
2932 case COMPLEMENTED_LIST
:
2933 TTCN_Logger::log_event_str("complement ");
2936 TTCN_Logger::log_char('(');
2937 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
2938 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
2939 value_list
.list_value
[list_count
].log();
2941 TTCN_Logger::log_char(')');
2950 void EMBEDDED_PDV_identification_context__negotiation_template::log_match(const EMBEDDED_PDV_identification_context__negotiation
& match_value
,
2951 boolean
/* legacy */) const
2953 if (template_selection
== SPECIFIC_VALUE
) {
2954 TTCN_Logger::log_event_str("{ presentation_context_id := ");
2955 single_value
->field_presentation__context__id
.log_match(match_value
.presentation__context__id());
2956 TTCN_Logger::log_event_str(", transfer_syntax := ");
2957 single_value
->field_transfer__syntax
.log_match(match_value
.transfer__syntax());
2958 TTCN_Logger::log_event_str(" }");
2961 TTCN_Logger::log_event_str(" with ");
2963 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
2964 else TTCN_Logger::log_event_str(" unmatched");
2968 void EMBEDDED_PDV_identification_context__negotiation_template::encode_text(Text_Buf
& text_buf
) const
2970 encode_text_base(text_buf
);
2971 switch (template_selection
) {
2972 case SPECIFIC_VALUE
:
2973 single_value
->field_presentation__context__id
.encode_text(text_buf
);
2974 single_value
->field_transfer__syntax
.encode_text(text_buf
);
2981 case COMPLEMENTED_LIST
:
2982 text_buf
.push_int(value_list
.n_values
);
2983 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
2984 value_list
.list_value
[list_count
].encode_text(text_buf
);
2987 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EMBEDDED PDV.identification.context-negotiation.");
2991 void EMBEDDED_PDV_identification_context__negotiation_template::decode_text(Text_Buf
& text_buf
)
2994 decode_text_base(text_buf
);
2995 switch (template_selection
) {
2996 case SPECIFIC_VALUE
:
2997 single_value
= new single_value_struct
;
2998 single_value
->field_presentation__context__id
.decode_text(text_buf
);
2999 single_value
->field_transfer__syntax
.decode_text(text_buf
);
3006 case COMPLEMENTED_LIST
:
3007 value_list
.n_values
= text_buf
.pull_int().get_val();
3008 value_list
.list_value
= new EMBEDDED_PDV_identification_context__negotiation_template
[value_list
.n_values
];
3009 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3010 value_list
.list_value
[list_count
].decode_text(text_buf
);
3013 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EMBEDDED PDV.identification.context-negotiation.");
3017 boolean
EMBEDDED_PDV_identification_context__negotiation_template::is_present(boolean legacy
/* = FALSE */) const
3019 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
3020 return !match_omit(legacy
);
3023 boolean
EMBEDDED_PDV_identification_context__negotiation_template::match_omit(boolean legacy
/* = FALSE */) const
3025 if (is_ifpresent
) return TRUE
;
3026 switch (template_selection
) {
3031 case COMPLEMENTED_LIST
:
3033 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
3034 if (value_list
.list_value
[i
].match_omit())
3035 return template_selection
==VALUE_LIST
;
3036 return template_selection
==COMPLEMENTED_LIST
;
3037 } // else fall through
3044 #ifndef TITAN_RUNTIME_2
3045 void EMBEDDED_PDV_identification_context__negotiation_template::check_restriction(template_res t_res
, const char* t_name
,
3046 boolean legacy
/* = FALSE */) const
3048 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
3049 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
3051 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
3054 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
3055 template_selection
==SPECIFIC_VALUE
)) return;
3058 if (!match_omit(legacy
)) return;
3063 TTCN_error("Restriction `%s' on template of type %s violated.",
3064 get_res_name(t_res
), t_name
? t_name
: "EMBEDDED PDV.identification.context-negotiation");
3068 EMBEDDED_PDV::EMBEDDED_PDV()
3072 EMBEDDED_PDV::EMBEDDED_PDV(const EMBEDDED_PDV_identification
& par_identification
,
3073 const OPTIONAL
<UNIVERSAL_CHARSTRING
>& par_data__value__descriptor
,
3074 const OCTETSTRING
& par_data__value
)
3075 : field_identification(par_identification
),
3076 field_data__value__descriptor(par_data__value__descriptor
),
3077 field_data__value(par_data__value
)
3081 boolean
EMBEDDED_PDV::operator==(const EMBEDDED_PDV
& other_value
) const
3083 return field_identification
==other_value
.field_identification
3084 && field_data__value__descriptor
==other_value
.field_data__value__descriptor
3085 && field_data__value
==other_value
.field_data__value
;
3088 int EMBEDDED_PDV::size_of() const
3091 if (field_data__value__descriptor
.ispresent()) ret_val
++;
3095 void EMBEDDED_PDV::log() const
3097 TTCN_Logger::log_event_str("{ identification := ");
3098 field_identification
.log();
3099 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3100 field_data__value__descriptor
.log();
3101 TTCN_Logger::log_event_str(", data_value := ");
3102 field_data__value
.log();
3103 TTCN_Logger::log_event_str(" }");
3106 boolean
EMBEDDED_PDV::is_bound() const
3108 if(field_identification
.is_bound()) return TRUE
;
3109 if(OPTIONAL_OMIT
== field_data__value__descriptor
.get_selection() || field_data__value__descriptor
.is_bound()) return TRUE
;
3110 if(field_data__value
.is_bound()) return TRUE
;
3114 boolean
EMBEDDED_PDV::is_value() const
3116 if(!field_identification
.is_value()) return FALSE
;
3117 if(OPTIONAL_OMIT
!= field_data__value__descriptor
.get_selection() && !field_data__value__descriptor
.is_value()) return FALSE
;
3118 if(!field_data__value
.is_value()) return FALSE
;
3122 void EMBEDDED_PDV::clean_up()
3124 field_identification
.clean_up();
3125 field_data__value__descriptor
.clean_up();
3126 field_data__value
.clean_up();
3129 void EMBEDDED_PDV::set_param(Module_Param
& param
)
3131 param
.basic_check(Module_Param::BC_VALUE
, "record value");
3132 Module_Param_Ptr mp
= ¶m
;
3133 if (param
.get_type() == Module_Param::MP_Reference
) {
3134 mp
= param
.get_referenced_param();
3136 switch (mp
->get_type()) {
3137 case Module_Param::MP_Value_List
:
3138 if (mp
->get_size()==0) return;
3139 if (3!=mp
->get_size()) {
3140 param
.error("record value of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp
->get_size());
3142 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) identification().set_param(*mp
->get_elem(0));
3143 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) data__value__descriptor().set_param(*mp
->get_elem(1));
3144 if (mp
->get_elem(2)->get_type()!=Module_Param::MP_NotUsed
) data__value().set_param(*mp
->get_elem(2));
3146 case Module_Param::MP_Assignment_List
: {
3147 Vector
<bool> value_used(mp
->get_size());
3148 value_used
.resize(mp
->get_size(), false);
3149 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3150 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3151 if (!strcmp(curr_param
->get_id()->get_name(), "identification")) {
3152 identification().set_param(*curr_param
);
3153 value_used
[val_idx
]=true;
3156 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3157 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3158 if (!strcmp(curr_param
->get_id()->get_name(), "data_value_descriptor")) {
3159 data__value__descriptor().set_param(*curr_param
);
3160 value_used
[val_idx
]=true;
3163 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3164 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3165 if (!strcmp(curr_param
->get_id()->get_name(), "data_value")) {
3166 data__value().set_param(*curr_param
);
3167 value_used
[val_idx
]=true;
3170 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
3171 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
3176 param
.type_error("record value", "EMBEDDED PDV");
3180 Module_Param
* EMBEDDED_PDV::get_param(Module_Param_Name
& param_name
) const
3183 return new Module_Param_Unbound();
3185 Module_Param
* mp_field_identification
= field_identification
.get_param(param_name
);
3186 mp_field_identification
->set_id(new Module_Param_FieldName(mcopystr("identification")));
3187 Module_Param
* mp_field_data_value_descriptor
= field_data__value__descriptor
.get_param(param_name
);
3188 mp_field_data_value_descriptor
->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
3189 Module_Param
* mp_field_data_value
= field_data__value
.get_param(param_name
);
3190 mp_field_data_value
->set_id(new Module_Param_FieldName(mcopystr("data_value")));
3191 Module_Param_Assignment_List
* mp
= new Module_Param_Assignment_List();
3192 mp
->add_elem(mp_field_identification
);
3193 mp
->add_elem(mp_field_data_value_descriptor
);
3194 mp
->add_elem(mp_field_data_value
);
3198 void EMBEDDED_PDV::encode_text(Text_Buf
& text_buf
) const
3200 field_identification
.encode_text(text_buf
);
3201 field_data__value__descriptor
.encode_text(text_buf
);
3202 field_data__value
.encode_text(text_buf
);
3205 void EMBEDDED_PDV::decode_text(Text_Buf
& text_buf
)
3207 field_identification
.decode_text(text_buf
);
3208 field_data__value__descriptor
.decode_text(text_buf
);
3209 field_data__value
.decode_text(text_buf
);
3212 void EMBEDDED_PDV::encode(const TTCN_Typedescriptor_t
& p_td
, TTCN_Buffer
& p_buf
, TTCN_EncDec::coding_t p_coding
, ...) const
3215 va_start(pvar
, p_coding
);
3217 case TTCN_EncDec::CT_BER
: {
3218 TTCN_EncDec_ErrorContext
ec("While BER-encoding type '%s': ", p_td
.name
);
3219 unsigned BER_coding
=va_arg(pvar
, unsigned);
3220 BER_encode_chk_coding(BER_coding
);
3221 ASN_BER_TLV_t
*tlv
=BER_encode_TLV(p_td
, BER_coding
);
3222 tlv
->put_in_buffer(p_buf
);
3223 ASN_BER_TLV_t::destruct(tlv
);
3225 case TTCN_EncDec::CT_RAW
: {
3226 TTCN_EncDec_ErrorContext
ec("While RAW-encoding type '%s': ", p_td
.name
);
3227 TTCN_EncDec_ErrorContext::error_internal
3228 ("No RAW descriptor available for type '%s'.", p_td
.name
);
3230 case TTCN_EncDec::CT_TEXT
: {
3231 TTCN_EncDec_ErrorContext
ec("While TEXT-encoding type '%s': ", p_td
.name
);
3232 TTCN_EncDec_ErrorContext::error_internal
3233 ("No TEXT descriptor available for type '%s'.", p_td
.name
);
3235 case TTCN_EncDec::CT_XER
: {
3236 TTCN_EncDec_ErrorContext
ec("While XER-encoding type '%s': ", p_td
.name
);
3237 unsigned XER_coding
=va_arg(pvar
, unsigned);
3238 XER_encode(*p_td
.xer
,p_buf
, XER_coding
, 0, 0);
3240 case TTCN_EncDec::CT_JSON
: {
3241 TTCN_EncDec_ErrorContext
ec("While JSON-encoding type '%s': ", p_td
.name
);
3242 TTCN_EncDec_ErrorContext::error_internal
3243 ("No JSON descriptor available for type '%s'.", p_td
.name
);
3246 TTCN_error("Unknown coding method requested to encode type '%s'", p_td
.name
);
3251 void EMBEDDED_PDV::decode(const TTCN_Typedescriptor_t
& p_td
, TTCN_Buffer
& p_buf
, TTCN_EncDec::coding_t p_coding
, ...)
3254 va_start(pvar
, p_coding
);
3256 case TTCN_EncDec::CT_BER
: {
3257 TTCN_EncDec_ErrorContext
ec("While BER-decoding type '%s': ", p_td
.name
);
3258 unsigned L_form
=va_arg(pvar
, unsigned);
3260 BER_decode_str2TLV(p_buf
, tlv
, L_form
);
3261 BER_decode_TLV(p_td
, tlv
, L_form
);
3262 if(tlv
.isComplete
) p_buf
.increase_pos(tlv
.get_len());
3264 case TTCN_EncDec::CT_RAW
: {
3265 TTCN_EncDec_ErrorContext
ec("While RAW-decoding type '%s': ", p_td
.name
);
3266 TTCN_EncDec_ErrorContext::error_internal
3267 ("No RAW descriptor available for type '%s'.", p_td
.name
);
3269 case TTCN_EncDec::CT_TEXT
: {
3270 TTCN_EncDec_ErrorContext
ec("While TEXT-decoding type '%s': ", p_td
.name
);
3271 TTCN_EncDec_ErrorContext::error_internal
3272 ("No TEXT descriptor available for type '%s'.", p_td
.name
);
3274 case TTCN_EncDec::CT_XER
: {
3275 TTCN_EncDec_ErrorContext
ec("While XER-decoding type '%s': ", p_td
.name
);
3276 unsigned XER_coding
=va_arg(pvar
, unsigned);
3277 XmlReaderWrap
reader(p_buf
);
3278 int success
= reader
.Read();
3279 for (; success
==1; success
=reader
.Read()) {
3280 int type
= reader
.NodeType();
3281 if (type
==XML_READER_TYPE_ELEMENT
)
3284 XER_decode(*p_td
.xer
, reader
, XER_coding
, XER_NONE
, 0);
3285 size_t bytes
= reader
.ByteConsumed();
3286 p_buf
.set_pos(bytes
);
3288 case TTCN_EncDec::CT_JSON
: {
3289 TTCN_EncDec_ErrorContext
ec("While JSON-decoding type '%s': ", p_td
.name
);
3290 TTCN_EncDec_ErrorContext::error_internal
3291 ("No JSON descriptor available for type '%s'.", p_td
.name
);
3294 TTCN_error("Unknown coding method requested to decode type '%s'", p_td
.name
);
3299 ASN_BER_TLV_t
* EMBEDDED_PDV::BER_encode_TLV(const TTCN_Typedescriptor_t
& p_td
, unsigned p_coding
) const
3301 BER_chk_descr(p_td
);
3302 ASN_BER_TLV_t
*new_tlv
=ASN_BER_TLV_t::construct(NULL
);
3303 TTCN_EncDec_ErrorContext
ec_0("Component '");
3304 TTCN_EncDec_ErrorContext ec_1
;
3305 ec_1
.set_msg("identification': ");
3306 new_tlv
->add_TLV(field_identification
.BER_encode_TLV(EMBEDDED_PDV_identification_descr_
, p_coding
));
3307 ec_1
.set_msg("data_value_descriptor': ");
3308 new_tlv
->add_TLV(field_data__value__descriptor
.BER_encode_TLV(EMBEDDED_PDV_data__value__descriptor_descr_
, p_coding
));
3309 ec_1
.set_msg("data_value': ");
3310 new_tlv
->add_TLV(field_data__value
.BER_encode_TLV(EMBEDDED_PDV_data__value_descr_
, p_coding
));
3311 new_tlv
=ASN_BER_V2TLV(new_tlv
, p_td
, p_coding
);
3315 boolean
EMBEDDED_PDV::BER_decode_TLV(const TTCN_Typedescriptor_t
& p_td
, const ASN_BER_TLV_t
& p_tlv
, unsigned L_form
)
3317 BER_chk_descr(p_td
);
3318 ASN_BER_TLV_t stripped_tlv
;
3319 BER_decode_strip_tags(*p_td
.ber
, p_tlv
, L_form
, stripped_tlv
);
3320 TTCN_EncDec_ErrorContext
ec_0("While decoding 'EMBEDDED PDV' type: ");
3321 stripped_tlv
.chk_constructed_flag(TRUE
);
3323 ASN_BER_TLV_t tmp_tlv
;
3324 boolean tlv_present
=FALSE
;
3326 TTCN_EncDec_ErrorContext
ec_1("Component '");
3327 TTCN_EncDec_ErrorContext ec_2
;
3328 ec_2
.set_msg("identification': ");
3329 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
3330 if(!tlv_present
) return FALSE
;
3331 field_identification
.BER_decode_TLV(EMBEDDED_PDV_identification_descr_
, tmp_tlv
, L_form
);
3333 ec_2
.set_msg("data_value_descriptor': ");
3334 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
3335 if(!tlv_present
) field_data__value__descriptor
=OMIT_VALUE
;
3337 field_data__value__descriptor
.BER_decode_TLV(EMBEDDED_PDV_data__value__descriptor_descr_
, tmp_tlv
, L_form
);
3338 if(field_data__value__descriptor
.ispresent()) tlv_present
=FALSE
;
3340 ec_2
.set_msg("data_value': ");
3341 if(!tlv_present
) tlv_present
=BER_decode_constdTLV_next(stripped_tlv
, V_pos
, L_form
, tmp_tlv
);
3342 if(!tlv_present
) return FALSE
;
3343 field_data__value
.BER_decode_TLV(EMBEDDED_PDV_data__value_descr_
, tmp_tlv
, L_form
);
3346 BER_decode_constdTLV_end(stripped_tlv
, V_pos
, L_form
, tmp_tlv
, tlv_present
);
3350 int EMBEDDED_PDV::XER_encode(const XERdescriptor_t
& p_td
,
3351 TTCN_Buffer
& p_buf
, unsigned int flavor
, int indent
, embed_values_enc_struct_t
*) const {
3353 TTCN_EncDec_ErrorContext::error
3354 (TTCN_EncDec::ET_UNBOUND
, "Encoding an unbound value.");
3356 int indenting
= !is_canonical(flavor
);
3357 int exer
= is_exer(flavor
);
3358 int encoded_length
=(int)p_buf
.get_len();
3359 if (indenting
) do_indent(p_buf
, indent
);
3361 if (exer
) write_ns_prefix(p_td
, p_buf
);
3362 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
3365 field_identification
.XER_encode(EMBEDDED_PDV_identification_xer_
, p_buf
, flavor
, indent
, 0);
3366 if (field_data__value__descriptor
.is_value()) {
3367 TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG
,
3368 "data-value-descriptor not allowed for EMBEDDED PDV");
3370 field_data__value__descriptor
.XER_encode(EMBEDDED_PDV_data_value_descriptor_xer_
, p_buf
, flavor
, indent
, 0);
3371 field_data__value
.XER_encode(EMBEDDED_PDV_data_value_xer_
, p_buf
, flavor
, indent
, 0);
3373 if (indenting
) do_indent(p_buf
, --indent
);
3376 if (exer
) write_ns_prefix(p_td
, p_buf
);
3377 p_buf
.put_s((size_t)p_td
.namelens
[exer
] - 1 + indenting
, (const unsigned char*)p_td
.names
[exer
]);
3378 return (int)p_buf
.get_len() - encoded_length
;
3381 int EMBEDDED_PDV::XER_decode(const XERdescriptor_t
& p_td
, XmlReaderWrap
& reader
, unsigned int flavor
, unsigned int flavor2
, embed_values_dec_struct_t
*)
3383 int exer
= is_exer(flavor
);
3384 int depth
= 1, type
, success
;
3385 for (success
= reader
.Ok(); success
== 1; success
= reader
.Read()) {
3386 type
= reader
.NodeType();
3387 if (type
==XML_READER_TYPE_ELEMENT
) {
3388 verify_name(reader
, p_td
, exer
);
3389 depth
= reader
.Depth();
3394 field_identification
.XER_decode(EMBEDDED_PDV_identification_xer_
, reader
, flavor
, flavor2
, 0);
3395 field_data__value__descriptor
.XER_decode(EMBEDDED_PDV_data_value_descriptor_xer_
, reader
, flavor
, flavor2
, 0);
3396 if (field_data__value__descriptor
.is_value()) {
3397 TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG
,
3398 "data-value-descriptor not allowed for EMBEDDED PDV");
3400 field_data__value
.XER_decode(EMBEDDED_PDV_data_value_xer_
, reader
, flavor
, flavor2
, 0);
3401 for (success
= reader
.Read(); success
== 1; success
= reader
.Read()) {
3402 type
= reader
.NodeType();
3403 if (XML_READER_TYPE_END_ELEMENT
== type
) {
3404 verify_end(reader
, p_td
, depth
, exer
);
3412 struct EMBEDDED_PDV_template::single_value_struct
{
3413 EMBEDDED_PDV_identification_template field_identification
;
3414 UNIVERSAL_CHARSTRING_template field_data__value__descriptor
;
3415 OCTETSTRING_template field_data__value
;
3418 void EMBEDDED_PDV_template::set_param(Module_Param
& param
)
3420 param
.basic_check(Module_Param::BC_TEMPLATE
, "record template");
3421 Module_Param_Ptr mp
= ¶m
;
3422 if (param
.get_type() == Module_Param::MP_Reference
) {
3423 mp
= param
.get_referenced_param();
3425 switch (mp
->get_type()) {
3426 case Module_Param::MP_Omit
:
3429 case Module_Param::MP_Any
:
3432 case Module_Param::MP_AnyOrNone
:
3433 *this = ANY_OR_OMIT
;
3435 case Module_Param::MP_List_Template
:
3436 case Module_Param::MP_ComplementList_Template
: {
3437 EMBEDDED_PDV_template temp
;
3438 temp
.set_type(mp
->get_type() == Module_Param::MP_List_Template
?
3439 VALUE_LIST
: COMPLEMENTED_LIST
, mp
->get_size());
3440 for (size_t i
=0; i
<mp
->get_size(); i
++) {
3441 temp
.list_item(i
).set_param(*mp
->get_elem(i
));
3445 case Module_Param::MP_Value_List
:
3446 if (mp
->get_size()==0) break;
3447 if (3!=mp
->get_size()) {
3448 param
.error("record template of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp
->get_size());
3450 if (mp
->get_elem(0)->get_type()!=Module_Param::MP_NotUsed
) identification().set_param(*mp
->get_elem(0));
3451 if (mp
->get_elem(1)->get_type()!=Module_Param::MP_NotUsed
) data__value__descriptor().set_param(*mp
->get_elem(1));
3452 if (mp
->get_elem(2)->get_type()!=Module_Param::MP_NotUsed
) data__value().set_param(*mp
->get_elem(2));
3454 case Module_Param::MP_Assignment_List
: {
3455 Vector
<bool> value_used(mp
->get_size());
3456 value_used
.resize(mp
->get_size(), false);
3457 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3458 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3459 if (!strcmp(curr_param
->get_id()->get_name(), "identification")) {
3460 identification().set_param(*curr_param
);
3461 value_used
[val_idx
]=true;
3464 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3465 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3466 if (!strcmp(curr_param
->get_id()->get_name(), "data_value_descriptor")) {
3467 data__value__descriptor().set_param(*curr_param
);
3468 value_used
[val_idx
]=true;
3471 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) {
3472 Module_Param
* const curr_param
= mp
->get_elem(val_idx
);
3473 if (!strcmp(curr_param
->get_id()->get_name(), "data_value")) {
3474 data__value().set_param(*curr_param
);
3475 value_used
[val_idx
]=true;
3478 for (size_t val_idx
=0; val_idx
<mp
->get_size(); val_idx
++) if (!value_used
[val_idx
]) {
3479 mp
->get_elem(val_idx
)->error("Non existent field name in type EMBEDDED PDV: %s", mp
->get_elem(val_idx
)->get_id()->get_name());
3484 param
.type_error("record template", "EMBEDDED PDV");
3486 is_ifpresent
= param
.get_ifpresent() || mp
->get_ifpresent();
3489 Module_Param
* EMBEDDED_PDV_template::get_param(Module_Param_Name
& param_name
) const
3491 Module_Param
* mp
= NULL
;
3492 switch (template_selection
) {
3493 case UNINITIALIZED_TEMPLATE
:
3494 mp
= new Module_Param_Unbound();
3497 mp
= new Module_Param_Omit();
3500 mp
= new Module_Param_Any();
3503 mp
= new Module_Param_AnyOrNone();
3505 case SPECIFIC_VALUE
: {
3506 Module_Param
* mp_field_identification
= single_value
->field_identification
.get_param(param_name
);
3507 mp_field_identification
->set_id(new Module_Param_FieldName(mcopystr("identification")));
3508 Module_Param
* mp_field_data_value_descriptor
= single_value
->field_data__value__descriptor
.get_param(param_name
);
3509 mp_field_data_value_descriptor
->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
3510 Module_Param
* mp_field_string_value
= single_value
->field_data__value
.get_param(param_name
);
3511 mp_field_string_value
->set_id(new Module_Param_FieldName(mcopystr("data_value")));
3512 mp
= new Module_Param_Assignment_List();
3513 mp
->add_elem(mp_field_identification
);
3514 mp
->add_elem(mp_field_data_value_descriptor
);
3515 mp
->add_elem(mp_field_string_value
);
3518 case COMPLEMENTED_LIST
: {
3519 if (template_selection
== VALUE_LIST
) {
3520 mp
= new Module_Param_List_Template();
3523 mp
= new Module_Param_ComplementList_Template();
3525 for (size_t i
= 0; i
< value_list
.n_values
; ++i
) {
3526 mp
->add_elem(value_list
.list_value
[i
].get_param(param_name
));
3533 mp
->set_ifpresent();
3538 void EMBEDDED_PDV_template::clean_up()
3540 switch (template_selection
) {
3541 case SPECIFIC_VALUE
:
3542 delete single_value
;
3545 case COMPLEMENTED_LIST
:
3546 delete [] value_list
.list_value
;
3551 template_selection
= UNINITIALIZED_TEMPLATE
;
3554 void EMBEDDED_PDV_template::set_specific()
3556 if (template_selection
!= SPECIFIC_VALUE
) {
3557 template_sel old_selection
= template_selection
;
3559 single_value
= new single_value_struct
;
3560 set_selection(SPECIFIC_VALUE
);
3561 if (old_selection
== ANY_VALUE
|| old_selection
== ANY_OR_OMIT
) {
3562 single_value
->field_identification
= ANY_VALUE
;
3563 single_value
->field_data__value__descriptor
= ANY_OR_OMIT
;
3564 single_value
->field_data__value
= ANY_VALUE
;
3569 void EMBEDDED_PDV_template::copy_value(const EMBEDDED_PDV
& other_value
)
3571 single_value
= new single_value_struct
;
3572 single_value
->field_identification
= other_value
.identification();
3573 if (other_value
.data__value__descriptor().ispresent()) single_value
->field_data__value__descriptor
= (const UNIVERSAL_CHARSTRING
&)(other_value
.data__value__descriptor());
3574 else single_value
->field_data__value__descriptor
= OMIT_VALUE
;
3575 single_value
->field_data__value
= other_value
.data__value();
3576 set_selection(SPECIFIC_VALUE
);
3579 void EMBEDDED_PDV_template::copy_template(const EMBEDDED_PDV_template
& other_value
)
3581 switch (other_value
.template_selection
) {
3582 case SPECIFIC_VALUE
:
3583 single_value
= new single_value_struct(*other_value
.single_value
);
3590 case COMPLEMENTED_LIST
:
3591 value_list
.n_values
= other_value
.value_list
.n_values
;
3592 value_list
.list_value
= new EMBEDDED_PDV_template
[value_list
.n_values
];
3593 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3594 value_list
.list_value
[list_count
].copy_template(other_value
.value_list
.list_value
[list_count
]);
3597 TTCN_error("Copying an uninitialized/unsupported template of type EMBEDDED PDV.");
3599 set_selection(other_value
);
3602 EMBEDDED_PDV_template::EMBEDDED_PDV_template()
3606 EMBEDDED_PDV_template::EMBEDDED_PDV_template(template_sel other_value
)
3607 : Base_Template(other_value
)
3609 check_single_selection(other_value
);
3612 EMBEDDED_PDV_template::EMBEDDED_PDV_template(const EMBEDDED_PDV
& other_value
)
3614 copy_value(other_value
);
3617 EMBEDDED_PDV_template::EMBEDDED_PDV_template(const OPTIONAL
<EMBEDDED_PDV
>& other_value
)
3619 switch (other_value
.get_selection()) {
3620 case OPTIONAL_PRESENT
:
3621 copy_value((const EMBEDDED_PDV
&)other_value
);
3624 set_selection(OMIT_VALUE
);
3627 TTCN_error("Creating a template of type EMBEDDED PDV from an unbound optional field.");
3631 EMBEDDED_PDV_template::EMBEDDED_PDV_template(const EMBEDDED_PDV_template
& other_value
)
3634 copy_template(other_value
);
3637 EMBEDDED_PDV_template::~EMBEDDED_PDV_template()
3642 EMBEDDED_PDV_template
& EMBEDDED_PDV_template::operator=(template_sel other_value
)
3644 check_single_selection(other_value
);
3646 set_selection(other_value
);
3650 EMBEDDED_PDV_template
& EMBEDDED_PDV_template::operator=(const EMBEDDED_PDV
& other_value
)
3653 copy_value(other_value
);
3657 EMBEDDED_PDV_template
& EMBEDDED_PDV_template::operator=(const OPTIONAL
<EMBEDDED_PDV
>& other_value
)
3660 switch (other_value
.get_selection()) {
3661 case OPTIONAL_PRESENT
:
3662 copy_value((const EMBEDDED_PDV
&)other_value
);
3665 set_selection(OMIT_VALUE
);
3668 TTCN_error("Assignment of an unbound optional field to a template of type EMBEDDED PDV.");
3673 EMBEDDED_PDV_template
& EMBEDDED_PDV_template::operator=(const EMBEDDED_PDV_template
& other_value
)
3675 if (&other_value
!= this) {
3677 copy_template(other_value
);
3682 boolean
EMBEDDED_PDV_template::match(const EMBEDDED_PDV
& other_value
,
3683 boolean
/* legacy */) const
3685 switch (template_selection
) {
3691 case SPECIFIC_VALUE
:
3692 if (!other_value
.identification().is_bound()) return FALSE
;
3693 if (!single_value
->field_identification
.match(other_value
.identification())) return FALSE
;
3694 if (!other_value
.data__value__descriptor().is_bound()) return FALSE
;
3695 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
;
3696 if (!other_value
.data__value().is_bound()) return FALSE
;
3697 if (!single_value
->field_data__value
.match(other_value
.data__value())) return FALSE
;
3700 case COMPLEMENTED_LIST
:
3701 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3702 if (value_list
.list_value
[list_count
].match(other_value
)) return template_selection
== VALUE_LIST
;
3703 return template_selection
== COMPLEMENTED_LIST
;
3705 TTCN_error("Matching an uninitialized/unsupported template of type EMBEDDED PDV.");
3710 EMBEDDED_PDV
EMBEDDED_PDV_template::valueof() const
3712 if (template_selection
!= SPECIFIC_VALUE
|| is_ifpresent
)
3713 TTCN_error("Performing valueof or send operation on a non-specific template of type EMBEDDED PDV.");
3714 EMBEDDED_PDV ret_val
;
3715 ret_val
.identification() = single_value
->field_identification
.valueof();
3716 if (single_value
->field_data__value__descriptor
.is_omit()) ret_val
.data__value__descriptor() = OMIT_VALUE
;
3717 else ret_val
.data__value__descriptor() = single_value
->field_data__value__descriptor
.valueof();
3718 ret_val
.data__value() = single_value
->field_data__value
.valueof();
3722 void EMBEDDED_PDV_template::set_type(template_sel template_type
, unsigned int list_length
)
3724 if (template_type
!= VALUE_LIST
&& template_type
!= COMPLEMENTED_LIST
)
3725 TTCN_error("Setting an invalid list for a template of type EMBEDDED PDV.");
3727 set_selection(template_type
);
3728 value_list
.n_values
= list_length
;
3729 value_list
.list_value
= new EMBEDDED_PDV_template
[list_length
];
3732 EMBEDDED_PDV_template
& EMBEDDED_PDV_template::list_item(unsigned int list_index
) const
3734 if (template_selection
!= VALUE_LIST
&& template_selection
!= COMPLEMENTED_LIST
)
3735 TTCN_error("Accessing a list element of a non-list template of type EMBEDDED PDV.");
3736 if (list_index
>= value_list
.n_values
)
3737 TTCN_error("Index overflow in a value list template of type EMBEDDED PDV.");
3738 return value_list
.list_value
[list_index
];
3741 EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_template::identification()
3744 return single_value
->field_identification
;
3747 const EMBEDDED_PDV_identification_template
& EMBEDDED_PDV_template::identification() const
3749 if (template_selection
!= SPECIFIC_VALUE
)
3750 TTCN_error("Accessing field identification of a non-specific template of type EMBEDDED PDV.");
3751 return single_value
->field_identification
;
3754 UNIVERSAL_CHARSTRING_template
& EMBEDDED_PDV_template::data__value__descriptor()
3757 return single_value
->field_data__value__descriptor
;
3760 const UNIVERSAL_CHARSTRING_template
& EMBEDDED_PDV_template::data__value__descriptor() const
3762 if (template_selection
!= SPECIFIC_VALUE
)
3763 TTCN_error("Accessing field data_value_descriptor of a non-specific template of type EMBEDDED PDV.");
3764 return single_value
->field_data__value__descriptor
;
3767 OCTETSTRING_template
& EMBEDDED_PDV_template::data__value()
3770 return single_value
->field_data__value
;
3773 const OCTETSTRING_template
& EMBEDDED_PDV_template::data__value() const
3775 if (template_selection
!= SPECIFIC_VALUE
)
3776 TTCN_error("Accessing field data_value of a non-specific template of type EMBEDDED PDV.");
3777 return single_value
->field_data__value
;
3780 int EMBEDDED_PDV_template::size_of() const
3782 switch (template_selection
)
3784 case SPECIFIC_VALUE
:
3787 if (single_value
->field_data__value__descriptor
.is_present()) ret_val
++;
3792 if (value_list
.n_values
<1)
3793 TTCN_error("Internal error: Performing sizeof() operation on a template of type EMBEDDED PDV containing an empty list.");
3794 int item_size
= value_list
.list_value
[0].size_of();
3795 for (unsigned int i
= 1; i
< value_list
.n_values
; i
++)
3797 if (value_list
.list_value
[i
].size_of()!=item_size
)
3798 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV containing a value list with different sizes.");
3803 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV containing omit value.");
3806 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV containing */? value.");
3807 case COMPLEMENTED_LIST
:
3808 TTCN_error("Performing sizeof() operation on a template of type EMBEDDED PDV containing complemented list.");
3810 TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type EMBEDDED PDV.");
3815 void EMBEDDED_PDV_template::log() const
3817 switch (template_selection
) {
3818 case SPECIFIC_VALUE
:
3819 TTCN_Logger::log_event_str("{ identification := ");
3820 single_value
->field_identification
.log();
3821 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3822 single_value
->field_data__value__descriptor
.log();
3823 TTCN_Logger::log_event_str(", data_value := ");
3824 single_value
->field_data__value
.log();
3825 TTCN_Logger::log_event_str(" }");
3827 case COMPLEMENTED_LIST
:
3828 TTCN_Logger::log_event_str("complement ");
3831 TTCN_Logger::log_char('(');
3832 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++) {
3833 if (list_count
> 0) TTCN_Logger::log_event_str(", ");
3834 value_list
.list_value
[list_count
].log();
3836 TTCN_Logger::log_char(')');
3845 void EMBEDDED_PDV_template::log_match(const EMBEDDED_PDV
& match_value
,
3846 boolean
/* legacy */) const
3848 if (template_selection
== SPECIFIC_VALUE
) {
3849 TTCN_Logger::log_event_str("{ identification := ");
3850 single_value
->field_identification
.log_match(match_value
.identification());
3851 TTCN_Logger::log_event_str(", data_value_descriptor := ");
3852 if (match_value
.data__value__descriptor().ispresent()) single_value
->field_data__value__descriptor
.log_match(match_value
.data__value__descriptor());
3854 single_value
->field_data__value__descriptor
.log();
3855 if (single_value
->field_data__value__descriptor
.match_omit()) TTCN_Logger::log_event_str(" matched");
3856 else TTCN_Logger::log_event_str(" unmatched");
3859 TTCN_Logger::log_event_str(", data_value := ");
3860 single_value
->field_data__value
.log_match(match_value
.data__value());
3861 TTCN_Logger::log_event_str(" }");
3864 TTCN_Logger::log_event_str(" with ");
3866 if (match(match_value
)) TTCN_Logger::log_event_str(" matched");
3867 else TTCN_Logger::log_event_str(" unmatched");
3871 void EMBEDDED_PDV_template::encode_text(Text_Buf
& text_buf
) const
3873 encode_text_base(text_buf
);
3874 switch (template_selection
) {
3875 case SPECIFIC_VALUE
:
3876 single_value
->field_identification
.encode_text(text_buf
);
3877 single_value
->field_data__value__descriptor
.encode_text(text_buf
);
3878 single_value
->field_data__value
.encode_text(text_buf
);
3885 case COMPLEMENTED_LIST
:
3886 text_buf
.push_int(value_list
.n_values
);
3887 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3888 value_list
.list_value
[list_count
].encode_text(text_buf
);
3891 TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type EMBEDDED PDV.");
3895 void EMBEDDED_PDV_template::decode_text(Text_Buf
& text_buf
)
3898 decode_text_base(text_buf
);
3899 switch (template_selection
) {
3900 case SPECIFIC_VALUE
:
3901 single_value
= new single_value_struct
;
3902 single_value
->field_identification
.decode_text(text_buf
);
3903 single_value
->field_data__value__descriptor
.decode_text(text_buf
);
3904 single_value
->field_data__value
.decode_text(text_buf
);
3911 case COMPLEMENTED_LIST
:
3912 value_list
.n_values
= text_buf
.pull_int().get_val();
3913 value_list
.list_value
= new EMBEDDED_PDV_template
[value_list
.n_values
];
3914 for (unsigned int list_count
= 0; list_count
< value_list
.n_values
; list_count
++)
3915 value_list
.list_value
[list_count
].decode_text(text_buf
);
3918 TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type EMBEDDED PDV.");
3922 boolean
EMBEDDED_PDV_template::is_present(boolean legacy
/* = FALSE */) const
3924 if (template_selection
==UNINITIALIZED_TEMPLATE
) return FALSE
;
3925 return !match_omit(legacy
);
3928 boolean
EMBEDDED_PDV_template::match_omit(boolean legacy
/* = FALSE */) const
3930 if (is_ifpresent
) return TRUE
;
3931 switch (template_selection
) {
3936 case COMPLEMENTED_LIST
:
3938 // legacy behavior: 'omit' can appear in the value/complement list
3939 for (unsigned int i
=0; i
<value_list
.n_values
; i
++)
3940 if (value_list
.list_value
[i
].match_omit())
3941 return template_selection
==VALUE_LIST
;
3942 return template_selection
==COMPLEMENTED_LIST
;
3944 // else fall through
3951 #ifndef TITAN_RUNTIME_2
3952 void EMBEDDED_PDV_template::check_restriction(template_res t_res
, const char* t_name
,
3953 boolean legacy
/* = FALSE */) const
3955 if (template_selection
==UNINITIALIZED_TEMPLATE
) return;
3956 switch ((t_name
&&(t_res
==TR_VALUE
))?TR_OMIT
:t_res
) {
3958 if (!is_ifpresent
&& template_selection
==SPECIFIC_VALUE
) return;
3961 if (!is_ifpresent
&& (template_selection
==OMIT_VALUE
||
3962 template_selection
==SPECIFIC_VALUE
)) return;
3965 if (!match_omit(legacy
)) return;
3970 TTCN_error("Restriction `%s' on template of type %s violated.",
3971 get_res_name(t_res
), t_name
? t_name
: "EMBEDDED PDV");