// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version 11.1.0
// The generation of user and time information were disabled by the -D flag.

// Copyright (c) 2000-2025 Ericsson Telecom AB

// Do not edit this file unless you know what you are doing.

/* Including header files */

#include "IPA_Testing.hh"

namespace IPA__Testing {

/* Literal string constants */

const unsigned char os_0_octets[] = { 0, 1, 254, 0 },
os_1_octets[] = { 0, 1, 254, 1 },
os_2_octets[] = { 0, 7, 254 },
os_3_octets[] = { 4, 1, 8, 1, 7, 1, 2 },
os_5_octets[] = { 5 },
os_4_octets[] = { 254 };
extern const OCTETSTRING os_0(4, os_0_octets),
os_1(4, os_1_octets),
os_2(3, os_2_octets),
os_3(7, os_3_octets),
os_5(1, os_5_octets),
os_4(1, os_4_octets);
extern const CHARSTRING cs_0(0, NULL);
const unsigned char module_checksum[] = { 0x4e, 0x04, 0xb4, 0x16, 0x7a, 0xce, 0x27, 0x3d, 0xce, 0xf7, 0x38, 0x1b, 0x3c, 0xdc, 0xb1, 0x79 };

/* Global variable definitions */

// No XER for IPA__ConnectionMode
const TTCN_Typedescriptor_t IPA__ConnectionMode_descr_ = { "@IPA_Testing.IPA_ConnectionMode", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
OCTETSTRING const_ipa__msg__ping;
const OCTETSTRING& ipa__msg__ping = const_ipa__msg__ping;
OCTETSTRING const_ipa__msg__pong;
const OCTETSTRING& ipa__msg__pong = const_ipa__msg__pong;
OCTETSTRING const_ipa__msg__id__req__hdr;
const OCTETSTRING& ipa__msg__id__req__hdr = const_ipa__msg__id__req__hdr;
OCTETSTRING const_ipa__msg__id__req__payload;
const OCTETSTRING& ipa__msg__id__req__payload = const_ipa__msg__id__req__payload;
const TTCN_Typedescriptor_t& system__CT_descr_ = COMPONENT_descr_;
IPL4asp__PortType::IPL4asp__PT system__CT_component_IPL4("IPL4");
const TTCN_Typedescriptor_t& IPA__CT_descr_ = COMPONENT_descr_;
IPL4asp__PortType::IPL4asp__PT IPA__CT_component_IPL4("IPL4");
TIMER IPA__CT_component_g__Tguard("g_Tguard");
TTCN_Module module_object("IPA_Testing", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, init_comp_type, init_system_port, start_ptc_function, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_11,
  current_runtime_version.requires_minor_version_1,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

IPA__ConnectionMode::IPA__ConnectionMode()
{
enum_value = UNBOUND_VALUE;
}

IPA__ConnectionMode::IPA__ConnectionMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @IPA_Testing.IPA_ConnectionMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

IPA__ConnectionMode::IPA__ConnectionMode(enum_type other_value)
{
enum_value = other_value;
}

IPA__ConnectionMode::IPA__ConnectionMode(const IPA__ConnectionMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
enum_value = other_value.enum_value;
}

IPA__ConnectionMode& IPA__ConnectionMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @IPA_Testing.IPA_ConnectionMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

IPA__ConnectionMode& IPA__ConnectionMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

IPA__ConnectionMode& IPA__ConnectionMode::operator=(const IPA__ConnectionMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean IPA__ConnectionMode::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @IPA_Testing.IPA_ConnectionMode comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean IPA__ConnectionMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value == other_value;
}

boolean IPA__ConnectionMode::operator==(const IPA__ConnectionMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value == other_value.enum_value;
}

boolean IPA__ConnectionMode::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @IPA_Testing.IPA_ConnectionMode comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean IPA__ConnectionMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value < other_value;
}

boolean IPA__ConnectionMode::operator<(const IPA__ConnectionMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value < other_value.enum_value;
}

boolean IPA__ConnectionMode::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @IPA_Testing.IPA_ConnectionMode comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean IPA__ConnectionMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value > other_value;
}

boolean IPA__ConnectionMode::operator>(const IPA__ConnectionMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value > other_value.enum_value;
}

const char *IPA__ConnectionMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case CONNECT__TO__SERVER: return "CONNECT_TO_SERVER";
case LISTEN__FOR__CLIENT: return "LISTEN_FOR_CLIENT";
default:
return "<unknown>";
}
}

IPA__ConnectionMode::enum_type IPA__ConnectionMode::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "CONNECT_TO_SERVER")) return CONNECT__TO__SERVER;
if (!strcmp(str_par, "LISTEN_FOR_CLIENT")) return LISTEN__FOR__CLIENT;
}
return UNKNOWN_VALUE;
}

boolean IPA__ConnectionMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
return TRUE;
default:
return FALSE;
}
}

int IPA__ConnectionMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Testing.IPA_ConnectionMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int IPA__ConnectionMode::enum2int(const IPA__ConnectionMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Testing.IPA_ConnectionMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void IPA__ConnectionMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @IPA_Testing.IPA_ConnectionMode.", int_val);
enum_value = (enum_type)int_val;
}

