// This C++ source file was generated by the TTCN-3 compiler // of the TTCN-3 Test Executor version 9.0.0 // for (build@3978f7fbee0c) on Mon Jun 24 02:37:33 2024 // Copyright (c) 2000-2023 Ericsson Telecom AB // Do not edit this file unless you know what you are doing. /* Including header files */ #include "TELNETasp_PortType.hh" namespace TELNETasp__PortType { /* Literal string constants */ const unsigned char module_checksum[] = { 0x49, 0x5d, 0xbb, 0xd1, 0x76, 0xa0, 0xd9, 0x49, 0xec, 0x0a, 0xb1, 0xad, 0xab, 0xf5, 0x52, 0xcd }; /* Global variable definitions */ // No XER for TelnetReadMode const TTCN_Typedescriptor_t TelnetReadMode_descr_ = { "@TELNETasp_PortType.TelnetReadMode", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetWindowSize_width_xer_ = { {"width>\n", "width>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t TelnetWindowSize_width_descr_ = { "@TELNETasp_PortType.TelnetWindowSize.width", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TelnetWindowSize_width_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetWindowSize_height_xer_ = { {"height>\n", "height>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t TelnetWindowSize_height_descr_ = { "@TELNETasp_PortType.TelnetWindowSize.height", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TelnetWindowSize_height_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for TelnetWindowSize const TTCN_Typedescriptor_t TelnetWindowSize_descr_ = { "@TELNETasp_PortType.TelnetWindowSize", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetPrompt_id_xer_ = { {"id>\n", "id>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t TelnetPrompt_id_descr_ = { "@TELNETasp_PortType.TelnetPrompt.id", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TelnetPrompt_id_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetPrompt_prompt_xer_ = { {"prompt>\n", "prompt>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t TelnetPrompt_prompt_descr_ = { "@TELNETasp_PortType.TelnetPrompt.prompt", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &TelnetPrompt_prompt_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetPrompt_has__wildcards_xer_ = { {"has_wildcards>\n", "has_wildcards>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int TelnetPrompt_has__wildcards_oer_ext_arr_[0] = {}; const int TelnetPrompt_has__wildcards_oer_p_[0] = {}; const TTCN_OERdescriptor_t TelnetPrompt_has__wildcards_oer_ = { -1, TRUE, -1, FALSE, 0, 0, TelnetPrompt_has__wildcards_oer_ext_arr_, 0, TelnetPrompt_has__wildcards_oer_p_}; const TTCN_Typedescriptor_t TelnetPrompt_has__wildcards_descr_ = { "@TELNETasp_PortType.TelnetPrompt.has_wildcards", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &TelnetPrompt_has__wildcards_xer_, &BOOLEAN_json_, &TelnetPrompt_has__wildcards_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for TelnetPrompt const TTCN_Typedescriptor_t TelnetPrompt_descr_ = { "@TELNETasp_PortType.TelnetPrompt", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for TelnetPrompts const TTCN_Typedescriptor_t TelnetPrompts_descr_ = { "@TELNETasp_PortType.TelnetPrompts", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &TelnetPrompt_descr_, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t TelnetEcho_xer_ = { {"TelnetEcho>\n", "TelnetEcho>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int TelnetEcho_oer_ext_arr_[0] = {}; const int TelnetEcho_oer_p_[0] = {}; const TTCN_OERdescriptor_t TelnetEcho_oer_ = { -1, TRUE, -1, FALSE, 0, 0, TelnetEcho_oer_ext_arr_, 0, TelnetEcho_oer_p_}; const TTCN_Typedescriptor_t TelnetEcho_descr_ = { "@TELNETasp_PortType.TelnetEcho", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &TelnetEcho_xer_, &BOOLEAN_json_, &TelnetEcho_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__TelnetPortParameters const TTCN_Typedescriptor_t ASP__TelnetPortParameters_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__hostname_xer_ = { {"ctrl_hostname>\n", "ctrl_hostname>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__hostname_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_hostname", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ASP__TelnetPortParameters_ctrl__hostname_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__portnum_xer_ = { {"ctrl_portnum>\n", "ctrl_portnum>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__portnum_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_portnum", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &ASP__TelnetPortParameters_ctrl__portnum_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__username_xer_ = { {"ctrl_username>\n", "ctrl_username>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__username_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_username", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ASP__TelnetPortParameters_ctrl__username_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__password_xer_ = { {"ctrl_password>\n", "ctrl_password>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__password_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_password", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ASP__TelnetPortParameters_ctrl__password_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__domain_xer_ = { {"ctrl_domain>\n", "ctrl_domain>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__domain_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_domain", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ASP__TelnetPortParameters_ctrl__domain_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__login__skipped_xer_ = { {"ctrl_login_skipped>\n", "ctrl_login_skipped>\n"}, {20, 20}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ASP__TelnetPortParameters_ctrl__login__skipped_oer_ext_arr_[0] = {}; const int ASP__TelnetPortParameters_ctrl__login__skipped_oer_p_[0] = {}; const TTCN_OERdescriptor_t ASP__TelnetPortParameters_ctrl__login__skipped_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__TelnetPortParameters_ctrl__login__skipped_oer_ext_arr_, 0, ASP__TelnetPortParameters_ctrl__login__skipped_oer_p_}; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__login__skipped_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_login_skipped", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &ASP__TelnetPortParameters_ctrl__login__skipped_xer_, &BOOLEAN_json_, &ASP__TelnetPortParameters_ctrl__login__skipped_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__detect__server__disconnected_xer_ = { {"ctrl_detect_server_disconnected>\n", "ctrl_detect_server_disconnected>\n"}, {33, 33}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_ext_arr_[0] = {}; const int ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_p_[0] = {}; const TTCN_OERdescriptor_t ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_ext_arr_, 0, ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_p_}; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__detect__server__disconnected_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_detect_server_disconnected", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &ASP__TelnetPortParameters_ctrl__detect__server__disconnected_xer_, &BOOLEAN_json_, &ASP__TelnetPortParameters_ctrl__detect__server__disconnected_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__terminal__type_xer_ = { {"ctrl_terminal_type>\n", "ctrl_terminal_type>\n"}, {20, 20}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__terminal__type_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_terminal_type", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ASP__TelnetPortParameters_ctrl__terminal__type_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__echo_xer_ = { {"ctrl_echo>\n", "ctrl_echo>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ASP__TelnetPortParameters_ctrl__echo_oer_ext_arr_[0] = {}; const int ASP__TelnetPortParameters_ctrl__echo_oer_p_[0] = {}; const TTCN_OERdescriptor_t ASP__TelnetPortParameters_ctrl__echo_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__TelnetPortParameters_ctrl__echo_oer_ext_arr_, 0, ASP__TelnetPortParameters_ctrl__echo_oer_p_}; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__echo_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_echo", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &ASP__TelnetPortParameters_ctrl__echo_xer_, &BOOLEAN_json_, &ASP__TelnetPortParameters_ctrl__echo_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetPortParameters_ctrl__CRLF_xer_ = { {"ctrl_CRLF>\n", "ctrl_CRLF>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ASP__TelnetPortParameters_ctrl__CRLF_oer_ext_arr_[0] = {}; const int ASP__TelnetPortParameters_ctrl__CRLF_oer_p_[0] = {}; const TTCN_OERdescriptor_t ASP__TelnetPortParameters_ctrl__CRLF_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__TelnetPortParameters_ctrl__CRLF_oer_ext_arr_, 0, ASP__TelnetPortParameters_ctrl__CRLF_oer_p_}; const TTCN_Typedescriptor_t ASP__TelnetPortParameters_ctrl__CRLF_descr_ = { "@TELNETasp_PortType.ASP_TelnetPortParameters.ctrl_CRLF", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &ASP__TelnetPortParameters_ctrl__CRLF_xer_, &BOOLEAN_json_, &ASP__TelnetPortParameters_ctrl__CRLF_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__TelnetDynamicConfig const TTCN_Typedescriptor_t ASP__TelnetDynamicConfig_descr_ = { "@TELNETasp_PortType.ASP_TelnetDynamicConfig", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__TelnetDynamicConfig_echo_xer_ = { {"echo>\n", "echo>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ASP__TelnetDynamicConfig_echo_oer_ext_arr_[0] = {}; const int ASP__TelnetDynamicConfig_echo_oer_p_[0] = {}; const TTCN_OERdescriptor_t ASP__TelnetDynamicConfig_echo_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__TelnetDynamicConfig_echo_oer_ext_arr_, 0, ASP__TelnetDynamicConfig_echo_oer_p_}; const TTCN_Typedescriptor_t ASP__TelnetDynamicConfig_echo_descr_ = { "@TELNETasp_PortType.ASP_TelnetDynamicConfig.echo", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &ASP__TelnetDynamicConfig_echo_xer_, &BOOLEAN_json_, &ASP__TelnetDynamicConfig_echo_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__TelnetConnection const TTCN_Typedescriptor_t ASP__TelnetConnection_descr_ = { "@TELNETasp_PortType.ASP_TelnetConnection", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__TelnetClose const TTCN_Typedescriptor_t ASP__TelnetClose_descr_ = { "@TELNETasp_PortType.ASP_TelnetClose", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__Get__portnum const TTCN_Typedescriptor_t ASP__Get__portnum_descr_ = { "@TELNETasp_PortType.ASP_Get_portnum", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ASP__Portnum_local__port__num_xer_ = { {"local_port_num>\n", "local_port_num>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ASP__Portnum_local__port__num_descr_ = { "@TELNETasp_PortType.ASP_Portnum.local_port_num", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &ASP__Portnum_local__port__num_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ASP__Portnum const TTCN_Typedescriptor_t ASP__Portnum_descr_ = { "@TELNETasp_PortType.ASP_Portnum", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; TTCN_Module module_object("TELNETasp_PortType", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_9, current_runtime_version.requires_minor_version_0, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Member functions of C++ classes */ TelnetReadMode::TelnetReadMode() { enum_value = UNBOUND_VALUE; } TelnetReadMode::TelnetReadMode(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @TELNETasp_PortType.TelnetReadMode with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } TelnetReadMode::TelnetReadMode(enum_type other_value) { enum_value = other_value; } TelnetReadMode::TelnetReadMode(const TelnetReadMode& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); enum_value = other_value.enum_value; } TelnetReadMode& TelnetReadMode::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @TELNETasp_PortType.TelnetReadMode.", other_value); enum_value = (enum_type)other_value; return *this; } TelnetReadMode& TelnetReadMode::operator=(enum_type other_value) { enum_value = other_value; return *this; } TelnetReadMode& TelnetReadMode::operator=(const TelnetReadMode& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); enum_value = other_value.enum_value; return *this; } boolean TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode."); return enum_value == other_value; } boolean TelnetReadMode::operator==(const TelnetReadMode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); return enum_value == other_value.enum_value; } boolean TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode."); return enum_value < other_value; } boolean TelnetReadMode::operator<(const TelnetReadMode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); return enum_value < other_value.enum_value; } boolean TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode."); return enum_value > other_value; } boolean TelnetReadMode::operator>(const TelnetReadMode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); return enum_value > other_value.enum_value; } const char *TelnetReadMode::enum_to_str(enum_type enum_par) { switch (enum_par) { case UNBUFFERED: return "UNBUFFERED"; case BUFFERED: return "BUFFERED"; default: return ""; } } TelnetReadMode::enum_type TelnetReadMode::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UNBUFFERED")) return UNBUFFERED; else if (!strcmp(str_par, "BUFFERED")) return BUFFERED; else return UNKNOWN_VALUE; } boolean TelnetReadMode::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int TelnetReadMode::enum2int(const TelnetReadMode& 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 @TELNETasp_PortType.TelnetReadMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void TelnetReadMode::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @TELNETasp_PortType.TelnetReadMode.", int_val); enum_value = (enum_type)int_val; } TelnetReadMode::operator TelnetReadMode::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @TELNETasp_PortType.TelnetReadMode."); return enum_value; } void TelnetReadMode::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 TelnetReadMode::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", "@TELNETasp_PortType.TelnetReadMode"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @TELNETasp_PortType.TelnetReadMode."); } } void TelnetReadMode::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); text_buf.push_int(enum_value); } void TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode.", enum_value); } void TelnetReadMode_template::copy_template(const TelnetReadMode_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 TelnetReadMode_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 TelnetReadMode_template(*other_value.implication_.precondition); implication_.implied_template = new TelnetReadMode_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 @TELNETasp_PortType.TelnetReadMode."); } } TelnetReadMode_template::TelnetReadMode_template() { } TelnetReadMode_template::TelnetReadMode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } TelnetReadMode_template::TelnetReadMode_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!TelnetReadMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @TELNETasp_PortType.TelnetReadMode with unknown numeric value %d.", other_value); single_value = (TelnetReadMode::enum_type)other_value; } TelnetReadMode_template::TelnetReadMode_template(TelnetReadMode::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } TelnetReadMode_template::TelnetReadMode_template(const TelnetReadMode& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == TelnetReadMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode."); single_value = other_value.enum_value; } TelnetReadMode_template::TelnetReadMode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (TelnetReadMode::enum_type)(const TelnetReadMode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @TELNETasp_PortType.TelnetReadMode from an unbound optional field."); } } TelnetReadMode_template::TelnetReadMode_template(TelnetReadMode_template* p_precondition, TelnetReadMode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } TelnetReadMode_template::TelnetReadMode_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } TelnetReadMode_template::TelnetReadMode_template(const TelnetReadMode_template& other_value) : Base_Template() { copy_template(other_value); } TelnetReadMode_template::~TelnetReadMode_template() { clean_up(); } boolean TelnetReadMode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean TelnetReadMode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != TelnetReadMode::UNBOUND_VALUE; } void TelnetReadMode_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; } TelnetReadMode_template& TelnetReadMode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } TelnetReadMode_template& TelnetReadMode_template::operator=(int other_value) { if (!TelnetReadMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @TELNETasp_PortType.TelnetReadMode.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (TelnetReadMode::enum_type)other_value; return *this; } TelnetReadMode_template& TelnetReadMode_template::operator=(TelnetReadMode::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } TelnetReadMode_template& TelnetReadMode_template::operator=(const TelnetReadMode& other_value) { if (other_value.enum_value == TelnetReadMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @TELNETasp_PortType.TelnetReadMode to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } TelnetReadMode_template& TelnetReadMode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (TelnetReadMode::enum_type)(const TelnetReadMode&)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 @TELNETasp_PortType.TelnetReadMode."); } return *this; } TelnetReadMode_template& TelnetReadMode_template::operator=(const TelnetReadMode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean TelnetReadMode_template::match(TelnetReadMode::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 @TELNETasp_PortType.TelnetReadMode."); } return FALSE; } boolean TelnetReadMode_template::match(const TelnetReadMode& other_value, boolean) const { if (other_value.enum_value == TelnetReadMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @TELNETasp_PortType.TelnetReadMode with an unbound value."); return match(other_value.enum_value); } TelnetReadMode::enum_type TelnetReadMode_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 @TELNETasp_PortType.TelnetReadMode."); return single_value; } void TelnetReadMode_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @TELNETasp_PortType.TelnetReadMode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new TelnetReadMode_template[list_length]; } TelnetReadMode_template& TelnetReadMode_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 @TELNETasp_PortType.TelnetReadMode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @TELNETasp_PortType.TelnetReadMode."); return value_list.list_value[list_index]; } void TelnetReadMode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(TelnetReadMode::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 TelnetReadMode_template::log_match(const TelnetReadMode& 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 TelnetReadMode_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 @TELNETasp_PortType.TelnetReadMode."); } } void TelnetReadMode_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (TelnetReadMode::enum_type)text_buf.pull_int().get_val(); if (!TelnetReadMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @TELNETasp_PortType.TelnetReadMode.", 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 TelnetReadMode_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 @TELNETasp_PortType.TelnetReadMode."); } } boolean TelnetReadMode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean TelnetReadMode_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; iget_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: { TelnetReadMode_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_iget_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: { TelnetReadMode::enum_type enum_val = TelnetReadMode::str_to_enum(m_p->get_enumerated()); if (!TelnetReadMode::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @TELNETasp_PortType.TelnetReadMode."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { TelnetReadMode_template* precondition = new TelnetReadMode_template; precondition->set_param(*m_p->get_elem(0)); TelnetReadMode_template* implied_template = new TelnetReadMode_template; implied_template->set_param(*m_p->get_elem(1)); *this = TelnetReadMode_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@TELNETasp_PortType.TelnetReadMode"); } is_ifpresent = param.get_ifpresent(); } void TelnetReadMode_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 : "@TELNETasp_PortType.TelnetReadMode"); } TelnetWindowSize::TelnetWindowSize() { } TelnetWindowSize::TelnetWindowSize(const INTEGER& par_width, const INTEGER& par_height) : field_width(par_width), field_height(par_height) { } TelnetWindowSize::TelnetWindowSize(const TelnetWindowSize& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TELNETasp_PortType.TelnetWindowSize."); if (other_value.width().is_bound()) field_width = other_value.width(); else field_width.clean_up(); if (other_value.height().is_bound()) field_height = other_value.height(); else field_height.clean_up(); } void TelnetWindowSize::clean_up() { field_width.clean_up(); field_height.clean_up(); } const TTCN_Typedescriptor_t* TelnetWindowSize::get_descriptor() const { return &TelnetWindowSize_descr_; } TelnetWindowSize& TelnetWindowSize::operator=(const TelnetWindowSize& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TELNETasp_PortType.TelnetWindowSize."); if (other_value.width().is_bound()) field_width = other_value.width(); else field_width.clean_up(); if (other_value.height().is_bound()) field_height = other_value.height(); else field_height.clean_up(); } return *this; } boolean TelnetWindowSize::operator==(const TelnetWindowSize& other_value) const { return field_width==other_value.field_width && field_height==other_value.field_height; } boolean TelnetWindowSize::is_bound() const { return (field_width.is_bound()) || (field_height.is_bound()); } boolean TelnetWindowSize::is_value() const { return field_width.is_value() && field_height.is_value(); } void TelnetWindowSize::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ width := "); field_width.log(); TTCN_Logger::log_event_str(", height := "); field_height.log(); TTCN_Logger::log_event_str(" }"); } void TelnetWindowSize::set_implicit_omit() { if (width().is_bound()) width().set_implicit_omit(); if (height().is_bound()) height().set_implicit_omit(); } void TelnetWindowSize::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) width().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) height().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "width")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { width().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "height")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { height().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.TelnetWindowSize: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@TELNETasp_PortType.TelnetWindowSize"); } } void TelnetWindowSize::encode_text(Text_Buf& text_buf) const { field_width.encode_text(text_buf); field_height.encode_text(text_buf); } void TelnetWindowSize::decode_text(Text_Buf& text_buf) { field_width.decode_text(text_buf); field_height.decode_text(text_buf); } struct TelnetWindowSize_template::single_value_struct { INTEGER_template field_width; INTEGER_template field_height; }; void TelnetWindowSize_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_width = ANY_VALUE; single_value->field_height = ANY_VALUE; } } } void TelnetWindowSize_template::copy_value(const TelnetWindowSize& other_value) { single_value = new single_value_struct; if (other_value.width().is_bound()) { single_value->field_width = other_value.width(); } else { single_value->field_width.clean_up(); } if (other_value.height().is_bound()) { single_value->field_height = other_value.height(); } else { single_value->field_height.clean_up(); } set_selection(SPECIFIC_VALUE); } void TelnetWindowSize_template::copy_template(const TelnetWindowSize_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.width().get_selection()) { single_value->field_width = other_value.width(); } else { single_value->field_width.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.height().get_selection()) { single_value->field_height = other_value.height(); } else { single_value->field_height.clean_up(); } 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 TelnetWindowSize_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 TelnetWindowSize_template(*other_value.implication_.precondition); implication_.implied_template = new TelnetWindowSize_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 type @TELNETasp_PortType.TelnetWindowSize."); break; } set_selection(other_value); } TelnetWindowSize_template::TelnetWindowSize_template() { } TelnetWindowSize_template::TelnetWindowSize_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } TelnetWindowSize_template::TelnetWindowSize_template(const TelnetWindowSize& other_value) { copy_value(other_value); } TelnetWindowSize_template::TelnetWindowSize_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetWindowSize&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.TelnetWindowSize from an unbound optional field."); } } TelnetWindowSize_template::TelnetWindowSize_template(TelnetWindowSize_template* p_precondition, TelnetWindowSize_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } TelnetWindowSize_template::TelnetWindowSize_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } TelnetWindowSize_template::TelnetWindowSize_template(const TelnetWindowSize_template& other_value) : Base_Template() { copy_template(other_value); } TelnetWindowSize_template::~TelnetWindowSize_template() { clean_up(); } TelnetWindowSize_template& TelnetWindowSize_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } TelnetWindowSize_template& TelnetWindowSize_template::operator=(const TelnetWindowSize& other_value) { clean_up(); copy_value(other_value); return *this; } TelnetWindowSize_template& TelnetWindowSize_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetWindowSize&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.TelnetWindowSize."); } return *this; } TelnetWindowSize_template& TelnetWindowSize_template::operator=(const TelnetWindowSize_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean TelnetWindowSize_template::match(const TelnetWindowSize& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.width().is_bound()) return FALSE; if(!single_value->field_width.match(other_value.width(), legacy))return FALSE; if(!other_value.height().is_bound()) return FALSE; if(!single_value->field_height.match(other_value.height(), legacy))return FALSE; 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, legacy)) 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 type @TELNETasp_PortType.TelnetWindowSize."); } return FALSE; } boolean TelnetWindowSize_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_width.is_bound() || single_value->field_height.is_bound(); } boolean TelnetWindowSize_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_width.is_value() && single_value->field_height.is_value(); } void TelnetWindowSize_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: delete single_value; break; 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; } TelnetWindowSize TelnetWindowSize_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.TelnetWindowSize."); TelnetWindowSize ret_val; if (single_value->field_width.is_bound()) { ret_val.width() = single_value->field_width.valueof(); } if (single_value->field_height.is_bound()) { ret_val.height() = single_value->field_height.valueof(); } return ret_val; } void TelnetWindowSize_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.TelnetWindowSize."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new TelnetWindowSize_template[list_length]; } TelnetWindowSize_template& TelnetWindowSize_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.TelnetWindowSize."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.TelnetWindowSize."); return value_list.list_value[list_index]; } INTEGER_template& TelnetWindowSize_template::width() { set_specific(); return single_value->field_width; } const INTEGER_template& TelnetWindowSize_template::width() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field width of a non-specific template of type @TELNETasp_PortType.TelnetWindowSize."); return single_value->field_width; } INTEGER_template& TelnetWindowSize_template::height() { set_specific(); return single_value->field_height; } const INTEGER_template& TelnetWindowSize_template::height() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field height of a non-specific template of type @TELNETasp_PortType.TelnetWindowSize."); return single_value->field_height; } int TelnetWindowSize_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetWindowSize containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetWindowSize."); } return 0; } void TelnetWindowSize_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ width := "); single_value->field_width.log(); TTCN_Logger::log_event_str(", height := "); single_value->field_height.log(); TTCN_Logger::log_event_str(" }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 TelnetWindowSize_template::log_match(const TelnetWindowSize& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_width.match(match_value.width(), legacy)){ TTCN_Logger::log_logmatch_info(".width"); single_value->field_width.log_match(match_value.width(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_height.match(match_value.height(), legacy)){ TTCN_Logger::log_logmatch_info(".height"); single_value->field_height.log_match(match_value.height(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ width := "); single_value->field_width.log_match(match_value.width(), legacy); TTCN_Logger::log_event_str(", height := "); single_value->field_height.log_match(match_value.height(), legacy); TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void TelnetWindowSize_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_width.encode_text(text_buf); single_value->field_height.encode_text(text_buf); 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetWindowSize."); } } void TelnetWindowSize_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_width.decode_text(text_buf); single_value->field_height.decode_text(text_buf); 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 TelnetWindowSize_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.TelnetWindowSize."); } } void TelnetWindowSize_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); switch (param.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: { TelnetWindowSize_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) width().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) height().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "width")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { width().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "height")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { height().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.TelnetWindowSize: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { TelnetWindowSize_template* precondition = new TelnetWindowSize_template; precondition->set_param(*param.get_elem(0)); TelnetWindowSize_template* implied_template = new TelnetWindowSize_template; implied_template->set_param(*param.get_elem(1)); *this = TelnetWindowSize_template(precondition, implied_template); } break; default: param.type_error("record template", "@TELNETasp_PortType.TelnetWindowSize"); } is_ifpresent = param.get_ifpresent(); } void TelnetWindowSize_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_width.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetWindowSize"); single_value->field_height.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetWindowSize"); return; 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 : "@TELNETasp_PortType.TelnetWindowSize"); } boolean TelnetWindowSize_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean TelnetWindowSize_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 l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) id().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) prompt().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) has__wildcards().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "id")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { id().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prompt")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prompt().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "has_wildcards")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { has__wildcards().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.TelnetPrompt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@TELNETasp_PortType.TelnetPrompt"); } } void TelnetPrompt::encode_text(Text_Buf& text_buf) const { field_id.encode_text(text_buf); field_prompt.encode_text(text_buf); field_has__wildcards.encode_text(text_buf); } void TelnetPrompt::decode_text(Text_Buf& text_buf) { field_id.decode_text(text_buf); field_prompt.decode_text(text_buf); field_has__wildcards.decode_text(text_buf); } struct TelnetPrompt_template::single_value_struct { INTEGER_template field_id; CHARSTRING_template field_prompt; BOOLEAN_template field_has__wildcards; }; void TelnetPrompt_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_id = ANY_VALUE; single_value->field_prompt = ANY_VALUE; single_value->field_has__wildcards = ANY_VALUE; } } } void TelnetPrompt_template::copy_value(const TelnetPrompt& other_value) { single_value = new single_value_struct; if (other_value.id().is_bound()) { single_value->field_id = other_value.id(); } else { single_value->field_id.clean_up(); } if (other_value.prompt().is_bound()) { single_value->field_prompt = other_value.prompt(); } else { single_value->field_prompt.clean_up(); } if (other_value.has__wildcards().is_bound()) { single_value->field_has__wildcards = other_value.has__wildcards(); } else { single_value->field_has__wildcards.clean_up(); } set_selection(SPECIFIC_VALUE); } void TelnetPrompt_template::copy_template(const TelnetPrompt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.id().get_selection()) { single_value->field_id = other_value.id(); } else { single_value->field_id.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.prompt().get_selection()) { single_value->field_prompt = other_value.prompt(); } else { single_value->field_prompt.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.has__wildcards().get_selection()) { single_value->field_has__wildcards = other_value.has__wildcards(); } else { single_value->field_has__wildcards.clean_up(); } 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 TelnetPrompt_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 TelnetPrompt_template(*other_value.implication_.precondition); implication_.implied_template = new TelnetPrompt_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 type @TELNETasp_PortType.TelnetPrompt."); break; } set_selection(other_value); } TelnetPrompt_template::TelnetPrompt_template() { } TelnetPrompt_template::TelnetPrompt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } TelnetPrompt_template::TelnetPrompt_template(const TelnetPrompt& other_value) { copy_value(other_value); } TelnetPrompt_template::TelnetPrompt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetPrompt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.TelnetPrompt from an unbound optional field."); } } TelnetPrompt_template::TelnetPrompt_template(TelnetPrompt_template* p_precondition, TelnetPrompt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } TelnetPrompt_template::TelnetPrompt_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } TelnetPrompt_template::TelnetPrompt_template(const TelnetPrompt_template& other_value) : Base_Template() { copy_template(other_value); } TelnetPrompt_template::~TelnetPrompt_template() { clean_up(); } TelnetPrompt_template& TelnetPrompt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } TelnetPrompt_template& TelnetPrompt_template::operator=(const TelnetPrompt& other_value) { clean_up(); copy_value(other_value); return *this; } TelnetPrompt_template& TelnetPrompt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetPrompt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.TelnetPrompt."); } return *this; } TelnetPrompt_template& TelnetPrompt_template::operator=(const TelnetPrompt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean TelnetPrompt_template::match(const TelnetPrompt& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.id().is_bound()) return FALSE; if(!single_value->field_id.match(other_value.id(), legacy))return FALSE; if(!other_value.prompt().is_bound()) return FALSE; if(!single_value->field_prompt.match(other_value.prompt(), legacy))return FALSE; if(!other_value.has__wildcards().is_bound()) return FALSE; if(!single_value->field_has__wildcards.match(other_value.has__wildcards(), legacy))return FALSE; 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, legacy)) 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 type @TELNETasp_PortType.TelnetPrompt."); } return FALSE; } boolean TelnetPrompt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_id.is_bound() || single_value->field_prompt.is_bound() || single_value->field_has__wildcards.is_bound(); } boolean TelnetPrompt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_id.is_value() && single_value->field_prompt.is_value() && single_value->field_has__wildcards.is_value(); } void TelnetPrompt_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: delete single_value; break; 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; } TelnetPrompt TelnetPrompt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.TelnetPrompt."); TelnetPrompt ret_val; if (single_value->field_id.is_bound()) { ret_val.id() = single_value->field_id.valueof(); } if (single_value->field_prompt.is_bound()) { ret_val.prompt() = single_value->field_prompt.valueof(); } if (single_value->field_has__wildcards.is_bound()) { ret_val.has__wildcards() = single_value->field_has__wildcards.valueof(); } return ret_val; } void TelnetPrompt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.TelnetPrompt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new TelnetPrompt_template[list_length]; } TelnetPrompt_template& TelnetPrompt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.TelnetPrompt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.TelnetPrompt."); return value_list.list_value[list_index]; } INTEGER_template& TelnetPrompt_template::id() { set_specific(); return single_value->field_id; } const INTEGER_template& TelnetPrompt_template::id() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field id of a non-specific template of type @TELNETasp_PortType.TelnetPrompt."); return single_value->field_id; } CHARSTRING_template& TelnetPrompt_template::prompt() { set_specific(); return single_value->field_prompt; } const CHARSTRING_template& TelnetPrompt_template::prompt() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prompt of a non-specific template of type @TELNETasp_PortType.TelnetPrompt."); return single_value->field_prompt; } BOOLEAN_template& TelnetPrompt_template::has__wildcards() { set_specific(); return single_value->field_has__wildcards; } const BOOLEAN_template& TelnetPrompt_template::has__wildcards() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field has_wildcards of a non-specific template of type @TELNETasp_PortType.TelnetPrompt."); return single_value->field_has__wildcards; } int TelnetPrompt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.TelnetPrompt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetPrompt."); } return 0; } void TelnetPrompt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ id := "); single_value->field_id.log(); TTCN_Logger::log_event_str(", prompt := "); single_value->field_prompt.log(); TTCN_Logger::log_event_str(", has_wildcards := "); single_value->field_has__wildcards.log(); TTCN_Logger::log_event_str(" }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 TelnetPrompt_template::log_match(const TelnetPrompt& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_id.match(match_value.id(), legacy)){ TTCN_Logger::log_logmatch_info(".id"); single_value->field_id.log_match(match_value.id(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_prompt.match(match_value.prompt(), legacy)){ TTCN_Logger::log_logmatch_info(".prompt"); single_value->field_prompt.log_match(match_value.prompt(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_has__wildcards.match(match_value.has__wildcards(), legacy)){ TTCN_Logger::log_logmatch_info(".has_wildcards"); single_value->field_has__wildcards.log_match(match_value.has__wildcards(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ id := "); single_value->field_id.log_match(match_value.id(), legacy); TTCN_Logger::log_event_str(", prompt := "); single_value->field_prompt.log_match(match_value.prompt(), legacy); TTCN_Logger::log_event_str(", has_wildcards := "); single_value->field_has__wildcards.log_match(match_value.has__wildcards(), legacy); TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void TelnetPrompt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_id.encode_text(text_buf); single_value->field_prompt.encode_text(text_buf); single_value->field_has__wildcards.encode_text(text_buf); 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetPrompt."); } } void TelnetPrompt_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_id.decode_text(text_buf); single_value->field_prompt.decode_text(text_buf); single_value->field_has__wildcards.decode_text(text_buf); 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 TelnetPrompt_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.TelnetPrompt."); } } void TelnetPrompt_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); switch (param.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: { TelnetPrompt_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) id().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) prompt().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) has__wildcards().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "id")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { id().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prompt")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prompt().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "has_wildcards")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { has__wildcards().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.TelnetPrompt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { TelnetPrompt_template* precondition = new TelnetPrompt_template; precondition->set_param(*param.get_elem(0)); TelnetPrompt_template* implied_template = new TelnetPrompt_template; implied_template->set_param(*param.get_elem(1)); *this = TelnetPrompt_template(precondition, implied_template); } break; default: param.type_error("record template", "@TELNETasp_PortType.TelnetPrompt"); } is_ifpresent = param.get_ifpresent(); } void TelnetPrompt_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_id.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetPrompt"); single_value->field_prompt.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetPrompt"); single_value->field_has__wildcards.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetPrompt"); return; 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 : "@TELNETasp_PortType.TelnetPrompt"); } boolean TelnetPrompt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean TelnetPrompt_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 l_idx=0; l_idxref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } TelnetPrompts::TelnetPrompts(const TelnetPrompts& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TELNETasp_PortType.TelnetPrompts."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } TelnetPrompts::~TelnetPrompts() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void TelnetPrompts::clean_up() { if (val_ptr != NULL) { if (val_ptr->ref_count > 1) { val_ptr->ref_count--; val_ptr = NULL; } else if (val_ptr->ref_count == 1) { for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL) delete val_ptr->value_elements[elem_count]; free_pointers((void**)val_ptr->value_elements); delete val_ptr; val_ptr = NULL; } else TTCN_error("Internal error: Invalid reference counter in a record of/set of value."); } } TelnetPrompts& TelnetPrompts::operator=(null_type) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; return *this; } TelnetPrompts& TelnetPrompts::operator=(const TelnetPrompts& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean TelnetPrompts::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); return val_ptr->n_elements == 0 ; } boolean TelnetPrompts::operator==(const TelnetPrompts& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (val_ptr == other_value.val_ptr) return TRUE; if (val_ptr->n_elements != (other_value.val_ptr)->n_elements) return FALSE; for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ if ((other_value.val_ptr)->value_elements[elem_count] != NULL){ if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE; } else return FALSE; } else { if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE; } } return TRUE; } TelnetPrompt& TelnetPrompts::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @TELNETasp_PortType.TelnetPrompts using a negative index: %d.", index_value); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements; new_val_ptr->value_elements = (TelnetPrompt**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new TelnetPrompt(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (index_value >= val_ptr->n_elements) set_size(index_value + 1); if (val_ptr->value_elements[index_value] == NULL) { val_ptr->value_elements[index_value] = new TelnetPrompt; } return *val_ptr->value_elements[index_value]; } TelnetPrompt& TelnetPrompts::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @TELNETasp_PortType.TelnetPrompts."); return (*this)[(int)index_value]; } const TelnetPrompt& TelnetPrompts::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (index_value < 0) TTCN_error("Accessing an element of type @TELNETasp_PortType.TelnetPrompts using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @TELNETasp_PortType.TelnetPrompts: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements); return (val_ptr->value_elements[index_value] == NULL) ? UNBOUND_ELEM : *val_ptr->value_elements[index_value]; } const TelnetPrompt& TelnetPrompts::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @TELNETasp_PortType.TelnetPrompts."); return (*this)[(int)index_value]; } TelnetPrompts TelnetPrompts::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } TelnetPrompts TelnetPrompts::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } TelnetPrompts TelnetPrompts::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } TelnetPrompts TelnetPrompts::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (val_ptr->n_elements == 0) return *this; int rc; if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements; else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements); if (rc == 0) return *this; TelnetPrompts ret_val; ret_val.set_size(val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new TelnetPrompt(*val_ptr->value_elements[i]); } } return ret_val; } TelnetPrompts TelnetPrompts::operator+(const TelnetPrompts& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @TELNETasp_PortType.TelnetPrompts concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; TelnetPrompts ret_val; ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new TelnetPrompt(*val_ptr->value_elements[i]); } } for (int i=0; in_elements; i++) { if (other_value.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new TelnetPrompt(*other_value.val_ptr->value_elements[i]); } } return ret_val; } TelnetPrompts TelnetPrompts::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@TELNETasp_PortType.TelnetPrompts","element"); TelnetPrompts ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new TelnetPrompt(*val_ptr->value_elements[i+index]); } } return ret_val; } TelnetPrompts TelnetPrompts::replace(int index, int len, const TelnetPrompts& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); check_replace_arguments(val_ptr->n_elements, index, len, "@TELNETasp_PortType.TelnetPrompts","element"); TelnetPrompts ret_val; ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len); for (int i = 0; i < index; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new TelnetPrompt(*val_ptr->value_elements[i]); } } for (int i = 0; i < repl.val_ptr->n_elements; i++) { if (repl.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+index] = new TelnetPrompt(*repl.val_ptr->value_elements[i]); } } for (int i = 0; i < val_ptr->n_elements - index - len; i++) { if (val_ptr->value_elements[index+i+len] != NULL) { ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new TelnetPrompt(*val_ptr->value_elements[index+i+len]); } } return ret_val; } TelnetPrompts TelnetPrompts::replace(int index, int len, const TelnetPrompts_template& repl) const { if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return replace(index, len, repl.valueof()); } void TelnetPrompts::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @TELNETasp_PortType.TelnetPrompts."); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements; new_val_ptr->value_elements = (TelnetPrompt**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) { if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new TelnetPrompt(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (TelnetPrompt**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); #ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @TELNETasp_PortType.TelnetPrompts: %d",new_size); #endif val_ptr->n_elements = new_size; } else if (new_size < val_ptr->n_elements) { for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count]; val_ptr->value_elements = (TelnetPrompt**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean TelnetPrompts::is_value() const { if (val_ptr == NULL) return FALSE; for(int i = 0; i < val_ptr->n_elements; ++i) { if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE; } return TRUE; } int TelnetPrompts::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @TELNETasp_PortType.TelnetPrompts."); return val_ptr->n_elements; } int TelnetPrompts::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @TELNETasp_PortType.TelnetPrompts."); for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length; return 0; } void TelnetPrompts::log() const { if (val_ptr == NULL) {; TTCN_Logger::log_event_unbound(); return; } switch (val_ptr->n_elements) { case 0: TTCN_Logger::log_event_str("{ }"); break; default: TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); (*this)[elem_count].log(); } TTCN_Logger::log_event_str(" }"); } } void TelnetPrompts::set_implicit_omit() { if (val_ptr == NULL) return; for (int i = 0; i < val_ptr->n_elements; i++) { if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit(); } } void TelnetPrompts::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value"); switch (param.get_operation_type()) { case Module_Param::OT_ASSIGN: if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) { *this = NULL_VALUE; return; } switch (param.get_type()) { case Module_Param::MP_Value_List: set_size(param.get_size()); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed) { (*this)[i].set_param(*curr); if (!(*this)[i].is_bound()) { delete val_ptr->value_elements[i]; val_ptr->value_elements[i] = NULL; } } } break; case Module_Param::MP_Indexed_List: for (size_t i=0; iget_id()->get_index()].set_param(*curr); if (!(*this)[curr->get_id()->get_index()].is_bound()) { delete val_ptr->value_elements[curr->get_id()->get_index()]; val_ptr->value_elements[curr->get_id()->get_index()] = NULL; } } break; default: param.type_error("record of value", "@TELNETasp_PortType.TelnetPrompts"); } break; case Module_Param::OT_CONCAT: switch (param.get_type()) { case Module_Param::MP_Value_List: { if (!is_bound()) *this = NULL_VALUE; int start_idx = lengthof(); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed)) { (*this)[start_idx+(int)i].set_param(*curr); } } } break; case Module_Param::MP_Indexed_List: param.error("Cannot concatenate an indexed value list"); break; default: param.type_error("record of value", "@TELNETasp_PortType.TelnetPrompts"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void TelnetPrompts::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @TELNETasp_PortType.TelnetPrompts."); text_buf.push_int(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) (*this)[elem_count].encode_text(text_buf); } void TelnetPrompts::decode_text(Text_Buf& text_buf) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = text_buf.pull_int().get_val(); if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @TELNETasp_PortType.TelnetPrompts."); val_ptr->value_elements = (TelnetPrompt**)allocate_pointers(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { val_ptr->value_elements[elem_count] = new TelnetPrompt; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void TelnetPrompts_template::copy_value(const TelnetPrompts& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @TELNETasp_PortType.TelnetPrompts with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (TelnetPrompt_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (other_value[elem_count].is_bound()) { single_value.value_elements[elem_count] = new TelnetPrompt_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new TelnetPrompt_template; } } set_selection(SPECIFIC_VALUE); } void TelnetPrompts_template::copy_template(const TelnetPrompts_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.n_elements = other_value.single_value.n_elements; single_value.value_elements = (TelnetPrompt_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) { single_value.value_elements[elem_count] = new TelnetPrompt_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new TelnetPrompt_template; } } 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 TelnetPrompts_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 TelnetPrompts_template(*other_value.implication_.precondition); implication_.implied_template = new TelnetPrompts_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 type @TELNETasp_PortType.TelnetPrompts."); break; } set_selection(other_value); } boolean TelnetPrompts_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy) { if (value_index >= 0) return ((const TelnetPrompts_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const TelnetPrompts*)value_ptr)[value_index], legacy); else return ((const TelnetPrompts_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } TelnetPrompts_template::TelnetPrompts_template() { } TelnetPrompts_template::TelnetPrompts_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } TelnetPrompts_template::TelnetPrompts_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } TelnetPrompts_template::TelnetPrompts_template(const TelnetPrompts& other_value) { copy_value(other_value); } TelnetPrompts_template::TelnetPrompts_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetPrompts&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.TelnetPrompts from an unbound optional field."); } } TelnetPrompts_template::TelnetPrompts_template(TelnetPrompts_template* p_precondition, TelnetPrompts_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } TelnetPrompts_template::TelnetPrompts_template(Dynamic_Match_Interface* p_dyn_match) : Base_Record_Of_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } TelnetPrompts_template::TelnetPrompts_template(const TelnetPrompts_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } TelnetPrompts_template::~TelnetPrompts_template() { clean_up(); } void TelnetPrompts_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; free_pointers((void**)single_value.value_elements); break; 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; } TelnetPrompts_template& TelnetPrompts_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } TelnetPrompts_template& TelnetPrompts_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } TelnetPrompts_template& TelnetPrompts_template::operator=(const TelnetPrompts& other_value) { clean_up(); copy_value(other_value); return *this; } TelnetPrompts_template& TelnetPrompts_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TelnetPrompts&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.TelnetPrompts."); } return *this; } TelnetPrompts_template& TelnetPrompts_template::operator=(const TelnetPrompts_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } TelnetPrompt_template& TelnetPrompts_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @TELNETasp_PortType.TelnetPrompts using a negative index: %d.", index_value); switch (template_selection) { case SPECIFIC_VALUE: if(index_value < single_value.n_elements) break; // no break case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case UNINITIALIZED_TEMPLATE: set_size(index_value + 1); break; default: TTCN_error("Accessing an element of a non-specific template for type @TELNETasp_PortType.TelnetPrompts."); break; } return *single_value.value_elements[index_value]; } TelnetPrompt_template& TelnetPrompts_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @TELNETasp_PortType.TelnetPrompts."); return (*this)[(int)index_value]; } const TelnetPrompt_template& TelnetPrompts_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @TELNETasp_PortType.TelnetPrompts using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @TELNETasp_PortType.TelnetPrompts."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @TELNETasp_PortType.TelnetPrompts: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements); return *single_value.value_elements[index_value]; } const TelnetPrompt_template& TelnetPrompts_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @TELNETasp_PortType.TelnetPrompts."); return (*this)[(int)index_value]; } void TelnetPrompts_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @TELNETasp_PortType.TelnetPrompts."); template_sel old_selection = template_selection; if (old_selection != SPECIFIC_VALUE) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; } if (new_size > single_value.n_elements) { single_value.value_elements = (TelnetPrompt_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new TelnetPrompt_template(ANY_VALUE); } else { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new TelnetPrompt_template; } single_value.n_elements = new_size; } else if (new_size < single_value.n_elements) { for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; single_value.value_elements = (TelnetPrompt_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int TelnetPrompts_template::n_elem() const { switch (template_selection) { case SPECIFIC_VALUE: return single_value.n_elements; break; case VALUE_LIST: return value_list.n_values; break; default: TTCN_error("Performing n_elem"); } } int TelnetPrompts_template::size_of(boolean is_size) const { const char* op_name = is_size ? "size" : "length"; int min_size; boolean has_any_or_none; if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts which has an ifpresent attribute.", op_name); switch (template_selection) { case SPECIFIC_VALUE: { min_size = 0; has_any_or_none = FALSE; int elem_count = single_value.n_elements; if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; } for (int i=0; iget_selection()) { case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts containing omit element.", op_name); case ANY_OR_OMIT: has_any_or_none = TRUE; break; default: min_size++; break; } } } break; case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts containing omit value.", op_name); case ANY_VALUE: case ANY_OR_OMIT: min_size = 0; has_any_or_none = TRUE; break; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts containing an empty list.", op_name); int item_size = value_list.list_value[0].size_of(is_size); for (unsigned int i = 1; i < value_list.n_values; i++) { if (value_list.list_value[i].size_of(is_size)!=item_size) TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts containing a value list with different sizes.", op_name); } min_size = item_size; has_any_or_none = FALSE; break; } case COMPLEMENTED_LIST: TTCN_error("Performing %sof() operation on a template of type @TELNETasp_PortType.TelnetPrompts containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetPrompts.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @TELNETasp_PortType.TelnetPrompts"); } boolean TelnetPrompts_template::match(const TelnetPrompts& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; int value_length = other_value.size_of(); if (!match_length(value_length)) return FALSE; switch (template_selection) { case SPECIFIC_VALUE: return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy); 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, legacy)) 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 with an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetPrompts."); } return FALSE; } boolean TelnetPrompts_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (!single_value.value_elements[elem_count]->is_value()) return FALSE; return TRUE; } TelnetPrompts TelnetPrompts_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.TelnetPrompts."); TelnetPrompts ret_val; ret_val.set_size(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (single_value.value_elements[elem_count]->is_bound()) { ret_val[elem_count] = single_value.value_elements[elem_count]->valueof(); } return ret_val; } TelnetPrompts TelnetPrompts_template::substr(int index, int returncount) const { if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value."); return valueof().substr(index, returncount); } TelnetPrompts TelnetPrompts_template::replace(int index, int len, const TelnetPrompts_template& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl.valueof()); } TelnetPrompts TelnetPrompts_template::replace(int index, int len, const TelnetPrompts& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl); } void TelnetPrompts_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: value_list.n_values = list_length; value_list.list_value = new TelnetPrompts_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @TELNETasp_PortType.TelnetPrompts."); } set_selection(template_type); } TelnetPrompts_template& TelnetPrompts_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @TELNETasp_PortType.TelnetPrompts."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @TELNETasp_PortType.TelnetPrompts."); return value_list.list_value[list_index]; } void TelnetPrompts_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: if (single_value.n_elements > 0) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation("); single_value.value_elements[elem_count]->log(); if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')'); } TTCN_Logger::log_event_str(" }"); } else TTCN_Logger::log_event_str("{ }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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_restricted(); log_ifpresent(); } void TelnetPrompts_template::log_match(const TelnetPrompts& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); }else{ if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){ TTCN_Logger::log_logmatch_info("[%d]", elem_count); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } log_match_length(single_value.n_elements); } else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); } TTCN_Logger::log_event_str(" }"); log_match_length(single_value.n_elements); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void TelnetPrompts_template::encode_text(Text_Buf& text_buf) const { encode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) single_value.value_elements[elem_count]->encode_text(text_buf); 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.TelnetPrompts."); } } void TelnetPrompts_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value.n_elements = text_buf.pull_int().get_val(); if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @TELNETasp_PortType.TelnetPrompts."); single_value.value_elements = (TelnetPrompt_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { single_value.value_elements[elem_count] = new TelnetPrompt_template; single_value.value_elements[elem_count]->decode_text(text_buf); } 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 TelnetPrompts_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @TELNETasp_PortType.TelnetPrompts."); } } boolean TelnetPrompts_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean TelnetPrompts_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; iget_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { TelnetPrompts_template* precondition = new TelnetPrompts_template; precondition->set_param(*param.get_elem(0)); TelnetPrompts_template* implied_template = new TelnetPrompts_template; implied_template->set_param(*param.get_elem(1)); *this = TelnetPrompts_template(precondition, implied_template); } break; default: param.type_error("record of template", "@TELNETasp_PortType.TelnetPrompts"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void TelnetPrompts_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; for (int i=0; icheck_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.TelnetPrompts"); return; 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 : "@TELNETasp_PortType.TelnetPrompts"); } boolean TelnetPrompts_template::get_istemplate_kind(const char* type) const { if (!strcmp(type, "AnyElement")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_VALUE) { return TRUE; } } return FALSE; } else if (!strcmp(type, "AnyElementsOrNone")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) { return TRUE; } } return FALSE; } else if (!strcmp(type, "permutation")) { return number_of_permutations; } else if (!strcmp(type, "length")) { return length_restriction_type != NO_LENGTH_RESTRICTION; } else { return Base_Template::get_istemplate_kind(type); } } ASP__TelnetPortParameters::ASP__TelnetPortParameters() { } ASP__TelnetPortParameters::ASP__TelnetPortParameters(const OPTIONAL< CHARSTRING >& par_ctrl__hostname, const OPTIONAL< INTEGER >& par_ctrl__portnum, const OPTIONAL< CHARSTRING >& par_ctrl__username, const OPTIONAL< CHARSTRING >& par_ctrl__password, const OPTIONAL< CHARSTRING >& par_ctrl__domain, const OPTIONAL< TelnetReadMode >& par_ctrl__readmode, const OPTIONAL< BOOLEAN >& par_ctrl__login__skipped, const OPTIONAL< BOOLEAN >& par_ctrl__detect__server__disconnected, const OPTIONAL< TelnetPrompts >& par_prompts, const OPTIONAL< CHARSTRING >& par_ctrl__terminal__type, const OPTIONAL< BOOLEAN >& par_ctrl__echo, const OPTIONAL< BOOLEAN >& par_ctrl__CRLF, const OPTIONAL< TelnetWindowSize >& par_ctrl__window__size) : field_ctrl__hostname(par_ctrl__hostname), field_ctrl__portnum(par_ctrl__portnum), field_ctrl__username(par_ctrl__username), field_ctrl__password(par_ctrl__password), field_ctrl__domain(par_ctrl__domain), field_ctrl__readmode(par_ctrl__readmode), field_ctrl__login__skipped(par_ctrl__login__skipped), field_ctrl__detect__server__disconnected(par_ctrl__detect__server__disconnected), field_prompts(par_prompts), field_ctrl__terminal__type(par_ctrl__terminal__type), field_ctrl__echo(par_ctrl__echo), field_ctrl__CRLF(par_ctrl__CRLF), field_ctrl__window__size(par_ctrl__window__size) { } ASP__TelnetPortParameters::ASP__TelnetPortParameters(const ASP__TelnetPortParameters& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TELNETasp_PortType.ASP_TelnetPortParameters."); if (other_value.ctrl__hostname().is_bound()) field_ctrl__hostname = other_value.ctrl__hostname(); else field_ctrl__hostname.clean_up(); if (other_value.ctrl__portnum().is_bound()) field_ctrl__portnum = other_value.ctrl__portnum(); else field_ctrl__portnum.clean_up(); if (other_value.ctrl__username().is_bound()) field_ctrl__username = other_value.ctrl__username(); else field_ctrl__username.clean_up(); if (other_value.ctrl__password().is_bound()) field_ctrl__password = other_value.ctrl__password(); else field_ctrl__password.clean_up(); if (other_value.ctrl__domain().is_bound()) field_ctrl__domain = other_value.ctrl__domain(); else field_ctrl__domain.clean_up(); if (other_value.ctrl__readmode().is_bound()) field_ctrl__readmode = other_value.ctrl__readmode(); else field_ctrl__readmode.clean_up(); if (other_value.ctrl__login__skipped().is_bound()) field_ctrl__login__skipped = other_value.ctrl__login__skipped(); else field_ctrl__login__skipped.clean_up(); if (other_value.ctrl__detect__server__disconnected().is_bound()) field_ctrl__detect__server__disconnected = other_value.ctrl__detect__server__disconnected(); else field_ctrl__detect__server__disconnected.clean_up(); if (other_value.prompts().is_bound()) field_prompts = other_value.prompts(); else field_prompts.clean_up(); if (other_value.ctrl__terminal__type().is_bound()) field_ctrl__terminal__type = other_value.ctrl__terminal__type(); else field_ctrl__terminal__type.clean_up(); if (other_value.ctrl__echo().is_bound()) field_ctrl__echo = other_value.ctrl__echo(); else field_ctrl__echo.clean_up(); if (other_value.ctrl__CRLF().is_bound()) field_ctrl__CRLF = other_value.ctrl__CRLF(); else field_ctrl__CRLF.clean_up(); if (other_value.ctrl__window__size().is_bound()) field_ctrl__window__size = other_value.ctrl__window__size(); else field_ctrl__window__size.clean_up(); } void ASP__TelnetPortParameters::clean_up() { field_ctrl__hostname.clean_up(); field_ctrl__portnum.clean_up(); field_ctrl__username.clean_up(); field_ctrl__password.clean_up(); field_ctrl__domain.clean_up(); field_ctrl__readmode.clean_up(); field_ctrl__login__skipped.clean_up(); field_ctrl__detect__server__disconnected.clean_up(); field_prompts.clean_up(); field_ctrl__terminal__type.clean_up(); field_ctrl__echo.clean_up(); field_ctrl__CRLF.clean_up(); field_ctrl__window__size.clean_up(); } const TTCN_Typedescriptor_t* ASP__TelnetPortParameters::get_descriptor() const { return &ASP__TelnetPortParameters_descr_; } ASP__TelnetPortParameters& ASP__TelnetPortParameters::operator=(const ASP__TelnetPortParameters& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TELNETasp_PortType.ASP_TelnetPortParameters."); if (other_value.ctrl__hostname().is_bound()) field_ctrl__hostname = other_value.ctrl__hostname(); else field_ctrl__hostname.clean_up(); if (other_value.ctrl__portnum().is_bound()) field_ctrl__portnum = other_value.ctrl__portnum(); else field_ctrl__portnum.clean_up(); if (other_value.ctrl__username().is_bound()) field_ctrl__username = other_value.ctrl__username(); else field_ctrl__username.clean_up(); if (other_value.ctrl__password().is_bound()) field_ctrl__password = other_value.ctrl__password(); else field_ctrl__password.clean_up(); if (other_value.ctrl__domain().is_bound()) field_ctrl__domain = other_value.ctrl__domain(); else field_ctrl__domain.clean_up(); if (other_value.ctrl__readmode().is_bound()) field_ctrl__readmode = other_value.ctrl__readmode(); else field_ctrl__readmode.clean_up(); if (other_value.ctrl__login__skipped().is_bound()) field_ctrl__login__skipped = other_value.ctrl__login__skipped(); else field_ctrl__login__skipped.clean_up(); if (other_value.ctrl__detect__server__disconnected().is_bound()) field_ctrl__detect__server__disconnected = other_value.ctrl__detect__server__disconnected(); else field_ctrl__detect__server__disconnected.clean_up(); if (other_value.prompts().is_bound()) field_prompts = other_value.prompts(); else field_prompts.clean_up(); if (other_value.ctrl__terminal__type().is_bound()) field_ctrl__terminal__type = other_value.ctrl__terminal__type(); else field_ctrl__terminal__type.clean_up(); if (other_value.ctrl__echo().is_bound()) field_ctrl__echo = other_value.ctrl__echo(); else field_ctrl__echo.clean_up(); if (other_value.ctrl__CRLF().is_bound()) field_ctrl__CRLF = other_value.ctrl__CRLF(); else field_ctrl__CRLF.clean_up(); if (other_value.ctrl__window__size().is_bound()) field_ctrl__window__size = other_value.ctrl__window__size(); else field_ctrl__window__size.clean_up(); } return *this; } boolean ASP__TelnetPortParameters::operator==(const ASP__TelnetPortParameters& other_value) const { return field_ctrl__hostname==other_value.field_ctrl__hostname && field_ctrl__portnum==other_value.field_ctrl__portnum && field_ctrl__username==other_value.field_ctrl__username && field_ctrl__password==other_value.field_ctrl__password && field_ctrl__domain==other_value.field_ctrl__domain && field_ctrl__readmode==other_value.field_ctrl__readmode && field_ctrl__login__skipped==other_value.field_ctrl__login__skipped && field_ctrl__detect__server__disconnected==other_value.field_ctrl__detect__server__disconnected && field_prompts==other_value.field_prompts && field_ctrl__terminal__type==other_value.field_ctrl__terminal__type && field_ctrl__echo==other_value.field_ctrl__echo && field_ctrl__CRLF==other_value.field_ctrl__CRLF && field_ctrl__window__size==other_value.field_ctrl__window__size; } boolean ASP__TelnetPortParameters::is_bound() const { return (OPTIONAL_OMIT == field_ctrl__hostname.get_selection() || field_ctrl__hostname.is_bound()) || (OPTIONAL_OMIT == field_ctrl__portnum.get_selection() || field_ctrl__portnum.is_bound()) || (OPTIONAL_OMIT == field_ctrl__username.get_selection() || field_ctrl__username.is_bound()) || (OPTIONAL_OMIT == field_ctrl__password.get_selection() || field_ctrl__password.is_bound()) || (OPTIONAL_OMIT == field_ctrl__domain.get_selection() || field_ctrl__domain.is_bound()) || (OPTIONAL_OMIT == field_ctrl__readmode.get_selection() || field_ctrl__readmode.is_bound()) || (OPTIONAL_OMIT == field_ctrl__login__skipped.get_selection() || field_ctrl__login__skipped.is_bound()) || (OPTIONAL_OMIT == field_ctrl__detect__server__disconnected.get_selection() || field_ctrl__detect__server__disconnected.is_bound()) || (OPTIONAL_OMIT == field_prompts.get_selection() || field_prompts.is_bound()) || (OPTIONAL_OMIT == field_ctrl__terminal__type.get_selection() || field_ctrl__terminal__type.is_bound()) || (OPTIONAL_OMIT == field_ctrl__echo.get_selection() || field_ctrl__echo.is_bound()) || (OPTIONAL_OMIT == field_ctrl__CRLF.get_selection() || field_ctrl__CRLF.is_bound()) || (OPTIONAL_OMIT == field_ctrl__window__size.get_selection() || field_ctrl__window__size.is_bound()); } boolean ASP__TelnetPortParameters::is_value() const { return (OPTIONAL_OMIT == field_ctrl__hostname.get_selection() || field_ctrl__hostname.is_value()) && (OPTIONAL_OMIT == field_ctrl__portnum.get_selection() || field_ctrl__portnum.is_value()) && (OPTIONAL_OMIT == field_ctrl__username.get_selection() || field_ctrl__username.is_value()) && (OPTIONAL_OMIT == field_ctrl__password.get_selection() || field_ctrl__password.is_value()) && (OPTIONAL_OMIT == field_ctrl__domain.get_selection() || field_ctrl__domain.is_value()) && (OPTIONAL_OMIT == field_ctrl__readmode.get_selection() || field_ctrl__readmode.is_value()) && (OPTIONAL_OMIT == field_ctrl__login__skipped.get_selection() || field_ctrl__login__skipped.is_value()) && (OPTIONAL_OMIT == field_ctrl__detect__server__disconnected.get_selection() || field_ctrl__detect__server__disconnected.is_value()) && (OPTIONAL_OMIT == field_prompts.get_selection() || field_prompts.is_value()) && (OPTIONAL_OMIT == field_ctrl__terminal__type.get_selection() || field_ctrl__terminal__type.is_value()) && (OPTIONAL_OMIT == field_ctrl__echo.get_selection() || field_ctrl__echo.is_value()) && (OPTIONAL_OMIT == field_ctrl__CRLF.get_selection() || field_ctrl__CRLF.is_value()) && (OPTIONAL_OMIT == field_ctrl__window__size.get_selection() || field_ctrl__window__size.is_value()); } int ASP__TelnetPortParameters::size_of() const { int ret_val = 0; if (field_ctrl__hostname.ispresent()) ret_val++; if (field_ctrl__portnum.ispresent()) ret_val++; if (field_ctrl__username.ispresent()) ret_val++; if (field_ctrl__password.ispresent()) ret_val++; if (field_ctrl__domain.ispresent()) ret_val++; if (field_ctrl__readmode.ispresent()) ret_val++; if (field_ctrl__login__skipped.ispresent()) ret_val++; if (field_ctrl__detect__server__disconnected.ispresent()) ret_val++; if (field_prompts.ispresent()) ret_val++; if (field_ctrl__terminal__type.ispresent()) ret_val++; if (field_ctrl__echo.ispresent()) ret_val++; if (field_ctrl__CRLF.ispresent()) ret_val++; if (field_ctrl__window__size.ispresent()) ret_val++; return ret_val; } void ASP__TelnetPortParameters::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ ctrl_hostname := "); field_ctrl__hostname.log(); TTCN_Logger::log_event_str(", ctrl_portnum := "); field_ctrl__portnum.log(); TTCN_Logger::log_event_str(", ctrl_username := "); field_ctrl__username.log(); TTCN_Logger::log_event_str(", ctrl_password := "); field_ctrl__password.log(); TTCN_Logger::log_event_str(", ctrl_domain := "); field_ctrl__domain.log(); TTCN_Logger::log_event_str(", ctrl_readmode := "); field_ctrl__readmode.log(); TTCN_Logger::log_event_str(", ctrl_login_skipped := "); field_ctrl__login__skipped.log(); TTCN_Logger::log_event_str(", ctrl_detect_server_disconnected := "); field_ctrl__detect__server__disconnected.log(); TTCN_Logger::log_event_str(", prompts := "); field_prompts.log(); TTCN_Logger::log_event_str(", ctrl_terminal_type := "); field_ctrl__terminal__type.log(); TTCN_Logger::log_event_str(", ctrl_echo := "); field_ctrl__echo.log(); TTCN_Logger::log_event_str(", ctrl_CRLF := "); field_ctrl__CRLF.log(); TTCN_Logger::log_event_str(", ctrl_window_size := "); field_ctrl__window__size.log(); TTCN_Logger::log_event_str(" }"); } void ASP__TelnetPortParameters::set_implicit_omit() { if (!ctrl__hostname().is_bound()) ctrl__hostname() = OMIT_VALUE; else ctrl__hostname().set_implicit_omit(); if (!ctrl__portnum().is_bound()) ctrl__portnum() = OMIT_VALUE; else ctrl__portnum().set_implicit_omit(); if (!ctrl__username().is_bound()) ctrl__username() = OMIT_VALUE; else ctrl__username().set_implicit_omit(); if (!ctrl__password().is_bound()) ctrl__password() = OMIT_VALUE; else ctrl__password().set_implicit_omit(); if (!ctrl__domain().is_bound()) ctrl__domain() = OMIT_VALUE; else ctrl__domain().set_implicit_omit(); if (!ctrl__readmode().is_bound()) ctrl__readmode() = OMIT_VALUE; else ctrl__readmode().set_implicit_omit(); if (!ctrl__login__skipped().is_bound()) ctrl__login__skipped() = OMIT_VALUE; else ctrl__login__skipped().set_implicit_omit(); if (!ctrl__detect__server__disconnected().is_bound()) ctrl__detect__server__disconnected() = OMIT_VALUE; else ctrl__detect__server__disconnected().set_implicit_omit(); if (!prompts().is_bound()) prompts() = OMIT_VALUE; else prompts().set_implicit_omit(); if (!ctrl__terminal__type().is_bound()) ctrl__terminal__type() = OMIT_VALUE; else ctrl__terminal__type().set_implicit_omit(); if (!ctrl__echo().is_bound()) ctrl__echo() = OMIT_VALUE; else ctrl__echo().set_implicit_omit(); if (!ctrl__CRLF().is_bound()) ctrl__CRLF() = OMIT_VALUE; else ctrl__CRLF().set_implicit_omit(); if (!ctrl__window__size().is_bound()) ctrl__window__size() = OMIT_VALUE; else ctrl__window__size().set_implicit_omit(); } void ASP__TelnetPortParameters::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (130 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ctrl__hostname().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl__portnum().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ctrl__username().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ctrl__password().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ctrl__domain().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ctrl__readmode().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ctrl__login__skipped().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) ctrl__detect__server__disconnected().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) prompts().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) ctrl__terminal__type().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) ctrl__echo().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) ctrl__CRLF().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) ctrl__window__size().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_hostname")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__hostname().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_portnum")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__portnum().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_username")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__username().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_password")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__password().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_domain")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__domain().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_readmode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__readmode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_login_skipped")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__login__skipped().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_detect_server_disconnected")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__detect__server__disconnected().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prompts")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prompts().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_terminal_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__terminal__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_echo")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__echo().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_CRLF")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__CRLF().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_window_size")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__window__size().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.ASP_TelnetPortParameters: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@TELNETasp_PortType.ASP_TelnetPortParameters"); } } void ASP__TelnetPortParameters::encode_text(Text_Buf& text_buf) const { field_ctrl__hostname.encode_text(text_buf); field_ctrl__portnum.encode_text(text_buf); field_ctrl__username.encode_text(text_buf); field_ctrl__password.encode_text(text_buf); field_ctrl__domain.encode_text(text_buf); field_ctrl__readmode.encode_text(text_buf); field_ctrl__login__skipped.encode_text(text_buf); field_ctrl__detect__server__disconnected.encode_text(text_buf); field_prompts.encode_text(text_buf); field_ctrl__terminal__type.encode_text(text_buf); field_ctrl__echo.encode_text(text_buf); field_ctrl__CRLF.encode_text(text_buf); field_ctrl__window__size.encode_text(text_buf); } void ASP__TelnetPortParameters::decode_text(Text_Buf& text_buf) { field_ctrl__hostname.decode_text(text_buf); field_ctrl__portnum.decode_text(text_buf); field_ctrl__username.decode_text(text_buf); field_ctrl__password.decode_text(text_buf); field_ctrl__domain.decode_text(text_buf); field_ctrl__readmode.decode_text(text_buf); field_ctrl__login__skipped.decode_text(text_buf); field_ctrl__detect__server__disconnected.decode_text(text_buf); field_prompts.decode_text(text_buf); field_ctrl__terminal__type.decode_text(text_buf); field_ctrl__echo.decode_text(text_buf); field_ctrl__CRLF.decode_text(text_buf); field_ctrl__window__size.decode_text(text_buf); } struct ASP__TelnetPortParameters_template::single_value_struct { CHARSTRING_template field_ctrl__hostname; INTEGER_template field_ctrl__portnum; CHARSTRING_template field_ctrl__username; CHARSTRING_template field_ctrl__password; CHARSTRING_template field_ctrl__domain; TelnetReadMode_template field_ctrl__readmode; BOOLEAN_template field_ctrl__login__skipped; BOOLEAN_template field_ctrl__detect__server__disconnected; TelnetPrompts_template field_prompts; CHARSTRING_template field_ctrl__terminal__type; BOOLEAN_template field_ctrl__echo; BOOLEAN_template field_ctrl__CRLF; TelnetWindowSize_template field_ctrl__window__size; }; void ASP__TelnetPortParameters_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_ctrl__hostname = ANY_OR_OMIT; single_value->field_ctrl__portnum = ANY_OR_OMIT; single_value->field_ctrl__username = ANY_OR_OMIT; single_value->field_ctrl__password = ANY_OR_OMIT; single_value->field_ctrl__domain = ANY_OR_OMIT; single_value->field_ctrl__readmode = ANY_OR_OMIT; single_value->field_ctrl__login__skipped = ANY_OR_OMIT; single_value->field_ctrl__detect__server__disconnected = ANY_OR_OMIT; single_value->field_prompts = ANY_OR_OMIT; single_value->field_ctrl__terminal__type = ANY_OR_OMIT; single_value->field_ctrl__echo = ANY_OR_OMIT; single_value->field_ctrl__CRLF = ANY_OR_OMIT; single_value->field_ctrl__window__size = ANY_OR_OMIT; } } } void ASP__TelnetPortParameters_template::copy_value(const ASP__TelnetPortParameters& other_value) { single_value = new single_value_struct; if (other_value.ctrl__hostname().is_bound()) { if (other_value.ctrl__hostname().ispresent()) single_value->field_ctrl__hostname = other_value.ctrl__hostname()(); else single_value->field_ctrl__hostname = OMIT_VALUE; } else { single_value->field_ctrl__hostname.clean_up(); } if (other_value.ctrl__portnum().is_bound()) { if (other_value.ctrl__portnum().ispresent()) single_value->field_ctrl__portnum = other_value.ctrl__portnum()(); else single_value->field_ctrl__portnum = OMIT_VALUE; } else { single_value->field_ctrl__portnum.clean_up(); } if (other_value.ctrl__username().is_bound()) { if (other_value.ctrl__username().ispresent()) single_value->field_ctrl__username = other_value.ctrl__username()(); else single_value->field_ctrl__username = OMIT_VALUE; } else { single_value->field_ctrl__username.clean_up(); } if (other_value.ctrl__password().is_bound()) { if (other_value.ctrl__password().ispresent()) single_value->field_ctrl__password = other_value.ctrl__password()(); else single_value->field_ctrl__password = OMIT_VALUE; } else { single_value->field_ctrl__password.clean_up(); } if (other_value.ctrl__domain().is_bound()) { if (other_value.ctrl__domain().ispresent()) single_value->field_ctrl__domain = other_value.ctrl__domain()(); else single_value->field_ctrl__domain = OMIT_VALUE; } else { single_value->field_ctrl__domain.clean_up(); } if (other_value.ctrl__readmode().is_bound()) { if (other_value.ctrl__readmode().ispresent()) single_value->field_ctrl__readmode = other_value.ctrl__readmode()(); else single_value->field_ctrl__readmode = OMIT_VALUE; } else { single_value->field_ctrl__readmode.clean_up(); } if (other_value.ctrl__login__skipped().is_bound()) { if (other_value.ctrl__login__skipped().ispresent()) single_value->field_ctrl__login__skipped = other_value.ctrl__login__skipped()(); else single_value->field_ctrl__login__skipped = OMIT_VALUE; } else { single_value->field_ctrl__login__skipped.clean_up(); } if (other_value.ctrl__detect__server__disconnected().is_bound()) { if (other_value.ctrl__detect__server__disconnected().ispresent()) single_value->field_ctrl__detect__server__disconnected = other_value.ctrl__detect__server__disconnected()(); else single_value->field_ctrl__detect__server__disconnected = OMIT_VALUE; } else { single_value->field_ctrl__detect__server__disconnected.clean_up(); } if (other_value.prompts().is_bound()) { if (other_value.prompts().ispresent()) single_value->field_prompts = other_value.prompts()(); else single_value->field_prompts = OMIT_VALUE; } else { single_value->field_prompts.clean_up(); } if (other_value.ctrl__terminal__type().is_bound()) { if (other_value.ctrl__terminal__type().ispresent()) single_value->field_ctrl__terminal__type = other_value.ctrl__terminal__type()(); else single_value->field_ctrl__terminal__type = OMIT_VALUE; } else { single_value->field_ctrl__terminal__type.clean_up(); } if (other_value.ctrl__echo().is_bound()) { if (other_value.ctrl__echo().ispresent()) single_value->field_ctrl__echo = other_value.ctrl__echo()(); else single_value->field_ctrl__echo = OMIT_VALUE; } else { single_value->field_ctrl__echo.clean_up(); } if (other_value.ctrl__CRLF().is_bound()) { if (other_value.ctrl__CRLF().ispresent()) single_value->field_ctrl__CRLF = other_value.ctrl__CRLF()(); else single_value->field_ctrl__CRLF = OMIT_VALUE; } else { single_value->field_ctrl__CRLF.clean_up(); } if (other_value.ctrl__window__size().is_bound()) { if (other_value.ctrl__window__size().ispresent()) single_value->field_ctrl__window__size = other_value.ctrl__window__size()(); else single_value->field_ctrl__window__size = OMIT_VALUE; } else { single_value->field_ctrl__window__size.clean_up(); } set_selection(SPECIFIC_VALUE); } void ASP__TelnetPortParameters_template::copy_template(const ASP__TelnetPortParameters_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ctrl__hostname().get_selection()) { single_value->field_ctrl__hostname = other_value.ctrl__hostname(); } else { single_value->field_ctrl__hostname.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__portnum().get_selection()) { single_value->field_ctrl__portnum = other_value.ctrl__portnum(); } else { single_value->field_ctrl__portnum.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__username().get_selection()) { single_value->field_ctrl__username = other_value.ctrl__username(); } else { single_value->field_ctrl__username.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__password().get_selection()) { single_value->field_ctrl__password = other_value.ctrl__password(); } else { single_value->field_ctrl__password.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__domain().get_selection()) { single_value->field_ctrl__domain = other_value.ctrl__domain(); } else { single_value->field_ctrl__domain.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__readmode().get_selection()) { single_value->field_ctrl__readmode = other_value.ctrl__readmode(); } else { single_value->field_ctrl__readmode.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__login__skipped().get_selection()) { single_value->field_ctrl__login__skipped = other_value.ctrl__login__skipped(); } else { single_value->field_ctrl__login__skipped.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__detect__server__disconnected().get_selection()) { single_value->field_ctrl__detect__server__disconnected = other_value.ctrl__detect__server__disconnected(); } else { single_value->field_ctrl__detect__server__disconnected.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.prompts().get_selection()) { single_value->field_prompts = other_value.prompts(); } else { single_value->field_prompts.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__terminal__type().get_selection()) { single_value->field_ctrl__terminal__type = other_value.ctrl__terminal__type(); } else { single_value->field_ctrl__terminal__type.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__echo().get_selection()) { single_value->field_ctrl__echo = other_value.ctrl__echo(); } else { single_value->field_ctrl__echo.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__CRLF().get_selection()) { single_value->field_ctrl__CRLF = other_value.ctrl__CRLF(); } else { single_value->field_ctrl__CRLF.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ctrl__window__size().get_selection()) { single_value->field_ctrl__window__size = other_value.ctrl__window__size(); } else { single_value->field_ctrl__window__size.clean_up(); } 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 ASP__TelnetPortParameters_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 ASP__TelnetPortParameters_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__TelnetPortParameters_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 type @TELNETasp_PortType.ASP_TelnetPortParameters."); break; } set_selection(other_value); } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template() { } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(const ASP__TelnetPortParameters& other_value) { copy_value(other_value); } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__TelnetPortParameters&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.ASP_TelnetPortParameters from an unbound optional field."); } } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(ASP__TelnetPortParameters_template* p_precondition, ASP__TelnetPortParameters_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__TelnetPortParameters_template::ASP__TelnetPortParameters_template(const ASP__TelnetPortParameters_template& other_value) : Base_Template() { copy_template(other_value); } ASP__TelnetPortParameters_template::~ASP__TelnetPortParameters_template() { clean_up(); } ASP__TelnetPortParameters_template& ASP__TelnetPortParameters_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__TelnetPortParameters_template& ASP__TelnetPortParameters_template::operator=(const ASP__TelnetPortParameters& other_value) { clean_up(); copy_value(other_value); return *this; } ASP__TelnetPortParameters_template& ASP__TelnetPortParameters_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__TelnetPortParameters&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); } return *this; } ASP__TelnetPortParameters_template& ASP__TelnetPortParameters_template::operator=(const ASP__TelnetPortParameters_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ASP__TelnetPortParameters_template::match(const ASP__TelnetPortParameters& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.ctrl__hostname().is_bound()) return FALSE; if((other_value.ctrl__hostname().ispresent() ? !single_value->field_ctrl__hostname.match((const CHARSTRING&)other_value.ctrl__hostname(), legacy) : !single_value->field_ctrl__hostname.match_omit(legacy)))return FALSE; if(!other_value.ctrl__portnum().is_bound()) return FALSE; if((other_value.ctrl__portnum().ispresent() ? !single_value->field_ctrl__portnum.match((const INTEGER&)other_value.ctrl__portnum(), legacy) : !single_value->field_ctrl__portnum.match_omit(legacy)))return FALSE; if(!other_value.ctrl__username().is_bound()) return FALSE; if((other_value.ctrl__username().ispresent() ? !single_value->field_ctrl__username.match((const CHARSTRING&)other_value.ctrl__username(), legacy) : !single_value->field_ctrl__username.match_omit(legacy)))return FALSE; if(!other_value.ctrl__password().is_bound()) return FALSE; if((other_value.ctrl__password().ispresent() ? !single_value->field_ctrl__password.match((const CHARSTRING&)other_value.ctrl__password(), legacy) : !single_value->field_ctrl__password.match_omit(legacy)))return FALSE; if(!other_value.ctrl__domain().is_bound()) return FALSE; if((other_value.ctrl__domain().ispresent() ? !single_value->field_ctrl__domain.match((const CHARSTRING&)other_value.ctrl__domain(), legacy) : !single_value->field_ctrl__domain.match_omit(legacy)))return FALSE; if(!other_value.ctrl__readmode().is_bound()) return FALSE; if((other_value.ctrl__readmode().ispresent() ? !single_value->field_ctrl__readmode.match((const TelnetReadMode&)other_value.ctrl__readmode(), legacy) : !single_value->field_ctrl__readmode.match_omit(legacy)))return FALSE; if(!other_value.ctrl__login__skipped().is_bound()) return FALSE; if((other_value.ctrl__login__skipped().ispresent() ? !single_value->field_ctrl__login__skipped.match((const BOOLEAN&)other_value.ctrl__login__skipped(), legacy) : !single_value->field_ctrl__login__skipped.match_omit(legacy)))return FALSE; if(!other_value.ctrl__detect__server__disconnected().is_bound()) return FALSE; if((other_value.ctrl__detect__server__disconnected().ispresent() ? !single_value->field_ctrl__detect__server__disconnected.match((const BOOLEAN&)other_value.ctrl__detect__server__disconnected(), legacy) : !single_value->field_ctrl__detect__server__disconnected.match_omit(legacy)))return FALSE; if(!other_value.prompts().is_bound()) return FALSE; if((other_value.prompts().ispresent() ? !single_value->field_prompts.match((const TelnetPrompts&)other_value.prompts(), legacy) : !single_value->field_prompts.match_omit(legacy)))return FALSE; if(!other_value.ctrl__terminal__type().is_bound()) return FALSE; if((other_value.ctrl__terminal__type().ispresent() ? !single_value->field_ctrl__terminal__type.match((const CHARSTRING&)other_value.ctrl__terminal__type(), legacy) : !single_value->field_ctrl__terminal__type.match_omit(legacy)))return FALSE; if(!other_value.ctrl__echo().is_bound()) return FALSE; if((other_value.ctrl__echo().ispresent() ? !single_value->field_ctrl__echo.match((const BOOLEAN&)other_value.ctrl__echo(), legacy) : !single_value->field_ctrl__echo.match_omit(legacy)))return FALSE; if(!other_value.ctrl__CRLF().is_bound()) return FALSE; if((other_value.ctrl__CRLF().ispresent() ? !single_value->field_ctrl__CRLF.match((const BOOLEAN&)other_value.ctrl__CRLF(), legacy) : !single_value->field_ctrl__CRLF.match_omit(legacy)))return FALSE; if(!other_value.ctrl__window__size().is_bound()) return FALSE; if((other_value.ctrl__window__size().ispresent() ? !single_value->field_ctrl__window__size.match((const TelnetWindowSize&)other_value.ctrl__window__size(), legacy) : !single_value->field_ctrl__window__size.match_omit(legacy)))return FALSE; 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, legacy)) 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 type @TELNETasp_PortType.ASP_TelnetPortParameters."); } return FALSE; } boolean ASP__TelnetPortParameters_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return (single_value->field_ctrl__hostname.is_omit() || single_value->field_ctrl__hostname.is_bound()) || (single_value->field_ctrl__portnum.is_omit() || single_value->field_ctrl__portnum.is_bound()) || (single_value->field_ctrl__username.is_omit() || single_value->field_ctrl__username.is_bound()) || (single_value->field_ctrl__password.is_omit() || single_value->field_ctrl__password.is_bound()) || (single_value->field_ctrl__domain.is_omit() || single_value->field_ctrl__domain.is_bound()) || (single_value->field_ctrl__readmode.is_omit() || single_value->field_ctrl__readmode.is_bound()) || (single_value->field_ctrl__login__skipped.is_omit() || single_value->field_ctrl__login__skipped.is_bound()) || (single_value->field_ctrl__detect__server__disconnected.is_omit() || single_value->field_ctrl__detect__server__disconnected.is_bound()) || (single_value->field_prompts.is_omit() || single_value->field_prompts.is_bound()) || (single_value->field_ctrl__terminal__type.is_omit() || single_value->field_ctrl__terminal__type.is_bound()) || (single_value->field_ctrl__echo.is_omit() || single_value->field_ctrl__echo.is_bound()) || (single_value->field_ctrl__CRLF.is_omit() || single_value->field_ctrl__CRLF.is_bound()) || (single_value->field_ctrl__window__size.is_omit() || single_value->field_ctrl__window__size.is_bound()); } boolean ASP__TelnetPortParameters_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return (single_value->field_ctrl__hostname.is_omit() || single_value->field_ctrl__hostname.is_value()) && (single_value->field_ctrl__portnum.is_omit() || single_value->field_ctrl__portnum.is_value()) && (single_value->field_ctrl__username.is_omit() || single_value->field_ctrl__username.is_value()) && (single_value->field_ctrl__password.is_omit() || single_value->field_ctrl__password.is_value()) && (single_value->field_ctrl__domain.is_omit() || single_value->field_ctrl__domain.is_value()) && (single_value->field_ctrl__readmode.is_omit() || single_value->field_ctrl__readmode.is_value()) && (single_value->field_ctrl__login__skipped.is_omit() || single_value->field_ctrl__login__skipped.is_value()) && (single_value->field_ctrl__detect__server__disconnected.is_omit() || single_value->field_ctrl__detect__server__disconnected.is_value()) && (single_value->field_prompts.is_omit() || single_value->field_prompts.is_value()) && (single_value->field_ctrl__terminal__type.is_omit() || single_value->field_ctrl__terminal__type.is_value()) && (single_value->field_ctrl__echo.is_omit() || single_value->field_ctrl__echo.is_value()) && (single_value->field_ctrl__CRLF.is_omit() || single_value->field_ctrl__CRLF.is_value()) && (single_value->field_ctrl__window__size.is_omit() || single_value->field_ctrl__window__size.is_value()); } void ASP__TelnetPortParameters_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: delete single_value; break; 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; } ASP__TelnetPortParameters ASP__TelnetPortParameters_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); ASP__TelnetPortParameters ret_val; if (single_value->field_ctrl__hostname.is_omit()) ret_val.ctrl__hostname() = OMIT_VALUE; else if (single_value->field_ctrl__hostname.is_bound()) { ret_val.ctrl__hostname() = single_value->field_ctrl__hostname.valueof(); } if (single_value->field_ctrl__portnum.is_omit()) ret_val.ctrl__portnum() = OMIT_VALUE; else if (single_value->field_ctrl__portnum.is_bound()) { ret_val.ctrl__portnum() = single_value->field_ctrl__portnum.valueof(); } if (single_value->field_ctrl__username.is_omit()) ret_val.ctrl__username() = OMIT_VALUE; else if (single_value->field_ctrl__username.is_bound()) { ret_val.ctrl__username() = single_value->field_ctrl__username.valueof(); } if (single_value->field_ctrl__password.is_omit()) ret_val.ctrl__password() = OMIT_VALUE; else if (single_value->field_ctrl__password.is_bound()) { ret_val.ctrl__password() = single_value->field_ctrl__password.valueof(); } if (single_value->field_ctrl__domain.is_omit()) ret_val.ctrl__domain() = OMIT_VALUE; else if (single_value->field_ctrl__domain.is_bound()) { ret_val.ctrl__domain() = single_value->field_ctrl__domain.valueof(); } if (single_value->field_ctrl__readmode.is_omit()) ret_val.ctrl__readmode() = OMIT_VALUE; else if (single_value->field_ctrl__readmode.is_bound()) { ret_val.ctrl__readmode() = single_value->field_ctrl__readmode.valueof(); } if (single_value->field_ctrl__login__skipped.is_omit()) ret_val.ctrl__login__skipped() = OMIT_VALUE; else if (single_value->field_ctrl__login__skipped.is_bound()) { ret_val.ctrl__login__skipped() = single_value->field_ctrl__login__skipped.valueof(); } if (single_value->field_ctrl__detect__server__disconnected.is_omit()) ret_val.ctrl__detect__server__disconnected() = OMIT_VALUE; else if (single_value->field_ctrl__detect__server__disconnected.is_bound()) { ret_val.ctrl__detect__server__disconnected() = single_value->field_ctrl__detect__server__disconnected.valueof(); } if (single_value->field_prompts.is_omit()) ret_val.prompts() = OMIT_VALUE; else if (single_value->field_prompts.is_bound()) { ret_val.prompts() = single_value->field_prompts.valueof(); } if (single_value->field_ctrl__terminal__type.is_omit()) ret_val.ctrl__terminal__type() = OMIT_VALUE; else if (single_value->field_ctrl__terminal__type.is_bound()) { ret_val.ctrl__terminal__type() = single_value->field_ctrl__terminal__type.valueof(); } if (single_value->field_ctrl__echo.is_omit()) ret_val.ctrl__echo() = OMIT_VALUE; else if (single_value->field_ctrl__echo.is_bound()) { ret_val.ctrl__echo() = single_value->field_ctrl__echo.valueof(); } if (single_value->field_ctrl__CRLF.is_omit()) ret_val.ctrl__CRLF() = OMIT_VALUE; else if (single_value->field_ctrl__CRLF.is_bound()) { ret_val.ctrl__CRLF() = single_value->field_ctrl__CRLF.valueof(); } if (single_value->field_ctrl__window__size.is_omit()) ret_val.ctrl__window__size() = OMIT_VALUE; else if (single_value->field_ctrl__window__size.is_bound()) { ret_val.ctrl__window__size() = single_value->field_ctrl__window__size.valueof(); } return ret_val; } void ASP__TelnetPortParameters_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__TelnetPortParameters_template[list_length]; } ASP__TelnetPortParameters_template& ASP__TelnetPortParameters_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return value_list.list_value[list_index]; } CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__hostname() { set_specific(); return single_value->field_ctrl__hostname; } const CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__hostname() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_hostname of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__hostname; } INTEGER_template& ASP__TelnetPortParameters_template::ctrl__portnum() { set_specific(); return single_value->field_ctrl__portnum; } const INTEGER_template& ASP__TelnetPortParameters_template::ctrl__portnum() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_portnum of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__portnum; } CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__username() { set_specific(); return single_value->field_ctrl__username; } const CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__username() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_username of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__username; } CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__password() { set_specific(); return single_value->field_ctrl__password; } const CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__password() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_password of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__password; } CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__domain() { set_specific(); return single_value->field_ctrl__domain; } const CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__domain() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_domain of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__domain; } TelnetReadMode_template& ASP__TelnetPortParameters_template::ctrl__readmode() { set_specific(); return single_value->field_ctrl__readmode; } const TelnetReadMode_template& ASP__TelnetPortParameters_template::ctrl__readmode() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_readmode of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__readmode; } BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__login__skipped() { set_specific(); return single_value->field_ctrl__login__skipped; } const BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__login__skipped() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_login_skipped of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__login__skipped; } BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__detect__server__disconnected() { set_specific(); return single_value->field_ctrl__detect__server__disconnected; } const BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__detect__server__disconnected() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_detect_server_disconnected of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__detect__server__disconnected; } TelnetPrompts_template& ASP__TelnetPortParameters_template::prompts() { set_specific(); return single_value->field_prompts; } const TelnetPrompts_template& ASP__TelnetPortParameters_template::prompts() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prompts of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_prompts; } CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__terminal__type() { set_specific(); return single_value->field_ctrl__terminal__type; } const CHARSTRING_template& ASP__TelnetPortParameters_template::ctrl__terminal__type() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_terminal_type of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__terminal__type; } BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__echo() { set_specific(); return single_value->field_ctrl__echo; } const BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__echo() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_echo of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__echo; } BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__CRLF() { set_specific(); return single_value->field_ctrl__CRLF; } const BOOLEAN_template& ASP__TelnetPortParameters_template::ctrl__CRLF() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_CRLF of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__CRLF; } TelnetWindowSize_template& ASP__TelnetPortParameters_template::ctrl__window__size() { set_specific(); return single_value->field_ctrl__window__size; } const TelnetWindowSize_template& ASP__TelnetPortParameters_template::ctrl__window__size() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl_window_size of a non-specific template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); return single_value->field_ctrl__window__size; } int ASP__TelnetPortParameters_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 0; if (single_value->field_ctrl__hostname.is_present()) ret_val++; if (single_value->field_ctrl__portnum.is_present()) ret_val++; if (single_value->field_ctrl__username.is_present()) ret_val++; if (single_value->field_ctrl__password.is_present()) ret_val++; if (single_value->field_ctrl__domain.is_present()) ret_val++; if (single_value->field_ctrl__readmode.is_present()) ret_val++; if (single_value->field_ctrl__login__skipped.is_present()) ret_val++; if (single_value->field_ctrl__detect__server__disconnected.is_present()) ret_val++; if (single_value->field_prompts.is_present()) ret_val++; if (single_value->field_ctrl__terminal__type.is_present()) ret_val++; if (single_value->field_ctrl__echo.is_present()) ret_val++; if (single_value->field_ctrl__CRLF.is_present()) ret_val++; if (single_value->field_ctrl__window__size.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_TelnetPortParameters containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); } return 0; } void ASP__TelnetPortParameters_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ctrl_hostname := "); single_value->field_ctrl__hostname.log(); TTCN_Logger::log_event_str(", ctrl_portnum := "); single_value->field_ctrl__portnum.log(); TTCN_Logger::log_event_str(", ctrl_username := "); single_value->field_ctrl__username.log(); TTCN_Logger::log_event_str(", ctrl_password := "); single_value->field_ctrl__password.log(); TTCN_Logger::log_event_str(", ctrl_domain := "); single_value->field_ctrl__domain.log(); TTCN_Logger::log_event_str(", ctrl_readmode := "); single_value->field_ctrl__readmode.log(); TTCN_Logger::log_event_str(", ctrl_login_skipped := "); single_value->field_ctrl__login__skipped.log(); TTCN_Logger::log_event_str(", ctrl_detect_server_disconnected := "); single_value->field_ctrl__detect__server__disconnected.log(); TTCN_Logger::log_event_str(", prompts := "); single_value->field_prompts.log(); TTCN_Logger::log_event_str(", ctrl_terminal_type := "); single_value->field_ctrl__terminal__type.log(); TTCN_Logger::log_event_str(", ctrl_echo := "); single_value->field_ctrl__echo.log(); TTCN_Logger::log_event_str(", ctrl_CRLF := "); single_value->field_ctrl__CRLF.log(); TTCN_Logger::log_event_str(", ctrl_window_size := "); single_value->field_ctrl__window__size.log(); TTCN_Logger::log_event_str(" }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 ASP__TelnetPortParameters_template::log_match(const ASP__TelnetPortParameters& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if (match_value.ctrl__hostname().ispresent()){ if(!single_value->field_ctrl__hostname.match(match_value.ctrl__hostname(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_hostname"); single_value->field_ctrl__hostname.log_match(match_value.ctrl__hostname(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__hostname.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_hostname := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__hostname.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__portnum().ispresent()){ if(!single_value->field_ctrl__portnum.match(match_value.ctrl__portnum(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_portnum"); single_value->field_ctrl__portnum.log_match(match_value.ctrl__portnum(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__portnum.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_portnum := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__portnum.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__username().ispresent()){ if(!single_value->field_ctrl__username.match(match_value.ctrl__username(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_username"); single_value->field_ctrl__username.log_match(match_value.ctrl__username(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__username.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_username := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__username.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__password().ispresent()){ if(!single_value->field_ctrl__password.match(match_value.ctrl__password(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_password"); single_value->field_ctrl__password.log_match(match_value.ctrl__password(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__password.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_password := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__password.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__domain().ispresent()){ if(!single_value->field_ctrl__domain.match(match_value.ctrl__domain(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_domain"); single_value->field_ctrl__domain.log_match(match_value.ctrl__domain(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__domain.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_domain := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__domain.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__readmode().ispresent()){ if(!single_value->field_ctrl__readmode.match(match_value.ctrl__readmode(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_readmode"); single_value->field_ctrl__readmode.log_match(match_value.ctrl__readmode(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__readmode.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_readmode := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__readmode.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__login__skipped().ispresent()){ if(!single_value->field_ctrl__login__skipped.match(match_value.ctrl__login__skipped(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_login_skipped"); single_value->field_ctrl__login__skipped.log_match(match_value.ctrl__login__skipped(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__login__skipped.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_login_skipped := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__login__skipped.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__detect__server__disconnected().ispresent()){ if(!single_value->field_ctrl__detect__server__disconnected.match(match_value.ctrl__detect__server__disconnected(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_detect_server_disconnected"); single_value->field_ctrl__detect__server__disconnected.log_match(match_value.ctrl__detect__server__disconnected(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__detect__server__disconnected.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_detect_server_disconnected := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__detect__server__disconnected.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.prompts().ispresent()){ if(!single_value->field_prompts.match(match_value.prompts(), legacy)){ TTCN_Logger::log_logmatch_info(".prompts"); single_value->field_prompts.log_match(match_value.prompts(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_prompts.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".prompts := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_prompts.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__terminal__type().ispresent()){ if(!single_value->field_ctrl__terminal__type.match(match_value.ctrl__terminal__type(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_terminal_type"); single_value->field_ctrl__terminal__type.log_match(match_value.ctrl__terminal__type(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__terminal__type.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_terminal_type := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__terminal__type.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__echo().ispresent()){ if(!single_value->field_ctrl__echo.match(match_value.ctrl__echo(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_echo"); single_value->field_ctrl__echo.log_match(match_value.ctrl__echo(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__echo.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_echo := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__echo.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__CRLF().ispresent()){ if(!single_value->field_ctrl__CRLF.match(match_value.ctrl__CRLF(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_CRLF"); single_value->field_ctrl__CRLF.log_match(match_value.ctrl__CRLF(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__CRLF.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_CRLF := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__CRLF.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.ctrl__window__size().ispresent()){ if(!single_value->field_ctrl__window__size.match(match_value.ctrl__window__size(), legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_window_size"); single_value->field_ctrl__window__size.log_match(match_value.ctrl__window__size(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ctrl__window__size.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ctrl_window_size := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ctrl__window__size.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ ctrl_hostname := "); if (match_value.ctrl__hostname().ispresent()) { single_value->field_ctrl__hostname.log_match(match_value.ctrl__hostname(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__hostname.log(); if (single_value->field_ctrl__hostname.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_portnum := "); if (match_value.ctrl__portnum().ispresent()) { single_value->field_ctrl__portnum.log_match(match_value.ctrl__portnum(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__portnum.log(); if (single_value->field_ctrl__portnum.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_username := "); if (match_value.ctrl__username().ispresent()) { single_value->field_ctrl__username.log_match(match_value.ctrl__username(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__username.log(); if (single_value->field_ctrl__username.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_password := "); if (match_value.ctrl__password().ispresent()) { single_value->field_ctrl__password.log_match(match_value.ctrl__password(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__password.log(); if (single_value->field_ctrl__password.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_domain := "); if (match_value.ctrl__domain().ispresent()) { single_value->field_ctrl__domain.log_match(match_value.ctrl__domain(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__domain.log(); if (single_value->field_ctrl__domain.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_readmode := "); if (match_value.ctrl__readmode().ispresent()) { single_value->field_ctrl__readmode.log_match(match_value.ctrl__readmode(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__readmode.log(); if (single_value->field_ctrl__readmode.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_login_skipped := "); if (match_value.ctrl__login__skipped().ispresent()) { single_value->field_ctrl__login__skipped.log_match(match_value.ctrl__login__skipped(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__login__skipped.log(); if (single_value->field_ctrl__login__skipped.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_detect_server_disconnected := "); if (match_value.ctrl__detect__server__disconnected().ispresent()) { single_value->field_ctrl__detect__server__disconnected.log_match(match_value.ctrl__detect__server__disconnected(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__detect__server__disconnected.log(); if (single_value->field_ctrl__detect__server__disconnected.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", prompts := "); if (match_value.prompts().ispresent()) { single_value->field_prompts.log_match(match_value.prompts(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_prompts.log(); if (single_value->field_prompts.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_terminal_type := "); if (match_value.ctrl__terminal__type().ispresent()) { single_value->field_ctrl__terminal__type.log_match(match_value.ctrl__terminal__type(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__terminal__type.log(); if (single_value->field_ctrl__terminal__type.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_echo := "); if (match_value.ctrl__echo().ispresent()) { single_value->field_ctrl__echo.log_match(match_value.ctrl__echo(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__echo.log(); if (single_value->field_ctrl__echo.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_CRLF := "); if (match_value.ctrl__CRLF().ispresent()) { single_value->field_ctrl__CRLF.log_match(match_value.ctrl__CRLF(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__CRLF.log(); if (single_value->field_ctrl__CRLF.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ctrl_window_size := "); if (match_value.ctrl__window__size().ispresent()) { single_value->field_ctrl__window__size.log_match(match_value.ctrl__window__size(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ctrl__window__size.log(); if (single_value->field_ctrl__window__size.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void ASP__TelnetPortParameters_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ctrl__hostname.encode_text(text_buf); single_value->field_ctrl__portnum.encode_text(text_buf); single_value->field_ctrl__username.encode_text(text_buf); single_value->field_ctrl__password.encode_text(text_buf); single_value->field_ctrl__domain.encode_text(text_buf); single_value->field_ctrl__readmode.encode_text(text_buf); single_value->field_ctrl__login__skipped.encode_text(text_buf); single_value->field_ctrl__detect__server__disconnected.encode_text(text_buf); single_value->field_prompts.encode_text(text_buf); single_value->field_ctrl__terminal__type.encode_text(text_buf); single_value->field_ctrl__echo.encode_text(text_buf); single_value->field_ctrl__CRLF.encode_text(text_buf); single_value->field_ctrl__window__size.encode_text(text_buf); 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); } } void ASP__TelnetPortParameters_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_ctrl__hostname.decode_text(text_buf); single_value->field_ctrl__portnum.decode_text(text_buf); single_value->field_ctrl__username.decode_text(text_buf); single_value->field_ctrl__password.decode_text(text_buf); single_value->field_ctrl__domain.decode_text(text_buf); single_value->field_ctrl__readmode.decode_text(text_buf); single_value->field_ctrl__login__skipped.decode_text(text_buf); single_value->field_ctrl__detect__server__disconnected.decode_text(text_buf); single_value->field_prompts.decode_text(text_buf); single_value->field_ctrl__terminal__type.decode_text(text_buf); single_value->field_ctrl__echo.decode_text(text_buf); single_value->field_ctrl__CRLF.decode_text(text_buf); single_value->field_ctrl__window__size.decode_text(text_buf); 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 ASP__TelnetPortParameters_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.ASP_TelnetPortParameters."); } } void ASP__TelnetPortParameters_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); switch (param.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: { ASP__TelnetPortParameters_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ctrl__hostname().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl__portnum().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ctrl__username().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ctrl__password().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ctrl__domain().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ctrl__readmode().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ctrl__login__skipped().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) ctrl__detect__server__disconnected().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) prompts().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) ctrl__terminal__type().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) ctrl__echo().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) ctrl__CRLF().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) ctrl__window__size().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_hostname")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__hostname().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_portnum")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__portnum().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_username")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__username().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_password")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__password().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_domain")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__domain().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_readmode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__readmode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_login_skipped")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__login__skipped().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_detect_server_disconnected")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__detect__server__disconnected().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prompts")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prompts().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_terminal_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__terminal__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_echo")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__echo().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_CRLF")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__CRLF().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ctrl_window_size")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ctrl__window__size().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.ASP_TelnetPortParameters: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ASP__TelnetPortParameters_template* precondition = new ASP__TelnetPortParameters_template; precondition->set_param(*param.get_elem(0)); ASP__TelnetPortParameters_template* implied_template = new ASP__TelnetPortParameters_template; implied_template->set_param(*param.get_elem(1)); *this = ASP__TelnetPortParameters_template(precondition, implied_template); } break; default: param.type_error("record template", "@TELNETasp_PortType.ASP_TelnetPortParameters"); } is_ifpresent = param.get_ifpresent(); } void ASP__TelnetPortParameters_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_ctrl__hostname.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__portnum.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__username.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__password.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__domain.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__readmode.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__login__skipped.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__detect__server__disconnected.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_prompts.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__terminal__type.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__echo.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__CRLF.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); single_value->field_ctrl__window__size.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetPortParameters"); return; 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 : "@TELNETasp_PortType.ASP_TelnetPortParameters"); } boolean ASP__TelnetPortParameters_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__TelnetPortParameters_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 l_idx=0; l_idxis_value(); case ALT_window__size: return field_window__size->is_value(); case ALT_echo: return field_echo->is_value(); case ALT_prompt: return field_prompt->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void ASP__TelnetDynamicConfig::clean_up() { switch (union_selection) { case ALT_readmode: delete field_readmode; break; case ALT_window__size: delete field_window__size; break; case ALT_echo: delete field_echo; break; case ALT_prompt: delete field_prompt; break; default: break; } union_selection = UNBOUND_VALUE; } void ASP__TelnetDynamicConfig::log() const { switch (union_selection) { case ALT_readmode: TTCN_Logger::log_event_str("{ readmode := "); field_readmode->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_window__size: TTCN_Logger::log_event_str("{ window_size := "); field_window__size->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_echo: TTCN_Logger::log_event_str("{ echo := "); field_echo->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_prompt: TTCN_Logger::log_event_str("{ prompt := "); field_prompt->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void ASP__TelnetDynamicConfig::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr m_p = ¶m; if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return; if (m_p->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); } Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "readmode")) { readmode().set_param(*mp_last); if (!readmode().is_bound()) clean_up(); return; } if (!strcmp(last_name, "window_size")) { window__size().set_param(*mp_last); if (!window__size().is_bound()) clean_up(); return; } if (!strcmp(last_name, "echo")) { echo().set_param(*mp_last); if (!echo().is_bound()) clean_up(); return; } if (!strcmp(last_name, "prompt")) { prompt().set_param(*mp_last); if (!prompt().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @TELNETasp_PortType.ASP_TelnetDynamicConfig.", last_name); } void ASP__TelnetDynamicConfig::set_implicit_omit() { switch (union_selection) { case ALT_readmode: field_readmode->set_implicit_omit(); break; case ALT_window__size: field_window__size->set_implicit_omit(); break; case ALT_echo: field_echo->set_implicit_omit(); break; case ALT_prompt: field_prompt->set_implicit_omit(); break; default: break; } } void ASP__TelnetDynamicConfig::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_readmode: field_readmode->encode_text(text_buf); break; case ALT_window__size: field_window__size->encode_text(text_buf); break; case ALT_echo: field_echo->encode_text(text_buf); break; case ALT_prompt: field_prompt->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } void ASP__TelnetDynamicConfig::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_readmode: readmode().decode_text(text_buf); break; case ALT_window__size: window__size().decode_text(text_buf); break; case ALT_echo: echo().decode_text(text_buf); break; case ALT_prompt: prompt().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } void ASP__TelnetDynamicConfig_template::copy_value(const ASP__TelnetDynamicConfig& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: single_value.field_readmode = new TelnetReadMode_template(other_value.readmode()); break; case ASP__TelnetDynamicConfig::ALT_window__size: single_value.field_window__size = new TelnetWindowSize_template(other_value.window__size()); break; case ASP__TelnetDynamicConfig::ALT_echo: single_value.field_echo = new BOOLEAN_template(other_value.echo()); break; case ASP__TelnetDynamicConfig::ALT_prompt: single_value.field_prompt = new TelnetPrompt_template(other_value.prompt()); break; default: TTCN_error("Initializing a template with an unbound value of type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } set_selection(SPECIFIC_VALUE); } void ASP__TelnetDynamicConfig_template::copy_template(const ASP__TelnetDynamicConfig_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.union_selection = other_value.single_value.union_selection; switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: single_value.field_readmode = new TelnetReadMode_template(*other_value.single_value.field_readmode); break; case ASP__TelnetDynamicConfig::ALT_window__size: single_value.field_window__size = new TelnetWindowSize_template(*other_value.single_value.field_window__size); break; case ASP__TelnetDynamicConfig::ALT_echo: single_value.field_echo = new BOOLEAN_template(*other_value.single_value.field_echo); break; case ASP__TelnetDynamicConfig::ALT_prompt: single_value.field_prompt = new TelnetPrompt_template(*other_value.single_value.field_prompt); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } 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 ASP__TelnetDynamicConfig_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 ASP__TelnetDynamicConfig_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__TelnetDynamicConfig_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 template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } set_selection(other_value); } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template() { } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(const ASP__TelnetDynamicConfig& other_value) { copy_value(other_value); } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__TelnetDynamicConfig&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig from an unbound optional field."); } } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(ASP__TelnetDynamicConfig_template* p_precondition, ASP__TelnetDynamicConfig_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__TelnetDynamicConfig_template::ASP__TelnetDynamicConfig_template(const ASP__TelnetDynamicConfig_template& other_value) : Base_Template(){ copy_template(other_value); } ASP__TelnetDynamicConfig_template::~ASP__TelnetDynamicConfig_template() { clean_up(); } void ASP__TelnetDynamicConfig_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: delete single_value.field_readmode; break; case ASP__TelnetDynamicConfig::ALT_window__size: delete single_value.field_window__size; break; case ASP__TelnetDynamicConfig::ALT_echo: delete single_value.field_echo; break; case ASP__TelnetDynamicConfig::ALT_prompt: delete single_value.field_prompt; default: break; } break; 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; } ASP__TelnetDynamicConfig_template& ASP__TelnetDynamicConfig_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__TelnetDynamicConfig_template& ASP__TelnetDynamicConfig_template::operator=(const ASP__TelnetDynamicConfig& other_value) { clean_up(); copy_value(other_value); return *this; } ASP__TelnetDynamicConfig_template& ASP__TelnetDynamicConfig_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__TelnetDynamicConfig&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } return *this; } ASP__TelnetDynamicConfig_template& ASP__TelnetDynamicConfig_template::operator=(const ASP__TelnetDynamicConfig_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ASP__TelnetDynamicConfig_template::match(const ASP__TelnetDynamicConfig& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: { ASP__TelnetDynamicConfig::union_selection_type value_selection = other_value.get_selection(); if (value_selection == ASP__TelnetDynamicConfig::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: return single_value.field_readmode->match(other_value.readmode(), legacy); case ASP__TelnetDynamicConfig::ALT_window__size: return single_value.field_window__size->match(other_value.window__size(), legacy); case ASP__TelnetDynamicConfig::ALT_echo: return single_value.field_echo->match(other_value.echo(), legacy); case ASP__TelnetDynamicConfig::ALT_prompt: return single_value.field_prompt->match(other_value.prompt(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } 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, legacy)) 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 template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } return FALSE; } boolean ASP__TelnetDynamicConfig_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: return single_value.field_readmode->is_value(); case ASP__TelnetDynamicConfig::ALT_window__size: return single_value.field_window__size->is_value(); case ASP__TelnetDynamicConfig::ALT_echo: return single_value.field_echo->is_value(); case ASP__TelnetDynamicConfig::ALT_prompt: return single_value.field_prompt->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } ASP__TelnetDynamicConfig ASP__TelnetDynamicConfig_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); ASP__TelnetDynamicConfig ret_val; switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: ret_val.readmode() = single_value.field_readmode->valueof(); break; case ASP__TelnetDynamicConfig::ALT_window__size: ret_val.window__size() = single_value.field_window__size->valueof(); break; case ASP__TelnetDynamicConfig::ALT_echo: ret_val.echo() = single_value.field_echo->valueof(); break; case ASP__TelnetDynamicConfig::ALT_prompt: ret_val.prompt() = single_value.field_prompt->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } return ret_val; } ASP__TelnetDynamicConfig_template& ASP__TelnetDynamicConfig_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return value_list.list_value[list_index]; } void ASP__TelnetDynamicConfig_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__TelnetDynamicConfig_template[list_length]; } TelnetReadMode_template& ASP__TelnetDynamicConfig_template::readmode() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ASP__TelnetDynamicConfig::ALT_readmode) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_readmode = new TelnetReadMode_template(ANY_VALUE); else single_value.field_readmode = new TelnetReadMode_template; single_value.union_selection = ASP__TelnetDynamicConfig::ALT_readmode; set_selection(SPECIFIC_VALUE); } return *single_value.field_readmode; } const TelnetReadMode_template& ASP__TelnetDynamicConfig_template::readmode() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field readmode in a non-specific template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); if (single_value.union_selection != ASP__TelnetDynamicConfig::ALT_readmode) TTCN_error("Accessing non-selected field readmode in a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return *single_value.field_readmode; } TelnetWindowSize_template& ASP__TelnetDynamicConfig_template::window__size() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ASP__TelnetDynamicConfig::ALT_window__size) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_window__size = new TelnetWindowSize_template(ANY_VALUE); else single_value.field_window__size = new TelnetWindowSize_template; single_value.union_selection = ASP__TelnetDynamicConfig::ALT_window__size; set_selection(SPECIFIC_VALUE); } return *single_value.field_window__size; } const TelnetWindowSize_template& ASP__TelnetDynamicConfig_template::window__size() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field window_size in a non-specific template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); if (single_value.union_selection != ASP__TelnetDynamicConfig::ALT_window__size) TTCN_error("Accessing non-selected field window_size in a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return *single_value.field_window__size; } BOOLEAN_template& ASP__TelnetDynamicConfig_template::echo() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ASP__TelnetDynamicConfig::ALT_echo) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_echo = new BOOLEAN_template(ANY_VALUE); else single_value.field_echo = new BOOLEAN_template; single_value.union_selection = ASP__TelnetDynamicConfig::ALT_echo; set_selection(SPECIFIC_VALUE); } return *single_value.field_echo; } const BOOLEAN_template& ASP__TelnetDynamicConfig_template::echo() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field echo in a non-specific template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); if (single_value.union_selection != ASP__TelnetDynamicConfig::ALT_echo) TTCN_error("Accessing non-selected field echo in a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return *single_value.field_echo; } TelnetPrompt_template& ASP__TelnetDynamicConfig_template::prompt() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ASP__TelnetDynamicConfig::ALT_prompt) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_prompt = new TelnetPrompt_template(ANY_VALUE); else single_value.field_prompt = new TelnetPrompt_template; single_value.union_selection = ASP__TelnetDynamicConfig::ALT_prompt; set_selection(SPECIFIC_VALUE); } return *single_value.field_prompt; } const TelnetPrompt_template& ASP__TelnetDynamicConfig_template::prompt() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prompt in a non-specific template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); if (single_value.union_selection != ASP__TelnetDynamicConfig::ALT_prompt) TTCN_error("Accessing non-selected field prompt in a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return *single_value.field_prompt; } boolean ASP__TelnetDynamicConfig_template::ischosen(ASP__TelnetDynamicConfig::union_selection_type checked_selection) const { if (checked_selection == ASP__TelnetDynamicConfig::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == ASP__TelnetDynamicConfig::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); return single_value.union_selection == checked_selection; case VALUE_LIST: { if (value_list.n_values < 1) TTCN_error("Internal error: Performing ischosen() operation on a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig containing an empty list."); boolean ret_val = value_list.list_value[0].ischosen(checked_selection); for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) { ret_val = value_list.list_value[list_count].ischosen(checked_selection); } return ret_val; } default: return FALSE; } return FALSE; } void ASP__TelnetDynamicConfig_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: TTCN_Logger::log_event_str("{ readmode := "); single_value.field_readmode->log(); TTCN_Logger::log_event_str(" }"); break; case ASP__TelnetDynamicConfig::ALT_window__size: TTCN_Logger::log_event_str("{ window_size := "); single_value.field_window__size->log(); TTCN_Logger::log_event_str(" }"); break; case ASP__TelnetDynamicConfig::ALT_echo: TTCN_Logger::log_event_str("{ echo := "); single_value.field_echo->log(); TTCN_Logger::log_event_str(" }"); break; case ASP__TelnetDynamicConfig::ALT_prompt: TTCN_Logger::log_event_str("{ prompt := "); single_value.field_prompt->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_str(""); } 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 ASP__TelnetDynamicConfig_template::log_match(const ASP__TelnetDynamicConfig& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); return; } if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".readmode"); single_value.field_readmode->log_match(match_value.readmode(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ readmode := "); single_value.field_readmode->log_match(match_value.readmode(), legacy); TTCN_Logger::log_event_str(" }"); } break; case ASP__TelnetDynamicConfig::ALT_window__size: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".window_size"); single_value.field_window__size->log_match(match_value.window__size(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ window_size := "); single_value.field_window__size->log_match(match_value.window__size(), legacy); TTCN_Logger::log_event_str(" }"); } break; case ASP__TelnetDynamicConfig::ALT_echo: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".echo"); single_value.field_echo->log_match(match_value.echo(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ echo := "); single_value.field_echo->log_match(match_value.echo(), legacy); TTCN_Logger::log_event_str(" }"); } break; case ASP__TelnetDynamicConfig::ALT_prompt: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".prompt"); single_value.field_prompt->log_match(match_value.prompt(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ prompt := "); single_value.field_prompt->log_match(match_value.prompt(), legacy); TTCN_Logger::log_event_str(" }"); } break; default: TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(""); } } else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void ASP__TelnetDynamicConfig_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.union_selection); switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: single_value.field_readmode->encode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_window__size: single_value.field_window__size->encode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_echo: single_value.field_echo->encode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_prompt: single_value.field_prompt->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized template of type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } void ASP__TelnetDynamicConfig_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = ASP__TelnetDynamicConfig::UNBOUND_VALUE; ASP__TelnetDynamicConfig::union_selection_type new_selection = (ASP__TelnetDynamicConfig::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: single_value.field_readmode = new TelnetReadMode_template; single_value.field_readmode->decode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_window__size: single_value.field_window__size = new TelnetWindowSize_template; single_value.field_window__size->decode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_echo: single_value.field_echo = new BOOLEAN_template; single_value.field_echo->decode_text(text_buf); break; case ASP__TelnetDynamicConfig::ALT_prompt: single_value.field_prompt = new TelnetPrompt_template; single_value.field_prompt->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } single_value.union_selection = new_selection; } 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 ASP__TelnetDynamicConfig_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized selector was received in a template of type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } } boolean ASP__TelnetDynamicConfig_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__TelnetDynamicConfig_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 v_idx=0; v_idx(param.get_id()) != NULL && param.get_id()->next_name()) { char* param_field = param.get_id()->get_current_name(); if (param_field[0] >= '0' && param_field[0] <= '9') { param.error("Unexpected array index in module parameter, expected a valid field" " name for union template type `@TELNETasp_PortType.ASP_TelnetDynamicConfig'"); } if (strcmp("readmode", param_field) == 0) { readmode().set_param(param); return; } else if (strcmp("window_size", param_field) == 0) { window__size().set_param(param); return; } else if (strcmp("echo", param_field) == 0) { echo().set_param(param); return; } else if (strcmp("prompt", param_field) == 0) { prompt().set_param(param); return; } else param.error("Field `%s' not found in union template type `@TELNETasp_PortType.ASP_TelnetDynamicConfig'", param_field); } param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr m_p = ¶m; 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: { ASP__TelnetDynamicConfig_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_iget_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_Value_List: if (m_p->get_size()==0) break; param.type_error("union template", "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); break; case Module_Param::MP_Assignment_List: { Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "readmode")) { readmode().set_param(*mp_last); break; } if (!strcmp(last_name, "window_size")) { window__size().set_param(*mp_last); break; } if (!strcmp(last_name, "echo")) { echo().set_param(*mp_last); break; } if (!strcmp(last_name, "prompt")) { prompt().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @TELNETasp_PortType.ASP_TelnetDynamicConfig.", last_name); } break; case Module_Param::MP_Implication_Template: { ASP__TelnetDynamicConfig_template* precondition = new ASP__TelnetDynamicConfig_template; precondition->set_param(*m_p->get_elem(0)); ASP__TelnetDynamicConfig_template* implied_template = new ASP__TelnetDynamicConfig_template; implied_template->set_param(*m_p->get_elem(1)); *this = ASP__TelnetDynamicConfig_template(precondition, implied_template); } break; default: param.type_error("union template", "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); } is_ifpresent = param.get_ifpresent(); } void ASP__TelnetDynamicConfig_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; switch (single_value.union_selection) { case ASP__TelnetDynamicConfig::ALT_readmode: single_value.field_readmode->check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); return; case ASP__TelnetDynamicConfig::ALT_window__size: single_value.field_window__size->check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); return; case ASP__TelnetDynamicConfig::ALT_echo: single_value.field_echo->check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); return; case ASP__TelnetDynamicConfig::ALT_prompt: single_value.field_prompt->check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @TELNETasp_PortType.ASP_TelnetDynamicConfig."); } 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 : "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); } ASP__TelnetConnection::ASP__TelnetConnection() { enum_value = UNBOUND_VALUE; } ASP__TelnetConnection::ASP__TelnetConnection(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @TELNETasp_PortType.ASP_TelnetConnection with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } ASP__TelnetConnection::ASP__TelnetConnection(enum_type other_value) { enum_value = other_value; } ASP__TelnetConnection::ASP__TelnetConnection(const ASP__TelnetConnection& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); enum_value = other_value.enum_value; } ASP__TelnetConnection& ASP__TelnetConnection::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @TELNETasp_PortType.ASP_TelnetConnection.", other_value); enum_value = (enum_type)other_value; return *this; } ASP__TelnetConnection& ASP__TelnetConnection::operator=(enum_type other_value) { enum_value = other_value; return *this; } ASP__TelnetConnection& ASP__TelnetConnection::operator=(const ASP__TelnetConnection& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); enum_value = other_value.enum_value; return *this; } boolean ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value == other_value; } boolean ASP__TelnetConnection::operator==(const ASP__TelnetConnection& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value == other_value.enum_value; } boolean ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value < other_value; } boolean ASP__TelnetConnection::operator<(const ASP__TelnetConnection& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value < other_value.enum_value; } boolean ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value > other_value; } boolean ASP__TelnetConnection::operator>(const ASP__TelnetConnection& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value > other_value.enum_value; } const char *ASP__TelnetConnection::enum_to_str(enum_type enum_par) { switch (enum_par) { case CONNECT: return "CONNECT"; default: return ""; } } ASP__TelnetConnection::enum_type ASP__TelnetConnection::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CONNECT")) return CONNECT; else return UNKNOWN_VALUE; } boolean ASP__TelnetConnection::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int ASP__TelnetConnection::enum2int(const ASP__TelnetConnection& 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 @TELNETasp_PortType.ASP_TelnetConnection.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void ASP__TelnetConnection::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @TELNETasp_PortType.ASP_TelnetConnection.", int_val); enum_value = (enum_type)int_val; } ASP__TelnetConnection::operator ASP__TelnetConnection::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); return enum_value; } void ASP__TelnetConnection::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 ASP__TelnetConnection::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", "@TELNETasp_PortType.ASP_TelnetConnection"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @TELNETasp_PortType.ASP_TelnetConnection."); } } void ASP__TelnetConnection::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); text_buf.push_int(enum_value); } void ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection.", enum_value); } void ASP__TelnetConnection_template::copy_template(const ASP__TelnetConnection_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 ASP__TelnetConnection_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 ASP__TelnetConnection_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__TelnetConnection_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 @TELNETasp_PortType.ASP_TelnetConnection."); } } ASP__TelnetConnection_template::ASP__TelnetConnection_template() { } ASP__TelnetConnection_template::ASP__TelnetConnection_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__TelnetConnection_template::ASP__TelnetConnection_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!ASP__TelnetConnection::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection with unknown numeric value %d.", other_value); single_value = (ASP__TelnetConnection::enum_type)other_value; } ASP__TelnetConnection_template::ASP__TelnetConnection_template(ASP__TelnetConnection::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } ASP__TelnetConnection_template::ASP__TelnetConnection_template(const ASP__TelnetConnection& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == ASP__TelnetConnection::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); single_value = other_value.enum_value; } ASP__TelnetConnection_template::ASP__TelnetConnection_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (ASP__TelnetConnection::enum_type)(const ASP__TelnetConnection&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection from an unbound optional field."); } } ASP__TelnetConnection_template::ASP__TelnetConnection_template(ASP__TelnetConnection_template* p_precondition, ASP__TelnetConnection_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__TelnetConnection_template::ASP__TelnetConnection_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__TelnetConnection_template::ASP__TelnetConnection_template(const ASP__TelnetConnection_template& other_value) : Base_Template() { copy_template(other_value); } ASP__TelnetConnection_template::~ASP__TelnetConnection_template() { clean_up(); } boolean ASP__TelnetConnection_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean ASP__TelnetConnection_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != ASP__TelnetConnection::UNBOUND_VALUE; } void ASP__TelnetConnection_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; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(int other_value) { if (!ASP__TelnetConnection::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (ASP__TelnetConnection::enum_type)other_value; return *this; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(ASP__TelnetConnection::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(const ASP__TelnetConnection& other_value) { if (other_value.enum_value == ASP__TelnetConnection::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @TELNETasp_PortType.ASP_TelnetConnection to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (ASP__TelnetConnection::enum_type)(const ASP__TelnetConnection&)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 @TELNETasp_PortType.ASP_TelnetConnection."); } return *this; } ASP__TelnetConnection_template& ASP__TelnetConnection_template::operator=(const ASP__TelnetConnection_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ASP__TelnetConnection_template::match(ASP__TelnetConnection::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 @TELNETasp_PortType.ASP_TelnetConnection."); } return FALSE; } boolean ASP__TelnetConnection_template::match(const ASP__TelnetConnection& other_value, boolean) const { if (other_value.enum_value == ASP__TelnetConnection::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection with an unbound value."); return match(other_value.enum_value); } ASP__TelnetConnection::enum_type ASP__TelnetConnection_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 @TELNETasp_PortType.ASP_TelnetConnection."); return single_value; } void ASP__TelnetConnection_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__TelnetConnection_template[list_length]; } ASP__TelnetConnection_template& ASP__TelnetConnection_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 @TELNETasp_PortType.ASP_TelnetConnection."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection."); return value_list.list_value[list_index]; } void ASP__TelnetConnection_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(ASP__TelnetConnection::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 ASP__TelnetConnection_template::log_match(const ASP__TelnetConnection& 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 ASP__TelnetConnection_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 @TELNETasp_PortType.ASP_TelnetConnection."); } } void ASP__TelnetConnection_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (ASP__TelnetConnection::enum_type)text_buf.pull_int().get_val(); if (!ASP__TelnetConnection::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @TELNETasp_PortType.ASP_TelnetConnection.", 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 ASP__TelnetConnection_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 @TELNETasp_PortType.ASP_TelnetConnection."); } } boolean ASP__TelnetConnection_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__TelnetConnection_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; iget_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: { ASP__TelnetConnection_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_iget_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: { ASP__TelnetConnection::enum_type enum_val = ASP__TelnetConnection::str_to_enum(m_p->get_enumerated()); if (!ASP__TelnetConnection::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @TELNETasp_PortType.ASP_TelnetConnection."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { ASP__TelnetConnection_template* precondition = new ASP__TelnetConnection_template; precondition->set_param(*m_p->get_elem(0)); ASP__TelnetConnection_template* implied_template = new ASP__TelnetConnection_template; implied_template->set_param(*m_p->get_elem(1)); *this = ASP__TelnetConnection_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@TELNETasp_PortType.ASP_TelnetConnection"); } is_ifpresent = param.get_ifpresent(); } void ASP__TelnetConnection_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 : "@TELNETasp_PortType.ASP_TelnetConnection"); } ASP__TelnetClose::ASP__TelnetClose() { bound_flag = FALSE; } ASP__TelnetClose::ASP__TelnetClose(null_type) { bound_flag = TRUE; } ASP__TelnetClose::ASP__TelnetClose(const ASP__TelnetClose& other_value) { other_value.must_bound("Copying an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); bound_flag = TRUE; } ASP__TelnetClose& ASP__TelnetClose::operator=(null_type) { bound_flag = TRUE; return *this; } ASP__TelnetClose& ASP__TelnetClose::operator=(const ASP__TelnetClose& other_value) { other_value.must_bound("Assignment of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); bound_flag = TRUE; return *this; } boolean ASP__TelnetClose::operator==(null_type) const { must_bound("Comparison of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); return TRUE; } boolean ASP__TelnetClose::operator==(const ASP__TelnetClose& other_value) const { must_bound("Comparison of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); other_value.must_bound("Comparison of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); return TRUE; } void ASP__TelnetClose::log() const { if (bound_flag) TTCN_Logger::log_event_str("{ }"); else TTCN_Logger::log_event_unbound(); } void ASP__TelnetClose::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "empty record/set value (i.e. { })"); if (param.get_type()!=Module_Param::MP_Value_List || param.get_size()>0) { param.type_error("empty record/set value (i.e. { })", "@TELNETasp_PortType.ASP_TelnetClose"); } bound_flag = TRUE; } void ASP__TelnetClose::encode_text(Text_Buf& /*text_buf*/) const { must_bound("Text encoder: Encoding an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); } void ASP__TelnetClose::decode_text(Text_Buf& /*text_buf*/) { bound_flag = TRUE; } void ASP__TelnetClose_template::copy_template(const ASP__TelnetClose_template& other_value) { set_selection(other_value); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: 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 ASP__TelnetClose_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 ASP__TelnetClose_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__TelnetClose_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 type @TELNETasp_PortType.ASP_TelnetClose."); break; } } ASP__TelnetClose_template::ASP__TelnetClose_template() { } ASP__TelnetClose_template::ASP__TelnetClose_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__TelnetClose_template::ASP__TelnetClose_template(null_type) : Base_Template(SPECIFIC_VALUE) { } ASP__TelnetClose_template::ASP__TelnetClose_template(const ASP__TelnetClose& other_value) : Base_Template(SPECIFIC_VALUE) { other_value.must_bound("Creating a template from an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); } ASP__TelnetClose_template::ASP__TelnetClose_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.ASP_TelnetClose from an unbound optional field."); } } ASP__TelnetClose_template::ASP__TelnetClose_template(ASP__TelnetClose_template* p_precondition, ASP__TelnetClose_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__TelnetClose_template::ASP__TelnetClose_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__TelnetClose_template::ASP__TelnetClose_template(const ASP__TelnetClose_template& other_value) : Base_Template(){ copy_template(other_value); } ASP__TelnetClose_template::~ASP__TelnetClose_template() { clean_up(); } void ASP__TelnetClose_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; } ASP__TelnetClose_template& ASP__TelnetClose_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__TelnetClose_template& ASP__TelnetClose_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); return *this; } ASP__TelnetClose_template& ASP__TelnetClose_template::operator=(const ASP__TelnetClose& other_value) { other_value.must_bound("Assignment of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose to a template."); clean_up(); set_selection(SPECIFIC_VALUE); return *this; } ASP__TelnetClose_template& ASP__TelnetClose_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.ASP_TelnetClose."); } return *this; } ASP__TelnetClose_template& ASP__TelnetClose_template::operator=(const ASP__TelnetClose_template& other_value) { if (&other_value != this) { clean_up(); set_selection(other_value); } return *this; } boolean ASP__TelnetClose_template::match(null_type other_value,boolean) const { switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: return TRUE; case OMIT_VALUE: return FALSE; 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 type @TELNETasp_PortType.ASP_TelnetClose."); } return FALSE; } boolean ASP__TelnetClose_template::match(const ASP__TelnetClose& other_value, boolean) const { if (!other_value.is_bound()) return FALSE; return match(NULL_VALUE); } ASP__TelnetClose ASP__TelnetClose_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.ASP_TelnetClose."); return NULL_VALUE; } void ASP__TelnetClose_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.ASP_TelnetClose."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__TelnetClose_template[list_length]; } ASP__TelnetClose_template& ASP__TelnetClose_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.ASP_TelnetClose."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.ASP_TelnetClose."); return value_list.list_value[list_index]; } void ASP__TelnetClose_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 ASP__TelnetClose_template::log_match(const ASP__TelnetClose& 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 ASP__TelnetClose_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_TelnetClose."); } } void ASP__TelnetClose_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new ASP__TelnetClose_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.ASP_TelnetClose."); } } void ASP__TelnetClose_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "empty record/set template"); switch (param.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: { ASP__TelnetClose_template temp; temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0) param.type_error("empty record/set template", "@TELNETasp_PortType.ASP_TelnetClose"); *this = NULL_VALUE; break; case Module_Param::MP_Implication_Template: { ASP__TelnetClose_template* precondition = new ASP__TelnetClose_template; precondition->set_param(*param.get_elem(0)); ASP__TelnetClose_template* implied_template = new ASP__TelnetClose_template; implied_template->set_param(*param.get_elem(1)); *this = ASP__TelnetClose_template(precondition, implied_template); } break; default: param.type_error("empty record/set template", "@TELNETasp_PortType.ASP_TelnetClose"); } is_ifpresent = param.get_ifpresent(); } void ASP__TelnetClose_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; return; 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 : "@TELNETasp_PortType.ASP_TelnetClose"); } boolean ASP__TelnetClose_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__TelnetClose_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 l_idx=0; l_idx0) { param.type_error("empty record/set value (i.e. { })", "@TELNETasp_PortType.ASP_Get_portnum"); } bound_flag = TRUE; } void ASP__Get__portnum::encode_text(Text_Buf& /*text_buf*/) const { must_bound("Text encoder: Encoding an unbound value of type @TELNETasp_PortType.ASP_Get_portnum."); } void ASP__Get__portnum::decode_text(Text_Buf& /*text_buf*/) { bound_flag = TRUE; } void ASP__Get__portnum_template::copy_template(const ASP__Get__portnum_template& other_value) { set_selection(other_value); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: 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 ASP__Get__portnum_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 ASP__Get__portnum_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__Get__portnum_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 type @TELNETasp_PortType.ASP_Get_portnum."); break; } } ASP__Get__portnum_template::ASP__Get__portnum_template() { } ASP__Get__portnum_template::ASP__Get__portnum_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__Get__portnum_template::ASP__Get__portnum_template(null_type) : Base_Template(SPECIFIC_VALUE) { } ASP__Get__portnum_template::ASP__Get__portnum_template(const ASP__Get__portnum& other_value) : Base_Template(SPECIFIC_VALUE) { other_value.must_bound("Creating a template from an unbound value of type @TELNETasp_PortType.ASP_Get_portnum."); } ASP__Get__portnum_template::ASP__Get__portnum_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.ASP_Get_portnum from an unbound optional field."); } } ASP__Get__portnum_template::ASP__Get__portnum_template(ASP__Get__portnum_template* p_precondition, ASP__Get__portnum_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__Get__portnum_template::ASP__Get__portnum_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__Get__portnum_template::ASP__Get__portnum_template(const ASP__Get__portnum_template& other_value) : Base_Template(){ copy_template(other_value); } ASP__Get__portnum_template::~ASP__Get__portnum_template() { clean_up(); } void ASP__Get__portnum_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; } ASP__Get__portnum_template& ASP__Get__portnum_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__Get__portnum_template& ASP__Get__portnum_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); return *this; } ASP__Get__portnum_template& ASP__Get__portnum_template::operator=(const ASP__Get__portnum& other_value) { other_value.must_bound("Assignment of an unbound value of type @TELNETasp_PortType.ASP_Get_portnum to a template."); clean_up(); set_selection(SPECIFIC_VALUE); return *this; } ASP__Get__portnum_template& ASP__Get__portnum_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.ASP_Get_portnum."); } return *this; } ASP__Get__portnum_template& ASP__Get__portnum_template::operator=(const ASP__Get__portnum_template& other_value) { if (&other_value != this) { clean_up(); set_selection(other_value); } return *this; } boolean ASP__Get__portnum_template::match(null_type other_value,boolean) const { switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: return TRUE; case OMIT_VALUE: return FALSE; 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 type @TELNETasp_PortType.ASP_Get_portnum."); } return FALSE; } boolean ASP__Get__portnum_template::match(const ASP__Get__portnum& other_value, boolean) const { if (!other_value.is_bound()) return FALSE; return match(NULL_VALUE); } ASP__Get__portnum ASP__Get__portnum_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.ASP_Get_portnum."); return NULL_VALUE; } void ASP__Get__portnum_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.ASP_Get_portnum."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__Get__portnum_template[list_length]; } ASP__Get__portnum_template& ASP__Get__portnum_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.ASP_Get_portnum."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.ASP_Get_portnum."); return value_list.list_value[list_index]; } void ASP__Get__portnum_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 ASP__Get__portnum_template::log_match(const ASP__Get__portnum& 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 ASP__Get__portnum_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_Get_portnum."); } } void ASP__Get__portnum_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case SPECIFIC_VALUE: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new ASP__Get__portnum_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.ASP_Get_portnum."); } } void ASP__Get__portnum_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "empty record/set template"); switch (param.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: { ASP__Get__portnum_template temp; temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0) param.type_error("empty record/set template", "@TELNETasp_PortType.ASP_Get_portnum"); *this = NULL_VALUE; break; case Module_Param::MP_Implication_Template: { ASP__Get__portnum_template* precondition = new ASP__Get__portnum_template; precondition->set_param(*param.get_elem(0)); ASP__Get__portnum_template* implied_template = new ASP__Get__portnum_template; implied_template->set_param(*param.get_elem(1)); *this = ASP__Get__portnum_template(precondition, implied_template); } break; default: param.type_error("empty record/set template", "@TELNETasp_PortType.ASP_Get_portnum"); } is_ifpresent = param.get_ifpresent(); } void ASP__Get__portnum_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; return; 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 : "@TELNETasp_PortType.ASP_Get_portnum"); } boolean ASP__Get__portnum_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__Get__portnum_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 l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) local__port__num().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "local_port_num")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__port__num().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.ASP_Portnum: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@TELNETasp_PortType.ASP_Portnum"); } } void ASP__Portnum::encode_text(Text_Buf& text_buf) const { field_local__port__num.encode_text(text_buf); } void ASP__Portnum::decode_text(Text_Buf& text_buf) { field_local__port__num.decode_text(text_buf); } struct ASP__Portnum_template::single_value_struct { INTEGER_template field_local__port__num; }; void ASP__Portnum_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_local__port__num = ANY_VALUE; } } } void ASP__Portnum_template::copy_value(const ASP__Portnum& other_value) { single_value = new single_value_struct; if (other_value.local__port__num().is_bound()) { single_value->field_local__port__num = other_value.local__port__num(); } else { single_value->field_local__port__num.clean_up(); } set_selection(SPECIFIC_VALUE); } void ASP__Portnum_template::copy_template(const ASP__Portnum_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.local__port__num().get_selection()) { single_value->field_local__port__num = other_value.local__port__num(); } else { single_value->field_local__port__num.clean_up(); } 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 ASP__Portnum_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 ASP__Portnum_template(*other_value.implication_.precondition); implication_.implied_template = new ASP__Portnum_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 type @TELNETasp_PortType.ASP_Portnum."); break; } set_selection(other_value); } ASP__Portnum_template::ASP__Portnum_template() { } ASP__Portnum_template::ASP__Portnum_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ASP__Portnum_template::ASP__Portnum_template(const ASP__Portnum& other_value) { copy_value(other_value); } ASP__Portnum_template::ASP__Portnum_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__Portnum&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @TELNETasp_PortType.ASP_Portnum from an unbound optional field."); } } ASP__Portnum_template::ASP__Portnum_template(ASP__Portnum_template* p_precondition, ASP__Portnum_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ASP__Portnum_template::ASP__Portnum_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } ASP__Portnum_template::ASP__Portnum_template(const ASP__Portnum_template& other_value) : Base_Template() { copy_template(other_value); } ASP__Portnum_template::~ASP__Portnum_template() { clean_up(); } ASP__Portnum_template& ASP__Portnum_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ASP__Portnum_template& ASP__Portnum_template::operator=(const ASP__Portnum& other_value) { clean_up(); copy_value(other_value); return *this; } ASP__Portnum_template& ASP__Portnum_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ASP__Portnum&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @TELNETasp_PortType.ASP_Portnum."); } return *this; } ASP__Portnum_template& ASP__Portnum_template::operator=(const ASP__Portnum_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ASP__Portnum_template::match(const ASP__Portnum& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.local__port__num().is_bound()) return FALSE; if(!single_value->field_local__port__num.match(other_value.local__port__num(), legacy))return FALSE; 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, legacy)) 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 type @TELNETasp_PortType.ASP_Portnum."); } return FALSE; } boolean ASP__Portnum_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_local__port__num.is_bound(); } boolean ASP__Portnum_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_local__port__num.is_value(); } void ASP__Portnum_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: delete single_value; break; 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; } ASP__Portnum ASP__Portnum_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @TELNETasp_PortType.ASP_Portnum."); ASP__Portnum ret_val; if (single_value->field_local__port__num.is_bound()) { ret_val.local__port__num() = single_value->field_local__port__num.valueof(); } return ret_val; } void ASP__Portnum_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @TELNETasp_PortType.ASP_Portnum."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ASP__Portnum_template[list_length]; } ASP__Portnum_template& ASP__Portnum_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @TELNETasp_PortType.ASP_Portnum."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @TELNETasp_PortType.ASP_Portnum."); return value_list.list_value[list_index]; } INTEGER_template& ASP__Portnum_template::local__port__num() { set_specific(); return single_value->field_local__port__num; } const INTEGER_template& ASP__Portnum_template::local__port__num() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field local_port_num of a non-specific template of type @TELNETasp_PortType.ASP_Portnum."); return single_value->field_local__port__num; } int ASP__Portnum_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @TELNETasp_PortType.ASP_Portnum containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_Portnum."); } return 0; } void ASP__Portnum_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ local_port_num := "); single_value->field_local__port__num.log(); TTCN_Logger::log_event_str(" }"); 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 list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_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 ASP__Portnum_template::log_match(const ASP__Portnum& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_local__port__num.match(match_value.local__port__num(), legacy)){ TTCN_Logger::log_logmatch_info(".local_port_num"); single_value->field_local__port__num.log_match(match_value.local__port__num(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ local_port_num := "); single_value->field_local__port__num.log_match(match_value.local__port__num(), legacy); TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void ASP__Portnum_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_local__port__num.encode_text(text_buf); 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 list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @TELNETasp_PortType.ASP_Portnum."); } } void ASP__Portnum_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_local__port__num.decode_text(text_buf); 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 ASP__Portnum_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].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @TELNETasp_PortType.ASP_Portnum."); } } void ASP__Portnum_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); switch (param.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: { ASP__Portnum_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) local__port__num().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "local_port_num")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__port__num().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @TELNETasp_PortType.ASP_Portnum: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ASP__Portnum_template* precondition = new ASP__Portnum_template; precondition->set_param(*param.get_elem(0)); ASP__Portnum_template* implied_template = new ASP__Portnum_template; implied_template->set_param(*param.get_elem(1)); *this = ASP__Portnum_template(precondition, implied_template); } break; default: param.type_error("record template", "@TELNETasp_PortType.ASP_Portnum"); } is_ifpresent = param.get_ifpresent(); } void ASP__Portnum_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_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_local__port__num.check_restriction(t_res, t_name ? t_name : "@TELNETasp_PortType.ASP_Portnum"); return; 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 : "@TELNETasp_PortType.ASP_Portnum"); } boolean ASP__Portnum_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ASP__Portnum_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 l_idx=0; l_idxitem_selection) { case MESSAGE_0: delete (my_head)->message_0; break; case MESSAGE_1: delete (my_head)->message_1; break; case MESSAGE_2: delete (my_head)->message_2; break; default: TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name); } msg_queue_item_base *next_item = msg_queue_head->next_item; delete (msg_queue_item*)msg_queue_head; msg_queue_head = next_item; if (next_item == NULL) msg_queue_tail = NULL; TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));} void TELNETasp__PT_BASE::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } TELNETasp__PT_BASE::TELNETasp__PT_BASE(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } TELNETasp__PT_BASE::~TELNETasp__PT_BASE() { clear_queue(); } void TELNETasp__PT_BASE::send(const ASP__TelnetPortParameters& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_TelnetPortParameters : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "@TELNETasp_PortType.ASP_TelnetPortParameters"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const ASP__TelnetPortParameters& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetPortParameters_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const ASP__TelnetPortParameters& send_par_value = ASP__TelnetPortParameters(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetPortParameters_template& send_par, FLOAT* timestamp_redirect) { const ASP__TelnetPortParameters& send_par_value = ASP__TelnetPortParameters(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetDynamicConfig& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_TelnetDynamicConfig : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "@TELNETasp_PortType.ASP_TelnetDynamicConfig"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const ASP__TelnetDynamicConfig& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetDynamicConfig_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const ASP__TelnetDynamicConfig& send_par_value = ASP__TelnetDynamicConfig(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetDynamicConfig_template& send_par, FLOAT* timestamp_redirect) { const ASP__TelnetDynamicConfig& send_par_value = ASP__TelnetDynamicConfig(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetConnection& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_TelnetConnection : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "@TELNETasp_PortType.ASP_TelnetConnection"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const ASP__TelnetConnection& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetConnection_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const ASP__TelnetConnection& send_par_value = ASP__TelnetConnection(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetConnection_template& send_par, FLOAT* timestamp_redirect) { const ASP__TelnetConnection& send_par_value = ASP__TelnetConnection(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetClose& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_TelnetClose : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "@TELNETasp_PortType.ASP_TelnetClose"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const ASP__TelnetClose& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetClose_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const ASP__TelnetClose& send_par_value = ASP__TelnetClose(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__TelnetClose_template& send_par, FLOAT* timestamp_redirect) { const ASP__TelnetClose& send_par_value = ASP__TelnetClose(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__Get__portnum& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_Get_portnum : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "@TELNETasp_PortType.ASP_Get_portnum"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const ASP__Get__portnum& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__Get__portnum_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const ASP__Get__portnum& send_par_value = ASP__Get__portnum(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const ASP__Get__portnum_template& send_par, FLOAT* timestamp_redirect) { const ASP__Get__portnum& send_par_value = ASP__Get__portnum(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const CHARSTRING& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation."); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_send(port_name, destination_component, (TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" charstring : "), send_par.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) { (void)get_default_destination(); outgoing_send(send_par); } else { Text_Buf text_buf; prepare_message(text_buf, "charstring"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void TELNETasp__PT_BASE::send(const CHARSTRING& send_par, FLOAT* timestamp_redirect) { send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void TELNETasp__PT_BASE::send(const CHARSTRING_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const CHARSTRING& send_par_value = CHARSTRING(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void TELNETasp__PT_BASE::send(const CHARSTRING_template& send_par, FLOAT* timestamp_redirect) { const CHARSTRING& send_par_value = CHARSTRING(send_par.valueof()); send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect); } alt_status TELNETasp__PT_BASE::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else { if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { switch (my_head->item_selection) { case MESSAGE_0: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum: "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_2: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring: "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; default: TTCN_error("Internal error: unknown message"); } } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else { if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { switch (my_head->item_selection) { case MESSAGE_0: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum: "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_2: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring: "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; default: TTCN_error("Internal error: unknown message"); } } return ALT_YES; } } alt_status TELNETasp__PT_BASE::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } remove_msg_queue_head(); return ALT_REPEAT; } else { if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { switch (my_head->item_selection) { case MESSAGE_0: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum: "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_2: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring: "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; default: TTCN_error("Internal error: unknown message"); } } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::receive(const INTEGER_template& value_template, INTEGER *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not integer.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::check_receive(const INTEGER_template& value_template, INTEGER *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not integer.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status TELNETasp__PT_BASE::trigger(const INTEGER_template& value_template, INTEGER *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } remove_msg_queue_head(); return ALT_REPEAT; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not integer.", port_name); remove_msg_queue_head(); return ALT_REPEAT; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } remove_msg_queue_head(); return ALT_REPEAT; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": integer : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::receive(const ASP__Portnum_template& value_template, ASP__Portnum *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_1) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @TELNETasp_PortType.ASP_Portnum.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_1)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_1; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::check_receive(const ASP__Portnum_template& value_template, ASP__Portnum *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_1) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @TELNETasp_PortType.ASP_Portnum.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_1)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_1; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status TELNETasp__PT_BASE::trigger(const ASP__Portnum_template& value_template, ASP__Portnum *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } remove_msg_queue_head(); return ALT_REPEAT; } else if (my_head->item_selection != MESSAGE_1) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @TELNETasp_PortType.ASP_Portnum.", port_name); remove_msg_queue_head(); return ALT_REPEAT; } else if (!value_template.match(*my_head->message_1)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } remove_msg_queue_head(); return ALT_REPEAT; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_1; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @TELNETasp_PortType.ASP_Portnum : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::receive(const CHARSTRING_template& value_template, CHARSTRING *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_2) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not charstring.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_2)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_2; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring : "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status TELNETasp__PT_BASE::check_receive(const CHARSTRING_template& value_template, CHARSTRING *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_2) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not charstring.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_2)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_2; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring : "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status TELNETasp__PT_BASE::trigger(const CHARSTRING_template& value_template, CHARSTRING *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } remove_msg_queue_head(); return ALT_REPEAT; } else if (my_head->item_selection != MESSAGE_2) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not charstring.", port_name); remove_msg_queue_head(); return ALT_REPEAT; } else if (!value_template.match(*my_head->message_2)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } remove_msg_queue_head(); return ALT_REPEAT; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_2; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": charstring : "), my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void TELNETasp__PT_BASE::incoming_message(const INTEGER& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a message has arrived on it.", port_name); } } msg_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" integer : "), incoming_par.log(), TTCN_Logger::end_event_log2str())); } msg_queue_item *new_item = new msg_queue_item; new_item->item_selection = MESSAGE_0; new_item->message_0 = new INTEGER(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void TELNETasp__PT_BASE::incoming_message(const ASP__Portnum& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a message has arrived on it.", port_name); } } msg_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @TELNETasp_PortType.ASP_Portnum : "), incoming_par.log(), TTCN_Logger::end_event_log2str())); } msg_queue_item *new_item = new msg_queue_item; new_item->item_selection = MESSAGE_1; new_item->message_1 = new ASP__Portnum(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void TELNETasp__PT_BASE::incoming_message(const CHARSTRING& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a message has arrived on it.", port_name); } } msg_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" charstring : "), incoming_par.log(), TTCN_Logger::end_event_log2str())); } msg_queue_item *new_item = new msg_queue_item; new_item->item_selection = MESSAGE_2; new_item->message_2 = new CHARSTRING(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean TELNETasp__PT_BASE::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "integer")) { INTEGER incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "@TELNETasp_PortType.ASP_Portnum")) { ASP__Portnum incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "charstring")) { CHARSTRING incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } /* Bodies of functions, altsteps and testcases */ boolean operator==(null_type, const TelnetPrompts& other_value) { if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @TELNETasp_PortType.TelnetPrompts."); return other_value.val_ptr->n_elements == 0; } boolean operator==(null_type, const ASP__TelnetClose& other_value) { other_value.must_bound("Comparison of an unbound value of type @TELNETasp_PortType.ASP_TelnetClose."); return TRUE; } boolean operator==(null_type, const ASP__Get__portnum& other_value) { other_value.must_bound("Comparison of an unbound value of type @TELNETasp_PortType.ASP_Get_portnum."); return TRUE; } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("TELNETasp_PortType.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "TELNETasp_PortType"); module_object.add_function("FindString", (genericfunc_t)&FindString, NULL); } } /* end of namespace */