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

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

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

/* Including header files */

#include "L3_Common.hh"

namespace L3__Common {

/* Literal string constants */

const unsigned char hs_0_nibbles[] = { 15 };
extern const HEXSTRING hs_0(1, hs_0_nibbles);
const unsigned char module_checksum[] = { 0x5c, 0x7c, 0xbd, 0xe0, 0xd3, 0x29, 0xe2, 0xe4, 0xd1, 0x87, 0x15, 0xd8, 0x48, 0x6a, 0xc0, 0xed };

/* Global variable definitions */

const XERdescriptor_t       AuthVector_rand_xer_ = { {"rand>\n", "rand>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_rand_oer_ext_arr_[0] = {};
const int AuthVector_rand_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_rand_oer_ = { -1, TRUE, 16, FALSE, 0, 0, AuthVector_rand_oer_ext_arr_, 0, AuthVector_rand_oer_p_};
const TTCN_Typedescriptor_t AuthVector_rand_descr_ = { "@L3_Common.AuthVector.rand", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &AuthVector_rand_xer_, &OCTETSTRING_json_, &AuthVector_rand_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_rand_default_coding("RAW");
const XERdescriptor_t       AuthVector_sres_xer_ = { {"sres>\n", "sres>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_sres_oer_ext_arr_[0] = {};
const int AuthVector_sres_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_sres_oer_ = { -1, TRUE, 4, FALSE, 0, 0, AuthVector_sres_oer_ext_arr_, 0, AuthVector_sres_oer_p_};
const TTCN_Typedescriptor_t AuthVector_sres_descr_ = { "@L3_Common.AuthVector.sres", &OCTETSTRING_ber_, &General__Types::OCT4_raw_, &OCTETSTRING_text_, &AuthVector_sres_xer_, &OCTETSTRING_json_, &AuthVector_sres_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_sres_default_coding("RAW");
const XERdescriptor_t       AuthVector_kc_xer_ = { {"kc>\n", "kc>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_kc_oer_ext_arr_[0] = {};
const int AuthVector_kc_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_kc_oer_ = { -1, TRUE, 8, FALSE, 0, 0, AuthVector_kc_oer_ext_arr_, 0, AuthVector_kc_oer_p_};
const TTCN_Typedescriptor_t AuthVector_kc_descr_ = { "@L3_Common.AuthVector.kc", &OCTETSTRING_ber_, &General__Types::OCT8_raw_, &OCTETSTRING_text_, &AuthVector_kc_xer_, &OCTETSTRING_json_, &AuthVector_kc_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_kc_default_coding("RAW");
const XERdescriptor_t       AuthVector_ik_xer_ = { {"ik>\n", "ik>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_ik_oer_ext_arr_[0] = {};
const int AuthVector_ik_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_ik_oer_ = { -1, TRUE, 16, FALSE, 0, 0, AuthVector_ik_oer_ext_arr_, 0, AuthVector_ik_oer_p_};
const TTCN_Typedescriptor_t AuthVector_ik_descr_ = { "@L3_Common.AuthVector.ik", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &AuthVector_ik_xer_, &OCTETSTRING_json_, &AuthVector_ik_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_ik_default_coding("RAW");
const XERdescriptor_t       AuthVector_ck_xer_ = { {"ck>\n", "ck>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_ck_oer_ext_arr_[0] = {};
const int AuthVector_ck_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_ck_oer_ = { -1, TRUE, 16, FALSE, 0, 0, AuthVector_ck_oer_ext_arr_, 0, AuthVector_ck_oer_p_};
const TTCN_Typedescriptor_t AuthVector_ck_descr_ = { "@L3_Common.AuthVector.ck", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &AuthVector_ck_xer_, &OCTETSTRING_json_, &AuthVector_ck_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_ck_default_coding("RAW");
const XERdescriptor_t       AuthVector_autn_xer_ = { {"autn>\n", "autn>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_autn_oer_ext_arr_[0] = {};
const int AuthVector_autn_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_autn_oer_ = { -1, TRUE, 16, FALSE, 0, 0, AuthVector_autn_oer_ext_arr_, 0, AuthVector_autn_oer_p_};
const TTCN_Typedescriptor_t AuthVector_autn_descr_ = { "@L3_Common.AuthVector.autn", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &AuthVector_autn_xer_, &OCTETSTRING_json_, &AuthVector_autn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_autn_default_coding("RAW");
const XERdescriptor_t       AuthVector_res_xer_ = { {"res>\n", "res>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_res_oer_ext_arr_[0] = {};
const int AuthVector_res_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_res_oer_ = { -1, TRUE, 8, FALSE, 0, 0, AuthVector_res_oer_ext_arr_, 0, AuthVector_res_oer_p_};
const TTCN_Typedescriptor_t AuthVector_res_descr_ = { "@L3_Common.AuthVector.res", &OCTETSTRING_ber_, &General__Types::OCT8_raw_, &OCTETSTRING_text_, &AuthVector_res_xer_, &OCTETSTRING_json_, &AuthVector_res_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_res_default_coding("RAW");
const XERdescriptor_t       AuthVector_auts_xer_ = { {"auts>\n", "auts>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int AuthVector_auts_oer_ext_arr_[0] = {};
const int AuthVector_auts_oer_p_[0] = {};
const TTCN_OERdescriptor_t AuthVector_auts_oer_ = { -1, TRUE, 14, FALSE, 0, 0, AuthVector_auts_oer_ext_arr_, 0, AuthVector_auts_oer_p_};
const TTCN_Typedescriptor_t AuthVector_auts_descr_ = { "@L3_Common.AuthVector.auts", &OCTETSTRING_ber_, &General__Types::OCT14_raw_, &OCTETSTRING_text_, &AuthVector_auts_xer_, &OCTETSTRING_json_, &AuthVector_auts_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING AuthVector_auts_default_coding("RAW");
// No XER for AuthVector
const TTCN_Typedescriptor_t AuthVector_descr_ = { "@L3_Common.AuthVector", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
TTCN_Module module_object("L3_Common", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

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

/* Member functions of C++ classes */

AuthVector::AuthVector()
{
}

AuthVector::AuthVector(const OCTETSTRING& par_rand,
    const OCTETSTRING& par_sres,
    const OCTETSTRING& par_kc,
    const OCTETSTRING& par_ik,
    const OCTETSTRING& par_ck,
    const OCTETSTRING& par_autn,
    const OCTETSTRING& par_res,
    const OCTETSTRING& par_auts)
  :   field_rand(par_rand),
  field_sres(par_sres),
  field_kc(par_kc),
  field_ik(par_ik),
  field_ck(par_ck),
  field_autn(par_autn),
  field_res(par_res),
  field_auts(par_auts)
{
}

AuthVector::AuthVector(const AuthVector& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L3_Common.AuthVector.");
if (other_value.rand().is_bound()) field_rand = other_value.rand();
else field_rand.clean_up();
if (other_value.sres().is_bound()) field_sres = other_value.sres();
else field_sres.clean_up();
if (other_value.kc().is_bound()) field_kc = other_value.kc();
else field_kc.clean_up();
if (other_value.ik().is_bound()) field_ik = other_value.ik();
else field_ik.clean_up();
if (other_value.ck().is_bound()) field_ck = other_value.ck();
else field_ck.clean_up();
if (other_value.autn().is_bound()) field_autn = other_value.autn();
else field_autn.clean_up();
if (other_value.res().is_bound()) field_res = other_value.res();
else field_res.clean_up();
if (other_value.auts().is_bound()) field_auts = other_value.auts();
else field_auts.clean_up();
}

void AuthVector::clean_up()
{
field_rand.clean_up();
field_sres.clean_up();
field_kc.clean_up();
field_ik.clean_up();
field_ck.clean_up();
field_autn.clean_up();
field_res.clean_up();
field_auts.clean_up();
}

const TTCN_Typedescriptor_t* AuthVector::get_descriptor() const { return &AuthVector_descr_; }
AuthVector& AuthVector::operator=(const AuthVector& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L3_Common.AuthVector.");
  if (other_value.rand().is_bound()) field_rand = other_value.rand();
  else field_rand.clean_up();
  if (other_value.sres().is_bound()) field_sres = other_value.sres();
  else field_sres.clean_up();
  if (other_value.kc().is_bound()) field_kc = other_value.kc();
  else field_kc.clean_up();
  if (other_value.ik().is_bound()) field_ik = other_value.ik();
  else field_ik.clean_up();
  if (other_value.ck().is_bound()) field_ck = other_value.ck();
  else field_ck.clean_up();
  if (other_value.autn().is_bound()) field_autn = other_value.autn();
  else field_autn.clean_up();
  if (other_value.res().is_bound()) field_res = other_value.res();
  else field_res.clean_up();
  if (other_value.auts().is_bound()) field_auts = other_value.auts();
  else field_auts.clean_up();
}
return *this;
}

boolean AuthVector::operator==(const AuthVector& other_value) const
{
return field_rand==other_value.field_rand
  && field_sres==other_value.field_sres
  && field_kc==other_value.field_kc
  && field_ik==other_value.field_ik
  && field_ck==other_value.field_ck
  && field_autn==other_value.field_autn
  && field_res==other_value.field_res
  && field_auts==other_value.field_auts;
}

boolean AuthVector::is_bound() const
{
return (field_rand.is_bound())
  || (field_sres.is_bound())
  || (field_kc.is_bound())
  || (field_ik.is_bound())
  || (field_ck.is_bound())
  || (field_autn.is_bound())
  || (field_res.is_bound())
  || (field_auts.is_bound());
}
boolean AuthVector::is_value() const
{
return field_rand.is_value()
  && field_sres.is_value()
  && field_kc.is_value()
  && field_ik.is_value()
  && field_ck.is_value()
  && field_autn.is_value()
  && field_res.is_value()
  && field_auts.is_value();
}
void AuthVector::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ rand := ");
field_rand.log();
TTCN_Logger::log_event_str(", sres := ");
field_sres.log();
TTCN_Logger::log_event_str(", kc := ");
field_kc.log();
TTCN_Logger::log_event_str(", ik := ");
field_ik.log();
TTCN_Logger::log_event_str(", ck := ");
field_ck.log();
TTCN_Logger::log_event_str(", autn := ");
field_autn.log();
TTCN_Logger::log_event_str(", res := ");
field_res.log();
TTCN_Logger::log_event_str(", auts := ");
field_auts.log();
TTCN_Logger::log_event_str(" }");
}

void AuthVector::set_implicit_omit()
{
if (rand().is_bound()) rand().set_implicit_omit();
if (sres().is_bound()) sres().set_implicit_omit();
if (kc().is_bound()) kc().set_implicit_omit();
if (ik().is_bound()) ik().set_implicit_omit();
if (ck().is_bound()) ck().set_implicit_omit();
if (autn().is_bound()) autn().set_implicit_omit();
if (res().is_bound()) res().set_implicit_omit();
if (auts().is_bound()) auts().set_implicit_omit();
}

void AuthVector::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 (8<param.get_size()) {
      param.error("record value of type @L3_Common.AuthVector has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rand().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sres().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) kc().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ik().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ck().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) autn().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) res().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) auts().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rand")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rand().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sres")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sres().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "kc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          kc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ik")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ik().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ck")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ck().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "autn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          autn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "res")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          res().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "auts")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          auts().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L3_Common.AuthVector: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L3_Common.AuthVector");
  }
}

void AuthVector::encode_text(Text_Buf& text_buf) const
{
field_rand.encode_text(text_buf);
field_sres.encode_text(text_buf);
field_kc.encode_text(text_buf);
field_ik.encode_text(text_buf);
field_ck.encode_text(text_buf);
field_autn.encode_text(text_buf);
field_res.encode_text(text_buf);
field_auts.encode_text(text_buf);
}

void AuthVector::decode_text(Text_Buf& text_buf)
{
field_rand.decode_text(text_buf);
field_sres.decode_text(text_buf);
field_kc.decode_text(text_buf);
field_ik.decode_text(text_buf);
field_ck.decode_text(text_buf);
field_autn.decode_text(text_buf);
field_res.decode_text(text_buf);
field_auts.decode_text(text_buf);
}

struct AuthVector_template::single_value_struct {
OCTETSTRING_template field_rand;
OCTETSTRING_template field_sres;
OCTETSTRING_template field_kc;
OCTETSTRING_template field_ik;
OCTETSTRING_template field_ck;
OCTETSTRING_template field_autn;
OCTETSTRING_template field_res;
OCTETSTRING_template field_auts;
};

void AuthVector_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_rand = ANY_VALUE;
single_value->field_sres = ANY_VALUE;
single_value->field_kc = ANY_VALUE;
single_value->field_ik = ANY_VALUE;
single_value->field_ck = ANY_VALUE;
single_value->field_autn = ANY_VALUE;
single_value->field_res = ANY_VALUE;
single_value->field_auts = ANY_VALUE;
}
}
}

void AuthVector_template::copy_value(const AuthVector& other_value)
{
single_value = new single_value_struct;
if (other_value.rand().is_bound()) {
  single_value->field_rand = other_value.rand();
} else {
  single_value->field_rand.clean_up();
}
if (other_value.sres().is_bound()) {
  single_value->field_sres = other_value.sres();
} else {
  single_value->field_sres.clean_up();
}
if (other_value.kc().is_bound()) {
  single_value->field_kc = other_value.kc();
} else {
  single_value->field_kc.clean_up();
}
if (other_value.ik().is_bound()) {
  single_value->field_ik = other_value.ik();
} else {
  single_value->field_ik.clean_up();
}
if (other_value.ck().is_bound()) {
  single_value->field_ck = other_value.ck();
} else {
  single_value->field_ck.clean_up();
}
if (other_value.autn().is_bound()) {
  single_value->field_autn = other_value.autn();
} else {
  single_value->field_autn.clean_up();
}
if (other_value.res().is_bound()) {
  single_value->field_res = other_value.res();
} else {
  single_value->field_res.clean_up();
}
if (other_value.auts().is_bound()) {
  single_value->field_auts = other_value.auts();
} else {
  single_value->field_auts.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void AuthVector_template::copy_template(const AuthVector_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.rand().get_selection()) {
single_value->field_rand = other_value.rand();
} else {
single_value->field_rand.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sres().get_selection()) {
single_value->field_sres = other_value.sres();
} else {
single_value->field_sres.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.kc().get_selection()) {
single_value->field_kc = other_value.kc();
} else {
single_value->field_kc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ik().get_selection()) {
single_value->field_ik = other_value.ik();
} else {
single_value->field_ik.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ck().get_selection()) {
single_value->field_ck = other_value.ck();
} else {
single_value->field_ck.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.autn().get_selection()) {
single_value->field_autn = other_value.autn();
} else {
single_value->field_autn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.res().get_selection()) {
single_value->field_res = other_value.res();
} else {
single_value->field_res.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.auts().get_selection()) {
single_value->field_auts = other_value.auts();
} else {
single_value->field_auts.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 AuthVector_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 AuthVector_template(*other_value.implication_.precondition);
implication_.implied_template = new AuthVector_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 @L3_Common.AuthVector.");
break;
}
set_selection(other_value);
}

AuthVector_template::AuthVector_template()
{
}

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

AuthVector_template::AuthVector_template(const AuthVector& other_value)
{
copy_value(other_value);
}

AuthVector_template::AuthVector_template(const OPTIONAL<AuthVector>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const AuthVector&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @L3_Common.AuthVector from an unbound optional field.");
}
}

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

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

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

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

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

AuthVector_template& AuthVector_template::operator=(const AuthVector& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

AuthVector_template& AuthVector_template::operator=(const OPTIONAL<AuthVector>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const AuthVector&)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 @L3_Common.AuthVector.");
}
return *this;
}

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

boolean AuthVector_template::match(const AuthVector& 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.rand().is_bound()) return FALSE;
if(!single_value->field_rand.match(other_value.rand(), legacy))return FALSE;
if(!other_value.sres().is_bound()) return FALSE;
if(!single_value->field_sres.match(other_value.sres(), legacy))return FALSE;
if(!other_value.kc().is_bound()) return FALSE;
if(!single_value->field_kc.match(other_value.kc(), legacy))return FALSE;
if(!other_value.ik().is_bound()) return FALSE;
if(!single_value->field_ik.match(other_value.ik(), legacy))return FALSE;
if(!other_value.ck().is_bound()) return FALSE;
if(!single_value->field_ck.match(other_value.ck(), legacy))return FALSE;
if(!other_value.autn().is_bound()) return FALSE;
if(!single_value->field_autn.match(other_value.autn(), legacy))return FALSE;
if(!other_value.res().is_bound()) return FALSE;
if(!single_value->field_res.match(other_value.res(), legacy))return FALSE;
if(!other_value.auts().is_bound()) return FALSE;
if(!single_value->field_auts.match(other_value.auts(), 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 @L3_Common.AuthVector.");
}
return FALSE;
}

boolean AuthVector_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_rand.is_bound()
 || single_value->field_sres.is_bound()
 || single_value->field_kc.is_bound()
 || single_value->field_ik.is_bound()
 || single_value->field_ck.is_bound()
 || single_value->field_autn.is_bound()
 || single_value->field_res.is_bound()
 || single_value->field_auts.is_bound();
}

boolean AuthVector_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_rand.is_value()
 && single_value->field_sres.is_value()
 && single_value->field_kc.is_value()
 && single_value->field_ik.is_value()
 && single_value->field_ck.is_value()
 && single_value->field_autn.is_value()
 && single_value->field_res.is_value()
 && single_value->field_auts.is_value();
}

void AuthVector_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;
}

AuthVector AuthVector_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 @L3_Common.AuthVector.");
AuthVector ret_val;
if (single_value->field_rand.is_bound()) {
ret_val.rand() = single_value->field_rand.valueof();
}
if (single_value->field_sres.is_bound()) {
ret_val.sres() = single_value->field_sres.valueof();
}
if (single_value->field_kc.is_bound()) {
ret_val.kc() = single_value->field_kc.valueof();
}
if (single_value->field_ik.is_bound()) {
ret_val.ik() = single_value->field_ik.valueof();
}
if (single_value->field_ck.is_bound()) {
ret_val.ck() = single_value->field_ck.valueof();
}
if (single_value->field_autn.is_bound()) {
ret_val.autn() = single_value->field_autn.valueof();
}
if (single_value->field_res.is_bound()) {
ret_val.res() = single_value->field_res.valueof();
}
if (single_value->field_auts.is_bound()) {
ret_val.auts() = single_value->field_auts.valueof();
}
return ret_val;
}

void AuthVector_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 @L3_Common.AuthVector.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new AuthVector_template[list_length];
}

AuthVector_template& AuthVector_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 @L3_Common.AuthVector.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @L3_Common.AuthVector.");
return value_list.list_value[list_index];
}

OCTETSTRING_template& AuthVector_template::rand()
{
set_specific();
return single_value->field_rand;
}

const OCTETSTRING_template& AuthVector_template::rand() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rand of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_rand;
}

OCTETSTRING_template& AuthVector_template::sres()
{
set_specific();
return single_value->field_sres;
}

const OCTETSTRING_template& AuthVector_template::sres() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sres of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_sres;
}

OCTETSTRING_template& AuthVector_template::kc()
{
set_specific();
return single_value->field_kc;
}

const OCTETSTRING_template& AuthVector_template::kc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field kc of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_kc;
}

OCTETSTRING_template& AuthVector_template::ik()
{
set_specific();
return single_value->field_ik;
}

const OCTETSTRING_template& AuthVector_template::ik() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ik of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_ik;
}

OCTETSTRING_template& AuthVector_template::ck()
{
set_specific();
return single_value->field_ck;
}

const OCTETSTRING_template& AuthVector_template::ck() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ck of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_ck;
}

OCTETSTRING_template& AuthVector_template::autn()
{
set_specific();
return single_value->field_autn;
}

const OCTETSTRING_template& AuthVector_template::autn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field autn of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_autn;
}

OCTETSTRING_template& AuthVector_template::res()
{
set_specific();
return single_value->field_res;
}

const OCTETSTRING_template& AuthVector_template::res() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field res of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_res;
}

OCTETSTRING_template& AuthVector_template::auts()
{
set_specific();
return single_value->field_auts;
}

const OCTETSTRING_template& AuthVector_template::auts() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field auts of a non-specific template of type @L3_Common.AuthVector.");
return single_value->field_auts;
}

int AuthVector_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 8;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @L3_Common.AuthVector 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 @L3_Common.AuthVector containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @L3_Common.AuthVector containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @L3_Common.AuthVector.");
  }
  return 0;
}

void AuthVector_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ rand := ");
single_value->field_rand.log();
TTCN_Logger::log_event_str(", sres := ");
single_value->field_sres.log();
TTCN_Logger::log_event_str(", kc := ");
single_value->field_kc.log();
TTCN_Logger::log_event_str(", ik := ");
single_value->field_ik.log();
TTCN_Logger::log_event_str(", ck := ");
single_value->field_ck.log();
TTCN_Logger::log_event_str(", autn := ");
single_value->field_autn.log();
TTCN_Logger::log_event_str(", res := ");
single_value->field_res.log();
TTCN_Logger::log_event_str(", auts := ");
single_value->field_auts.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 AuthVector_template::log_match(const AuthVector& 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_rand.match(match_value.rand(), legacy)){
TTCN_Logger::log_logmatch_info(".rand");
single_value->field_rand.log_match(match_value.rand(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_sres.match(match_value.sres(), legacy)){
TTCN_Logger::log_logmatch_info(".sres");
single_value->field_sres.log_match(match_value.sres(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_kc.match(match_value.kc(), legacy)){
TTCN_Logger::log_logmatch_info(".kc");
single_value->field_kc.log_match(match_value.kc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ik.match(match_value.ik(), legacy)){
TTCN_Logger::log_logmatch_info(".ik");
single_value->field_ik.log_match(match_value.ik(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ck.match(match_value.ck(), legacy)){
TTCN_Logger::log_logmatch_info(".ck");
single_value->field_ck.log_match(match_value.ck(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_autn.match(match_value.autn(), legacy)){
TTCN_Logger::log_logmatch_info(".autn");
single_value->field_autn.log_match(match_value.autn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_res.match(match_value.res(), legacy)){
TTCN_Logger::log_logmatch_info(".res");
single_value->field_res.log_match(match_value.res(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_auts.match(match_value.auts(), legacy)){
TTCN_Logger::log_logmatch_info(".auts");
single_value->field_auts.log_match(match_value.auts(), 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("{ rand := ");
single_value->field_rand.log_match(match_value.rand(), legacy);
TTCN_Logger::log_event_str(", sres := ");
single_value->field_sres.log_match(match_value.sres(), legacy);
TTCN_Logger::log_event_str(", kc := ");
single_value->field_kc.log_match(match_value.kc(), legacy);
TTCN_Logger::log_event_str(", ik := ");
single_value->field_ik.log_match(match_value.ik(), legacy);
TTCN_Logger::log_event_str(", ck := ");
single_value->field_ck.log_match(match_value.ck(), legacy);
TTCN_Logger::log_event_str(", autn := ");
single_value->field_autn.log_match(match_value.autn(), legacy);
TTCN_Logger::log_event_str(", res := ");
single_value->field_res.log_match(match_value.res(), legacy);
TTCN_Logger::log_event_str(", auts := ");
single_value->field_auts.log_match(match_value.auts(), 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 AuthVector_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (rand().is_bound()) rand().set_implicit_omit();
if (sres().is_bound()) sres().set_implicit_omit();
if (kc().is_bound()) kc().set_implicit_omit();
if (ik().is_bound()) ik().set_implicit_omit();
if (ck().is_bound()) ck().set_implicit_omit();
if (autn().is_bound()) autn().set_implicit_omit();
if (res().is_bound()) res().set_implicit_omit();
if (auts().is_bound()) auts().set_implicit_omit();
}

void AuthVector_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_rand.encode_text(text_buf);
single_value->field_sres.encode_text(text_buf);
single_value->field_kc.encode_text(text_buf);
single_value->field_ik.encode_text(text_buf);
single_value->field_ck.encode_text(text_buf);
single_value->field_autn.encode_text(text_buf);
single_value->field_res.encode_text(text_buf);
single_value->field_auts.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 @L3_Common.AuthVector.");
}
}

void AuthVector_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_rand.decode_text(text_buf);
single_value->field_sres.decode_text(text_buf);
single_value->field_kc.decode_text(text_buf);
single_value->field_ik.decode_text(text_buf);
single_value->field_ck.decode_text(text_buf);
single_value->field_autn.decode_text(text_buf);
single_value->field_res.decode_text(text_buf);
single_value->field_auts.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 AuthVector_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 @L3_Common.AuthVector.");
}
}

void AuthVector_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: {
    AuthVector_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_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (8<param.get_size()) {
      param.error("record template of type @L3_Common.AuthVector has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rand().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sres().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) kc().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ik().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ck().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) autn().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) res().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) auts().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rand")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rand().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sres")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sres().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "kc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          kc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ik")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ik().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ck")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ck().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "autn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          autn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "res")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          res().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "auts")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          auts().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L3_Common.AuthVector: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    AuthVector_template* precondition = new AuthVector_template;
    precondition->set_param(*param.get_elem(0));
    AuthVector_template* implied_template = new AuthVector_template;
    implied_template->set_param(*param.get_elem(1));
    *this = AuthVector_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L3_Common.AuthVector");
  }
  is_ifpresent = param.get_ifpresent();
}

void AuthVector_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_rand.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_sres.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_kc.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_ik.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_ck.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_autn.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_res.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
single_value->field_auts.check_restriction(t_res, t_name ? t_name : "@L3_Common.AuthVector");
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 : "@L3_Common.AuthVector");
}

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

boolean AuthVector_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_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}


/* Bodies of functions, altsteps and testcases */

AuthVector f__gen__auth__vec__2g()
{
TTCN_Location current_location("L3_Common.ttcn", 32, TTCN_Location::LOCATION_FUNCTION, "f_gen_auth_vec_2g");
current_location.update_lineno(33);
/* L3_Common.ttcn, line 33 */
AuthVector vec;
current_location.update_lineno(34);
/* L3_Common.ttcn, line 34 */
vec.rand() = Osmocom__Types::f__rnd__octstring(16);
current_location.update_lineno(35);
/* L3_Common.ttcn, line 35 */
vec.sres() = Osmocom__Types::f__rnd__octstring(4);
current_location.update_lineno(36);
/* L3_Common.ttcn, line 36 */
vec.kc() = Osmocom__Types::f__rnd__octstring(8);
current_location.update_lineno(37);
/* L3_Common.ttcn, line 37 */
return vec;
}

AuthVector f__gen__auth__vec__3g()
{
TTCN_Location current_location("L3_Common.ttcn", 40, TTCN_Location::LOCATION_FUNCTION, "f_gen_auth_vec_3g");
current_location.update_lineno(41);
/* L3_Common.ttcn, line 41 */
AuthVector vec(f__gen__auth__vec__2g());
current_location.update_lineno(42);
/* L3_Common.ttcn, line 42 */
vec.ik() = Osmocom__Types::f__rnd__octstring(16);
current_location.update_lineno(43);
/* L3_Common.ttcn, line 43 */
vec.ck() = Osmocom__Types::f__rnd__octstring(16);
current_location.update_lineno(44);
/* L3_Common.ttcn, line 44 */
vec.autn() = Osmocom__Types::f__rnd__octstring(16);
current_location.update_lineno(45);
/* L3_Common.ttcn, line 45 */
vec.res() = Osmocom__Types::f__rnd__octstring(8);
current_location.update_lineno(46);
/* L3_Common.ttcn, line 46 */
vec.auts() = Osmocom__Types::f__rnd__octstring(14);
current_location.update_lineno(47);
/* L3_Common.ttcn, line 47 */
return vec;
}

MobileL3__GMM__SM__Types::RoutingAreaIdentificationV f__RAI(const HEXSTRING& mcc, const HEXSTRING& mnc, const OCTETSTRING& lac, const OCTETSTRING& rac)
{
HEXSTRING mnc_shadow(mnc);
TTCN_Location current_location("L3_Common.ttcn", 50, TTCN_Location::LOCATION_FUNCTION, "f_RAI");
current_location.update_lineno(51);
/* L3_Common.ttcn, line 51 */
if ((mnc_shadow.lengthof() == 2)) {
current_location.update_lineno(52);
/* L3_Common.ttcn, line 52 */
{
HEXSTRING tmp_8;
tmp_8 = (mnc_shadow + hs_0);
mnc_shadow = tmp_8;
}
}
current_location.update_lineno(54);
/* L3_Common.ttcn, line 54 */
MobileL3__GMM__SM__Types::RoutingAreaIdentificationV ret;
ret.mccDigit1() = const_cast< const HEXSTRING&>(mcc)[0];
ret.mccDigit2() = const_cast< const HEXSTRING&>(mcc)[1];
ret.mccDigit3() = const_cast< const HEXSTRING&>(mcc)[2];
ret.mncDigit3() = const_cast< const HEXSTRING&>(mnc_shadow)[2];
ret.mncDigit1() = const_cast< const HEXSTRING&>(mnc_shadow)[0];
ret.mncDigit2() = const_cast< const HEXSTRING&>(mnc_shadow)[1];
ret.lac() = lac;
ret.rac() = rac;
current_location.update_lineno(64);
/* L3_Common.ttcn, line 64 */
return ret;
}

HEXSTRING f__RAI__to__plmn__hexstr(const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV& rai)
{
TTCN_Location current_location("L3_Common.ttcn", 67, TTCN_Location::LOCATION_FUNCTION, "f_RAI_to_plmn_hexstr");
current_location.update_lineno(68);
/* L3_Common.ttcn, line 68 */
HEXSTRING plmn((((((const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mccDigit1() + const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mccDigit2()) + const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mccDigit3()) + const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mncDigit3()) + const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mncDigit1()) + const_cast< const MobileL3__GMM__SM__Types::RoutingAreaIdentificationV&>(rai).mncDigit2()));
current_location.update_lineno(75);
/* L3_Common.ttcn, line 75 */
return plmn;
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("L3_Common.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "L3_Common");
Osmocom__Types::module_object.pre_init_module();
MobileL3__GMM__SM__Types::module_object.pre_init_module();
module_object.add_function("f_gen_auth_vec_2g", (genericfunc_t)&f__gen__auth__vec__2g, NULL);
module_object.add_function("f_gen_auth_vec_3g", (genericfunc_t)&f__gen__auth__vec__3g, NULL);
module_object.add_function("f_RAI", (genericfunc_t)&f__RAI, NULL);
module_object.add_function("f_RAI_to_plmn_hexstr", (genericfunc_t)&f__RAI__to__plmn__hexstr, NULL);
}

void post_init_module()
{
TTCN_Location current_location("L3_Common.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "L3_Common");
Osmocom__Types::module_object.post_init_module();
MobileL3__GMM__SM__Types::module_object.post_init_module();
}


} /* end of namespace */