IPA__ConnectionMode::operator IPA__ConnectionMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return enum_value;
}

void IPA__ConnectionMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void IPA__ConnectionMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@IPA_Testing.IPA_ConnectionMode");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @IPA_Testing.IPA_ConnectionMode.");
  }
}

void IPA__ConnectionMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
text_buf.push_int(enum_value);
}

void IPA__ConnectionMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @IPA_Testing.IPA_ConnectionMode.", enum_value);
}

void IPA__ConnectionMode_template::copy_template(const IPA__ConnectionMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new IPA__ConnectionMode_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new IPA__ConnectionMode_template(*other_value.implication_.precondition);
implication_.implied_template = new IPA__ConnectionMode_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template()
{
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!IPA__ConnectionMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @IPA_Testing.IPA_ConnectionMode with unknown numeric value %d.", other_value);
single_value = (IPA__ConnectionMode::enum_type)other_value;
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(IPA__ConnectionMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(const IPA__ConnectionMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == IPA__ConnectionMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode.");
single_value = other_value.enum_value;
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(const OPTIONAL<IPA__ConnectionMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IPA__ConnectionMode::enum_type)(const IPA__ConnectionMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @IPA_Testing.IPA_ConnectionMode from an unbound optional field.");
}
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(IPA__ConnectionMode_template* p_precondition, IPA__ConnectionMode_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(Dynamic_Match_Interface<IPA__ConnectionMode>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<IPA__ConnectionMode>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

IPA__ConnectionMode_template::IPA__ConnectionMode_template(const IPA__ConnectionMode_template& other_value)
 : Base_Template()
{
copy_template(other_value);
}

IPA__ConnectionMode_template::~IPA__ConnectionMode_template()
{
clean_up();
}

boolean IPA__ConnectionMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean IPA__ConnectionMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != IPA__ConnectionMode::UNBOUND_VALUE;
}

void IPA__ConnectionMode_template::clean_up()
{
switch (template_selection) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(int other_value)
{
if (!IPA__ConnectionMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @IPA_Testing.IPA_ConnectionMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (IPA__ConnectionMode::enum_type)other_value;
return *this;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(IPA__ConnectionMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(const IPA__ConnectionMode& other_value)
{
if (other_value.enum_value == IPA__ConnectionMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Testing.IPA_ConnectionMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(const OPTIONAL<IPA__ConnectionMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IPA__ConnectionMode::enum_type)(const IPA__ConnectionMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
return *this;
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::operator=(const IPA__ConnectionMode_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean IPA__ConnectionMode_template::match(IPA__ConnectionMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
return FALSE;
}

boolean IPA__ConnectionMode_template::match(const IPA__ConnectionMode& other_value, boolean) const
{
if (other_value.enum_value == IPA__ConnectionMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @IPA_Testing.IPA_ConnectionMode with an unbound value.");
return match(other_value.enum_value);
}

IPA__ConnectionMode::enum_type IPA__ConnectionMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return single_value;
}

void IPA__ConnectionMode_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IPA__ConnectionMode_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
}

IPA__ConnectionMode_template& IPA__ConnectionMode_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
return value_list.list_value[list_index];
}

void IPA__ConnectionMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(IPA__ConnectionMode::enum_to_str(single_value), single_value);
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void IPA__ConnectionMode_template::log_match(const IPA__ConnectionMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void IPA__ConnectionMode_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
}

void IPA__ConnectionMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (IPA__ConnectionMode::enum_type)text_buf.pull_int().get_val();
if (!IPA__ConnectionMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @IPA_Testing.IPA_ConnectionMode.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new IPA__ConnectionMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @IPA_Testing.IPA_ConnectionMode.");
}
}

boolean IPA__ConnectionMode_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean IPA__ConnectionMode_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void IPA__ConnectionMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    IPA__ConnectionMode_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    IPA__ConnectionMode::enum_type enum_val = IPA__ConnectionMode::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!IPA__ConnectionMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @IPA_Testing.IPA_ConnectionMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    IPA__ConnectionMode_template* precondition = new IPA__ConnectionMode_template;
    precondition->set_param(*m_p->get_elem(0));
    IPA__ConnectionMode_template* implied_template = new IPA__ConnectionMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = IPA__ConnectionMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@IPA_Testing.IPA_ConnectionMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void IPA__ConnectionMode_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@IPA_Testing.IPA_ConnectionMode");
}

as__Tguard_Default::as__Tguard_Default()
 : Default_Base("as_Tguard")
{
}

alt_status as__Tguard_Default::call_altstep(boolean first_alt_run)
{
return as__Tguard_instance(first_alt_run);
}


/* Bodies of functions, altsteps and testcases */

alt_status as__Tguard_instance(boolean first_alt_run)
{
TTCN_Location current_location("IPA_Testing.ttcn", 52, TTCN_Location::LOCATION_ALTSTEP, "as_Tguard");
alt_status ret_val = ALT_NO;
current_location.update_lineno(53);
/* IPA_Testing.ttcn, line 53 */
switch (IPA__CT_component_g__Tguard.timeout(NULL)) {
case ALT_YES:
{
current_location.update_lineno(54);
/* IPA_Testing.ttcn, line 54 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Tguard timeout"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(55);
/* IPA_Testing.ttcn, line 55 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
case ALT_MAYBE:
ret_val = ALT_MAYBE;
default:
break;
}
return ret_val;
}

void as__Tguard(boolean nodefault_modifier)
{
altstep_begin:
boolean block_flag = FALSE;
alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
for ( ; ; ) {
TTCN_Snapshot::take_new(block_flag);
if (altstep_flag != ALT_NO) {
altstep_flag = as__Tguard_instance(!block_flag);
if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return;
else if (altstep_flag == ALT_REPEAT) goto altstep_begin;
}
if (!nodefault_modifier && default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(!block_flag);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) return;
else if (default_flag == ALT_REPEAT) goto altstep_begin;
}
if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_Tguard.");
else block_flag = TRUE;
}
}

Default_Base *activate_as__Tguard()
{
return new as__Tguard_Default();
}

void f__send__ipa__data(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const INTEGER& connId, const OCTETSTRING& data)
{
TTCN_Location current_location("IPA_Testing.ttcn", 60, TTCN_Location::LOCATION_FUNCTION, "f_send_ipa_data");
current_location.update_lineno(62);
/* IPA_Testing.ttcn, line 62 */
Socket__API__Definitions::Result res;
current_location.update_lineno(63);
/* IPA_Testing.ttcn, line 63 */
IPL4asp__Types::ASP__SendTo asp;
asp.connId() = connId;
asp.remName() = ipa__ip;
asp.remPort() = ipa__tcp__port;
asp.proto()().tcp() = NULL_VALUE;
asp.msg() = data;
current_location.update_lineno(70);
/* IPA_Testing.ttcn, line 70 */
IPA__CT_component_IPL4.send(asp, FALSE, NULL);
}

void start_f__send__ipa__data(const COMPONENT& component_reference, const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const INTEGER& connId, const OCTETSTRING& data)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_ipa_data(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
connId.log();
TTCN_Logger::log_event_str(", ");
data.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Testing", "f_send_ipa_data", text_buf);
ipa__ip.encode_text(text_buf);
ipa__tcp__port.encode_text(text_buf);
connId.encode_text(text_buf);
data.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

IPL4asp__Types::ASP__RecvFrom_template t__recvfrom(const OCTETSTRING_template& msg)
{
TTCN_Location current_location("IPA_Testing.ttcn", 74, TTCN_Location::LOCATION_TEMPLATE, "t_recvfrom");
IPL4asp__Types::ASP__RecvFrom_template ret_val;
ret_val.connId() = ANY_VALUE;
ret_val.remName() = ANY_VALUE;
ret_val.remPort() = ANY_VALUE;
ret_val.locName() = ANY_VALUE;
ret_val.locPort() = ANY_VALUE;
ret_val.proto().tcp() = NULL_VALUE;
ret_val.userData() = ANY_VALUE;
ret_val.msg() = msg;
return ret_val;
}

INTEGER f__init(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Location current_location("IPA_Testing.ttcn", 86, TTCN_Location::LOCATION_FUNCTION, "f_init");
current_location.update_lineno(88);
/* IPA_Testing.ttcn, line 88 */
Socket__API__Definitions::Result res;
current_location.update_lineno(89);
/* IPA_Testing.ttcn, line 89 */
INTEGER connId;
current_location.update_lineno(91);
/* IPA_Testing.ttcn, line 91 */
{
Map_Params tmp_0(0);
TTCN_Runtime::map_port(self, IPA__CT_component_IPL4.get_name(), SYSTEM_COMPREF, "IPL4", tmp_0);
}
current_location.update_lineno(92);
/* IPA_Testing.ttcn, line 92 */
if ((conmode == IPA__ConnectionMode::CONNECT__TO__SERVER)) {
current_location.update_lineno(94);
/* IPA_Testing.ttcn, line 94 */
Socket__API__Definitions::ProtoTuple tmp_2;
tmp_2.tcp() = NULL_VALUE;
res = IPL4asp__PortType::f__IPL4__connect(IPA__CT_component_IPL4, ipa__ip, ipa__tcp__port, cs_0, -1, 0, tmp_2, IPL4asp__PortType::f__IPL4__connect_options_defval);
current_location.update_lineno(95);
/* IPA_Testing.ttcn, line 95 */
{
boolean tmp_6;
{
boolean tmp_3 = res.is_bound();
if(tmp_3) {
const OPTIONAL< INTEGER >& tmp_4 = res.connId();
switch (tmp_4.get_selection()) {
case OPTIONAL_UNBOUND:
tmp_3 = FALSE;
break;
case OPTIONAL_OMIT:
tmp_3 = FALSE;
break;
default:
{
const INTEGER& tmp_5 = (const INTEGER&) tmp_4;
tmp_3 = tmp_5.is_present();
break;}
}
}
tmp_6 = (!(tmp_3));
}
if (tmp_6) {
current_location.update_lineno(96);
/* IPA_Testing.ttcn, line 96 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not connect IPA socket to "),ipa__ip.log(),TTCN_Logger::log_event_str(" port "),ipa__tcp__port.log(),TTCN_Logger::log_event_str("; check your configuration"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(98);
/* IPA_Testing.ttcn, line 98 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
}
}
else {
current_location.update_lineno(102);
/* IPA_Testing.ttcn, line 102 */
Socket__API__Definitions::ProtoTuple tmp_8;
tmp_8.tcp() = NULL_VALUE;
res = IPL4asp__PortType::f__IPL4__listen(IPA__CT_component_IPL4, ipa__ip, ipa__tcp__port, tmp_8, IPL4asp__PortType::f__IPL4__listen_options_defval);
current_location.update_lineno(103);
/* IPA_Testing.ttcn, line 103 */
{
boolean tmp_12;
{
boolean tmp_9 = res.is_bound();
if(tmp_9) {
const OPTIONAL< INTEGER >& tmp_10 = res.connId();
switch (tmp_10.get_selection()) {
case OPTIONAL_UNBOUND:
tmp_9 = FALSE;
break;
case OPTIONAL_OMIT:
tmp_9 = FALSE;
break;
default:
{
const INTEGER& tmp_11 = (const INTEGER&) tmp_10;
tmp_9 = tmp_11.is_present();
break;}
}
}
tmp_12 = (!(tmp_9));
}
if (tmp_12) {
current_location.update_lineno(104);
/* IPA_Testing.ttcn, line 104 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not listen on address "),ipa__ip.log(),TTCN_Logger::log_event_str(" port "),ipa__tcp__port.log(),TTCN_Logger::log_event_str("; check your configuration"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(106);
/* IPA_Testing.ttcn, line 106 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
}
}
current_location.update_lineno(115);
/* IPA_Testing.ttcn, line 115 */
IPA__CT_component_g__Tguard.start(6.0e1);
current_location.update_lineno(116);
/* IPA_Testing.ttcn, line 116 */
activate_as__Tguard();
current_location.update_lineno(118);
/* IPA_Testing.ttcn, line 118 */
return const_cast< const Socket__API__Definitions::Result&>(res).connId()();
}

void start_f__init(const COMPONENT& component_reference, const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_init(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Testing", "f_init", text_buf);
ipa__ip.encode_text(text_buf);
ipa__tcp__port.encode_text(text_buf);
conmode.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__send__chopped__ipa__msg(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const INTEGER& connId, const OCTETSTRING& msg)
{
TTCN_Location current_location("IPA_Testing.ttcn", 125, TTCN_Location::LOCATION_FUNCTION, "f_send_chopped_ipa_msg");
current_location.update_lineno(127);
/* IPA_Testing.ttcn, line 127 */
FLOAT delay(6.0);
{
current_location.update_lineno(128);
/* IPA_Testing.ttcn, line 128 */
INTEGER i(0);
current_location.update_lineno(128);
/* IPA_Testing.ttcn, line 128 */
for ( ; ; ) {
current_location.update_lineno(128);
/* IPA_Testing.ttcn, line 128 */
if (!(i < msg.lengthof())) break;
current_location.update_lineno(129);
/* IPA_Testing.ttcn, line 129 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("sending byte ");
const_cast< const OCTETSTRING&>(msg)[i].log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(130);
/* IPA_Testing.ttcn, line 130 */
f__send__ipa__data(ipa__ip, ipa__tcp__port, connId, const_cast< const OCTETSTRING&>(msg)[i]);
current_location.update_lineno(131);
/* IPA_Testing.ttcn, line 131 */
Osmocom__Types::f__sleep(6.0);
current_location.update_lineno(128);
/* IPA_Testing.ttcn, line 128 */
{
INTEGER tmp_13;
++i;
}
}
}
}

void start_f__send__chopped__ipa__msg(const COMPONENT& component_reference, const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const INTEGER& connId, const OCTETSTRING& msg)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_chopped_ipa_msg(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
connId.log();
TTCN_Logger::log_event_str(", ");
msg.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Testing", "f_send_chopped_ipa_msg", text_buf);
ipa__ip.encode_text(text_buf);
ipa__tcp__port.encode_text(text_buf);
connId.encode_text(text_buf);
msg.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__TC__chopped__ipa__ping(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Location current_location("IPA_Testing.ttcn", 136, TTCN_Location::LOCATION_FUNCTION, "f_TC_chopped_ipa_ping");
current_location.update_lineno(138);
/* IPA_Testing.ttcn, line 138 */
INTEGER connId;
current_location.update_lineno(139);
/* IPA_Testing.ttcn, line 139 */
IPL4asp__Types::ASP__RecvFrom asp__rx;
current_location.update_lineno(141);
/* IPA_Testing.ttcn, line 141 */
connId = f__init(ipa__ip, ipa__tcp__port, conmode);
current_location.update_lineno(143);
/* IPA_Testing.ttcn, line 143 */
if ((conmode == IPA__ConnectionMode::CONNECT__TO__SERVER)) {
current_location.update_lineno(144);
/* IPA_Testing.ttcn, line 144 */
f__send__chopped__ipa__msg(ipa__ip, ipa__tcp__port, connId, os_0);
}
else {
current_location.update_lineno(146);
/* IPA_Testing.ttcn, line 146 */
Socket__API__Definitions::PortEvent port__evt;
current_location.update_lineno(147);
/* IPA_Testing.ttcn, line 147 */
{
tmp_15:
Socket__API__Definitions::PortEvent_template tmp_16;
tmp_16.connOpened() = ANY_VALUE;
alt_status alt_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (alt_flag != ALT_NO) {
alt_flag = IPA__CT_component_IPL4.receive(tmp_16, &(port__evt), any_compref, NULL, NULL, NULL);
if (alt_flag == ALT_YES) break;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(first_run);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) break;
else if (default_flag == ALT_REPEAT) goto tmp_15;
}
current_location.update_lineno(147);
/* IPA_Testing.ttcn, line 147 */
if (alt_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("Stand-alone receive statement failed in file IPA_Testing.ttcn, line 147.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
{
current_location.update_lineno(148);
/* IPA_Testing.ttcn, line 148 */
Socket__API__Definitions::ConnectionOpenedEvent conn(const_cast< const Socket__API__Definitions::PortEvent&>(port__evt).connOpened());
current_location.update_lineno(149);
/* IPA_Testing.ttcn, line 149 */
f__send__chopped__ipa__msg(const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remName(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remPort(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).connId(), os_0);
}
}
current_location.update_lineno(154);
/* IPA_Testing.ttcn, line 154 */
{
tmp_17:
alt_status tmp_17_alt_flag_0 = ALT_MAYBE;
alt_status tmp_17_alt_flag_1 = ALT_MAYBE;
alt_status tmp_17_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_17_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(155);
/* IPA_Testing.ttcn, line 155 */
tmp_17_alt_flag_0 = IPA__CT_component_IPL4.receive(t__recvfrom(OCTETSTRING_template(os_1)), &(asp__rx), any_compref, NULL, NULL, NULL);
if (tmp_17_alt_flag_0 == ALT_YES) {
current_location.update_lineno(156);
/* IPA_Testing.ttcn, line 156 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("received pong from ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).remName().log();
TTCN_Logger::log_event_str(" port ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).remPort().log();
TTCN_Logger::log_event_str(": ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).msg().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(157);
/* IPA_Testing.ttcn, line 157 */
TTCN_Runtime::setverdict(PASS);
break;
}
}
if (tmp_17_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(159);
/* IPA_Testing.ttcn, line 159 */
tmp_17_alt_flag_1 = IPA__CT_component_IPL4.receive(any_compref, NULL, NULL, NULL);
if (tmp_17_alt_flag_1 == ALT_YES) {
current_location.update_lineno(160);
/* IPA_Testing.ttcn, line 160 */
goto tmp_17;
}
}
if (tmp_17_default_flag == ALT_MAYBE) {
tmp_17_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_17_default_flag == ALT_YES || tmp_17_default_flag == ALT_BREAK) break;
else if (tmp_17_default_flag == ALT_REPEAT) goto tmp_17;
}
current_location.update_lineno(154);
/* IPA_Testing.ttcn, line 154 */
if (tmp_17_alt_flag_0 == ALT_NO && tmp_17_alt_flag_1 == ALT_NO && tmp_17_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file IPA_Testing.ttcn between lines 154 and 162.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}

void start_f__TC__chopped__ipa__ping(const COMPONENT& component_reference, const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_chopped_ipa_ping(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Testing", "f_TC_chopped_ipa_ping", text_buf);
ipa__ip.encode_text(text_buf);
ipa__tcp__port.encode_text(text_buf);
conmode.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__TC__chopped__ipa__payload(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Location current_location("IPA_Testing.ttcn", 167, TTCN_Location::LOCATION_FUNCTION, "f_TC_chopped_ipa_payload");
current_location.update_lineno(169);
/* IPA_Testing.ttcn, line 169 */
INTEGER connId;
current_location.update_lineno(170);
/* IPA_Testing.ttcn, line 170 */
IPL4asp__Types::ASP__RecvFrom asp__rx;
current_location.update_lineno(172);
/* IPA_Testing.ttcn, line 172 */
connId = f__init(ipa__ip, ipa__tcp__port, conmode);
current_location.update_lineno(174);
/* IPA_Testing.ttcn, line 174 */
if ((conmode == IPA__ConnectionMode::CONNECT__TO__SERVER)) {
current_location.update_lineno(175);
/* IPA_Testing.ttcn, line 175 */
Socket__API__Definitions::PortEvent port__evt;
current_location.update_lineno(176);
/* IPA_Testing.ttcn, line 176 */
f__send__ipa__data(ipa__ip, ipa__tcp__port, connId, os_2);
current_location.update_lineno(177);
/* IPA_Testing.ttcn, line 177 */
f__send__chopped__ipa__msg(ipa__ip, ipa__tcp__port, connId, os_3);
current_location.update_lineno(179);
/* IPA_Testing.ttcn, line 179 */
{
tmp_19:
alt_status tmp_19_alt_flag_0 = ALT_MAYBE;
alt_status tmp_19_alt_flag_1 = ALT_MAYBE;
alt_status tmp_19_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_19_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(180);
/* IPA_Testing.ttcn, line 180 */
{
Socket__API__Definitions::PortEvent_template tmp_20;
tmp_20.connClosed() = ANY_VALUE;
tmp_19_alt_flag_0 = IPA__CT_component_IPL4.receive(tmp_20, &(port__evt), any_compref, NULL, NULL, NULL);
}
if (tmp_19_alt_flag_0 == ALT_YES) {
current_location.update_lineno(181);
/* IPA_Testing.ttcn, line 181 */
if ((const_cast< const Socket__API__Definitions::PortEvent&>(port__evt).connClosed().connId() == connId)) {
current_location.update_lineno(182);
/* IPA_Testing.ttcn, line 182 */
TTCN_Runtime::setverdict(PASS);
}
else {
current_location.update_lineno(184);
/* IPA_Testing.ttcn, line 184 */
goto tmp_19;
}
break;
}
}
if (tmp_19_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(187);
/* IPA_Testing.ttcn, line 187 */
tmp_19_alt_flag_1 = IPA__CT_component_IPL4.receive(any_compref, NULL, NULL, NULL);
if (tmp_19_alt_flag_1 == ALT_YES) {
current_location.update_lineno(188);
/* IPA_Testing.ttcn, line 188 */
goto tmp_19;
}
}
if (tmp_19_default_flag == ALT_MAYBE) {
tmp_19_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_19_default_flag == ALT_YES || tmp_19_default_flag == ALT_BREAK) break;
else if (tmp_19_default_flag == ALT_REPEAT) goto tmp_19;
}
current_location.update_lineno(179);
/* IPA_Testing.ttcn, line 179 */
if (tmp_19_alt_flag_0 == ALT_NO && tmp_19_alt_flag_1 == ALT_NO && tmp_19_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file IPA_Testing.ttcn between lines 179 and 190.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}
else {
current_location.update_lineno(192);
/* IPA_Testing.ttcn, line 192 */
Socket__API__Definitions::PortEvent port__evt;
current_location.update_lineno(193);
/* IPA_Testing.ttcn, line 193 */
{
tmp_21:
Socket__API__Definitions::PortEvent_template tmp_22;
tmp_22.connOpened() = ANY_VALUE;
alt_status alt_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (alt_flag != ALT_NO) {
alt_flag = IPA__CT_component_IPL4.receive(tmp_22, &(port__evt), any_compref, NULL, NULL, NULL);
if (alt_flag == ALT_YES) break;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(first_run);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) break;
else if (default_flag == ALT_REPEAT) goto tmp_21;
}
current_location.update_lineno(193);
/* IPA_Testing.ttcn, line 193 */
if (alt_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("Stand-alone receive statement failed in file IPA_Testing.ttcn, line 193.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
{
current_location.update_lineno(194);
/* IPA_Testing.ttcn, line 194 */
Socket__API__Definitions::ConnectionOpenedEvent conn(const_cast< const Socket__API__Definitions::PortEvent&>(port__evt).connOpened());
current_location.update_lineno(195);
/* IPA_Testing.ttcn, line 195 */
f__send__ipa__data(const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remName(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remPort(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).connId(), os_2);
current_location.update_lineno(196);
/* IPA_Testing.ttcn, line 196 */
f__send__chopped__ipa__msg(const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remName(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).remPort(), const_cast< const Socket__API__Definitions::ConnectionOpenedEvent&>(conn).connId(), os_3);
}
current_location.update_lineno(200);
/* IPA_Testing.ttcn, line 200 */
{
tmp_23:
alt_status tmp_23_alt_flag_0 = ALT_MAYBE;
alt_status tmp_23_alt_flag_1 = ALT_MAYBE;
alt_status tmp_23_default_flag = ALT_MAYBE;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_23_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(201);
/* IPA_Testing.ttcn, line 201 */
tmp_23_alt_flag_0 = IPA__CT_component_IPL4.receive(t__recvfrom(OCTETSTRING_template(ANY_VALUE)), &(asp__rx), any_compref, NULL, NULL, NULL);
if (tmp_23_alt_flag_0 == ALT_YES) {
current_location.update_lineno(202);
/* IPA_Testing.ttcn, line 202 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("received IPA message from ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).remName().log();
TTCN_Logger::log_event_str(" port ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).remPort().log();
TTCN_Logger::log_event_str(": ");
const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).msg().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(204);
/* IPA_Testing.ttcn, line 204 */
{
boolean tmp_24;
{
boolean tmp_25;
tmp_25 = (const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).msg().lengthof() > 4);
if (tmp_25) tmp_25 = (const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).msg()[2] == os_4);
tmp_24 = tmp_25;
}
if (tmp_24) tmp_24 = (const_cast< const IPL4asp__Types::ASP__RecvFrom&>(asp__rx).msg()[3] == os_5);
if (tmp_24) {
current_location.update_lineno(207);
/* IPA_Testing.ttcn, line 207 */
TTCN_Runtime::setverdict(PASS);
}
else {
current_location.update_lineno(209);
/* IPA_Testing.ttcn, line 209 */
goto tmp_23;
}
}
break;
}
}
if (tmp_23_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(212);
/* IPA_Testing.ttcn, line 212 */
tmp_23_alt_flag_1 = IPA__CT_component_IPL4.receive(any_compref, NULL, NULL, NULL);
if (tmp_23_alt_flag_1 == ALT_YES) {
current_location.update_lineno(213);
/* IPA_Testing.ttcn, line 213 */
goto tmp_23;
}
}
if (tmp_23_default_flag == ALT_MAYBE) {
tmp_23_default_flag = TTCN_Default::try_altsteps(first_run);
if (tmp_23_default_flag == ALT_YES || tmp_23_default_flag == ALT_BREAK) break;
else if (tmp_23_default_flag == ALT_REPEAT) goto tmp_23;
}
current_location.update_lineno(200);
/* IPA_Testing.ttcn, line 200 */
if (tmp_23_alt_flag_0 == ALT_NO && tmp_23_alt_flag_1 == ALT_NO && tmp_23_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file IPA_Testing.ttcn between lines 200 and 215.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}
}

void start_f__TC__chopped__ipa__payload(const COMPONENT& component_reference, const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_chopped_ipa_payload(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Testing", "f_TC_chopped_ipa_payload", text_buf);
ipa__ip.encode_text(text_buf);
ipa__tcp__port.encode_text(text_buf);
conmode.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__run__TC__chopped__ipa__ping(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Location current_location("IPA_Testing.ttcn", 224, TTCN_Location::LOCATION_FUNCTION, "f_run_TC_chopped_ipa_ping");
current_location.update_lineno(225);
/* IPA_Testing.ttcn, line 225 */
COMPONENT vc__IPA__Testing(TTCN_Runtime::create_component("IPA_Testing", "IPA_CT", NULL, NULL, FALSE));
current_location.update_lineno(226);
/* IPA_Testing.ttcn, line 226 */
start_f__TC__chopped__ipa__ping(vc__IPA__Testing, ipa__ip, ipa__tcp__port, conmode);
current_location.update_lineno(227);
/* IPA_Testing.ttcn, line 227 */
{
tmp_26:
alt_status alt_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (alt_flag != ALT_NO) {
alt_flag = vc__IPA__Testing.done(NULL, NULL);
if (alt_flag == ALT_YES) break;
else if (alt_flag == ALT_REPEAT) goto tmp_26;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(first_run);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) break;
else if (default_flag == ALT_REPEAT) goto tmp_26;
}
current_location.update_lineno(227);
/* IPA_Testing.ttcn, line 227 */
if (alt_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("Stand-alone done statement failed in file IPA_Testing.ttcn, line 227.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}

void f__run__TC__chopped__ipa__payload(const CHARSTRING& ipa__ip, const INTEGER& ipa__tcp__port, const IPA__ConnectionMode& conmode)
{
TTCN_Location current_location("IPA_Testing.ttcn", 230, TTCN_Location::LOCATION_FUNCTION, "f_run_TC_chopped_ipa_payload");
current_location.update_lineno(231);
/* IPA_Testing.ttcn, line 231 */
COMPONENT vc__IPA__Testing(TTCN_Runtime::create_component("IPA_Testing", "IPA_CT", NULL, NULL, FALSE));
current_location.update_lineno(232);
/* IPA_Testing.ttcn, line 232 */
start_f__TC__chopped__ipa__payload(vc__IPA__Testing, ipa__ip, ipa__tcp__port, conmode);
current_location.update_lineno(233);
/* IPA_Testing.ttcn, line 233 */
{
tmp_27:
alt_status alt_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (alt_flag != ALT_NO) {
alt_flag = vc__IPA__Testing.done(NULL, NULL);
if (alt_flag == ALT_YES) break;
else if (alt_flag == ALT_REPEAT) goto tmp_27;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(first_run);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) break;
else if (default_flag == ALT_REPEAT) goto tmp_27;
}
current_location.update_lineno(233);
/* IPA_Testing.ttcn, line 233 */
if (alt_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("Stand-alone done statement failed in file IPA_Testing.ttcn, line 233.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("IPA_Testing.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPA_Testing");
IPL4asp__PortType::module_object.pre_init_module();
IPA__Types::module_object.pre_init_module();
current_location.update_lineno(35);
/* IPA_Testing.ttcn, line 35 */
const_ipa__msg__ping = os_0;
current_location.update_lineno(36);
/* IPA_Testing.ttcn, line 36 */
const_ipa__msg__pong = os_1;
current_location.update_lineno(37);
/* IPA_Testing.ttcn, line 37 */
const_ipa__msg__id__req__hdr = os_2;
current_location.update_lineno(38);
/* IPA_Testing.ttcn, line 38 */
const_ipa__msg__id__req__payload = os_3;
module_object.add_altstep("as_Tguard", (genericfunc_t)&as__Tguard_instance, (genericfunc_t )&activate_as__Tguard, (genericfunc_t )&as__Tguard);
module_object.add_function("f_send_ipa_data", (genericfunc_t)&f__send__ipa__data, (genericfunc_t)&start_f__send__ipa__data);
module_object.add_function("f_init", (genericfunc_t)&f__init, (genericfunc_t)&start_f__init);
module_object.add_function("f_send_chopped_ipa_msg", (genericfunc_t)&f__send__chopped__ipa__msg, (genericfunc_t)&start_f__send__chopped__ipa__msg);
module_object.add_function("f_TC_chopped_ipa_ping", (genericfunc_t)&f__TC__chopped__ipa__ping, (genericfunc_t)&start_f__TC__chopped__ipa__ping);
module_object.add_function("f_TC_chopped_ipa_payload", (genericfunc_t)&f__TC__chopped__ipa__payload, (genericfunc_t)&start_f__TC__chopped__ipa__payload);
module_object.add_function("f_run_TC_chopped_ipa_ping", (genericfunc_t)&f__run__TC__chopped__ipa__ping, NULL);
module_object.add_function("f_run_TC_chopped_ipa_payload", (genericfunc_t)&f__run__TC__chopped__ipa__payload, NULL);
}

void post_init_module()
{
TTCN_Location current_location("IPA_Testing.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPA_Testing");
IPL4asp__PortType::module_object.post_init_module();
IPA__Types::module_object.post_init_module();
}

boolean init_comp_type(const char *component_type, boolean init_base_comps)
{
(void)init_base_comps;
if (!strcmp(component_type, "system_CT")) {
system__CT_component_IPL4.activate_port();
return TRUE;
} else if (!strcmp(component_type, "IPA_CT")) {
IPA__CT_component_IPL4.activate_port();
return TRUE;
} else return FALSE;
}

boolean init_system_port(const char* component_type, const char* port_name)
{
if (!strcmp(component_type, "system_CT")) {
if (!strcmp(port_name, "IPL4")) {
system__CT_component_IPL4.safe_start();
return TRUE;
}
}
else if (!strcmp(component_type, "IPA_CT")) {
if (!strcmp(port_name, "IPL4")) {
IPA__CT_component_IPL4.safe_start();
return TRUE;
}
}
return FALSE;
}

boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments)
{
if (!strcmp(function_name, "f_send_ipa_data")) {
CHARSTRING ipa__ip;
INTEGER ipa__tcp__port;
INTEGER connId;
OCTETSTRING data;
ipa__ip.decode_text(function_arguments);
ipa__tcp__port.decode_text(function_arguments);
connId.decode_text(function_arguments);
data.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_ipa_data(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
connId.log();
TTCN_Logger::log_event_str(", ");
data.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__send__ipa__data(ipa__ip, ipa__tcp__port, connId, data);
TTCN_Runtime::function_finished("f_send_ipa_data");
return TRUE;
} else if (!strcmp(function_name, "f_init")) {
CHARSTRING ipa__ip;
INTEGER ipa__tcp__port;
IPA__ConnectionMode conmode;
ipa__ip.decode_text(function_arguments);
ipa__tcp__port.decode_text(function_arguments);
conmode.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_init(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__init(ipa__ip, ipa__tcp__port, conmode);
TTCN_Runtime::function_finished("f_init");
return TRUE;
} else if (!strcmp(function_name, "f_send_chopped_ipa_msg")) {
CHARSTRING ipa__ip;
INTEGER ipa__tcp__port;
INTEGER connId;
OCTETSTRING msg;
ipa__ip.decode_text(function_arguments);
ipa__tcp__port.decode_text(function_arguments);
connId.decode_text(function_arguments);
msg.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_chopped_ipa_msg(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
connId.log();
TTCN_Logger::log_event_str(", ");
msg.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__send__chopped__ipa__msg(ipa__ip, ipa__tcp__port, connId, msg);
TTCN_Runtime::function_finished("f_send_chopped_ipa_msg");
return TRUE;
} else if (!strcmp(function_name, "f_TC_chopped_ipa_ping")) {
CHARSTRING ipa__ip;
INTEGER ipa__tcp__port;
IPA__ConnectionMode conmode;
ipa__ip.decode_text(function_arguments);
ipa__tcp__port.decode_text(function_arguments);
conmode.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_chopped_ipa_ping(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__TC__chopped__ipa__ping(ipa__ip, ipa__tcp__port, conmode);
TTCN_Runtime::function_finished("f_TC_chopped_ipa_ping");
return TRUE;
} else if (!strcmp(function_name, "f_TC_chopped_ipa_payload")) {
CHARSTRING ipa__ip;
INTEGER ipa__tcp__port;
IPA__ConnectionMode conmode;
ipa__ip.decode_text(function_arguments);
ipa__tcp__port.decode_text(function_arguments);
conmode.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_chopped_ipa_payload(");
ipa__ip.log();
TTCN_Logger::log_event_str(", ");
ipa__tcp__port.log();
TTCN_Logger::log_event_str(", ");
conmode.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__TC__chopped__ipa__payload(ipa__ip, ipa__tcp__port, conmode);
TTCN_Runtime::function_finished("f_TC_chopped_ipa_payload");
return TRUE;
} else return FALSE;
}


} /* end of namespace */
