// 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 "ICMPv6_Templates.hh" namespace ICMPv6__Templates { /* Literal string constants */ const unsigned char bs_1_bits[] = { 0 }, bs_0_bits[] = { 0 }; extern const BITSTRING bs_1(1, bs_1_bits), bs_0(6, bs_0_bits); const unsigned char os_1_octets[] = { 0, 0 }, os_0_octets[] = { 0, 0, 0, 0 }, os_5_octets[] = { 17 }, os_4_octets[] = { 18, 52, 18, 52, 18, 52, 18, 52 }, os_3_octets[] = { 254, 128, 0, 0, 0, 0, 0, 0 }, os_7_octets[] = { 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 }, os_6_octets[] = { 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 255 }; extern const OCTETSTRING os_2(0, NULL), os_1(2, os_1_octets), os_0(4, os_0_octets), os_5(1, os_5_octets), os_4(8, os_4_octets), os_3(8, os_3_octets), os_7(16, os_7_octets), os_6(13, os_6_octets); const unsigned char module_checksum[] = { 0xbe, 0x4c, 0xb6, 0xce, 0xd0, 0x11, 0x76, 0x5d, 0xac, 0x51, 0x18, 0x4e, 0x0f, 0x94, 0x94, 0x1d }; /* Global variable definitions */ ICMPv6__Types::PDU__ICMPv6_template template_ts__ICMPv6__ERQ; const ICMPv6__Types::PDU__ICMPv6_template& ts__ICMPv6__ERQ = template_ts__ICMPv6__ERQ; ICMPv6__Types::PDU__ICMPv6_template template_ts__ICMPv6__RS; const ICMPv6__Types::PDU__ICMPv6_template& ts__ICMPv6__RS = template_ts__ICMPv6__RS; INTEGER_template template_tr__ICMP6__OptMTU_mtu_defval; const INTEGER_template& tr__ICMP6__OptMTU_mtu_defval = template_tr__ICMP6__OptMTU_mtu_defval; ICMPv6__Types::PDU__ICMPv6_template template_tr__ICMPv6__DU; const ICMPv6__Types::PDU__ICMPv6_template& tr__ICMPv6__DU = template_tr__ICMPv6__DU; ICMPv6__Types::PDU__ICMPv6_template template_tr__ICMPv6__ERQ; const ICMPv6__Types::PDU__ICMPv6_template& tr__ICMPv6__ERQ = template_tr__ICMPv6__ERQ; OCTETSTRING_template template_tr__ICMPv6__ERP_data_defval; const OCTETSTRING_template& tr__ICMPv6__ERP_data_defval = template_tr__ICMPv6__ERP_data_defval; INTEGER const_ts__IP6_hlim_defval; const INTEGER& ts__IP6_hlim_defval = const_ts__IP6_hlim_defval; INTEGER const_f__ipv6__mangle_prefix_defval; const INTEGER& f__ipv6__mangle_prefix_defval = const_f__ipv6__mangle_prefix_defval; TTCN_Module module_object("ICMPv6_Templates", __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_9, current_runtime_version.requires_minor_version_0, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Bodies of functions, altsteps and testcases */ ICMPv6__Types::OptionField_template ts__ICMP6__OptPrefix(const OCTETSTRING& prefix, const INTEGER& prefix__len) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 18, TTCN_Location::LOCATION_TEMPLATE, "ts_ICMP6_OptPrefix"); ICMPv6__Types::OptionField_template ret_val; { ICMPv6__Types::PrefixInformation_template& tmp_0 = ret_val.prefixInformation(); tmp_0.typeField() = 3; tmp_0.lengthIndicator() = 8; tmp_0.prefixLength() = prefix__len; tmp_0.reserved1() = bs_0; tmp_0.a__Bit() = bs_1; tmp_0.l__Bit() = bs_1; { INTEGER INTEGER_tmp("4294967295"); tmp_0.validLifetime() = INTEGER_tmp; } { INTEGER INTEGER_tmp("4294967295"); tmp_0.preferredLifetime() = INTEGER_tmp; } tmp_0.reserved2() = os_0; tmp_0.prefix() = prefix; } return ret_val; } ICMPv6__Types::PDU__ICMPv6_template ts__ICMPv6__RA(const OCTETSTRING& prefix, const INTEGER& prefix__len) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 58, TTCN_Location::LOCATION_TEMPLATE, "ts_ICMPv6_RA"); ICMPv6__Types::PDU__ICMPv6_template ret_val; { ICMPv6__Types::ICMPv6__RouterAdvertisement_template& tmp_3 = ret_val.routerAdvertisement(); tmp_3.typeField() = 134; tmp_3.code() = 0; tmp_3.checksum() = os_1; tmp_3.curHopLimit() = 0; tmp_3.reserved() = bs_0; tmp_3.o__Bit() = bs_1; tmp_3.m__Bit() = bs_1; tmp_3.routerLifetime() = 65535; { INTEGER INTEGER_tmp("4294967295"); tmp_3.reachableTime() = INTEGER_tmp; } { INTEGER INTEGER_tmp("4294967295"); tmp_3.retransTimer() = INTEGER_tmp; } { ICMPv6__Types::Options_template& tmp_4 = tmp_3.options(); tmp_4.set_size(1); tmp_4[0] = ts__ICMP6__OptPrefix(prefix, prefix__len); } } return ret_val; } ICMPv6__Types::PDU__ICMPv6_template ts__ICMPv6__NS(const OCTETSTRING& target__addr) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 77, TTCN_Location::LOCATION_TEMPLATE, "ts_ICMPv6_NS"); ICMPv6__Types::PDU__ICMPv6_template ret_val; { ICMPv6__Types::ICMPv6__NeighborSolicitation_template& tmp_5 = ret_val.neighborSolicitation(); tmp_5.typeField() = 135; tmp_5.code() = 0; tmp_5.checksum() = os_1; tmp_5.reserved() = os_0; tmp_5.targetAddress() = target__addr; tmp_5.options() = OMIT_VALUE; } return ret_val; } ICMPv6__Types::OptionField_template tr__ICMP6__OptPrefix(const OCTETSTRING_template& prefix, const INTEGER_template& prefix__len) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 91, TTCN_Location::LOCATION_TEMPLATE, "tr_ICMP6_OptPrefix"); ICMPv6__Types::OptionField_template ret_val; { ICMPv6__Types::PrefixInformation_template& tmp_6 = ret_val.prefixInformation(); tmp_6.typeField() = 3; tmp_6.lengthIndicator() = 4; tmp_6.prefixLength() = prefix__len; tmp_6.reserved1() = ANY_VALUE; tmp_6.a__Bit() = ANY_VALUE; tmp_6.l__Bit() = ANY_VALUE; tmp_6.validLifetime() = ANY_VALUE; tmp_6.preferredLifetime() = ANY_VALUE; tmp_6.reserved2() = ANY_VALUE; tmp_6.prefix() = prefix; } return ret_val; } ICMPv6__Types::OptionField_template tr__ICMP6__OptMTU(const INTEGER_template& mtu) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 107, TTCN_Location::LOCATION_TEMPLATE, "tr_ICMP6_OptMTU"); ICMPv6__Types::OptionField_template ret_val; { ICMPv6__Types::MTU_template& tmp_7 = ret_val.mTU(); tmp_7.typeField() = 5; tmp_7.lengthIndicator() = 1; tmp_7.reserved() = ANY_VALUE; tmp_7.mTU__Value() = mtu; } return ret_val; } ICMPv6__Types::PDU__ICMPv6_template tr__ICMPv6__RA(const OCTETSTRING_template& prefix, const INTEGER_template& prefix__len) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 117, TTCN_Location::LOCATION_TEMPLATE, "tr_ICMPv6_RA"); ICMPv6__Types::PDU__ICMPv6_template ret_val; { ICMPv6__Types::ICMPv6__RouterAdvertisement_template& tmp_8 = ret_val.routerAdvertisement(); tmp_8.typeField() = 134; tmp_8.code() = 0; tmp_8.checksum() = ANY_VALUE; tmp_8.curHopLimit() = ANY_VALUE; tmp_8.reserved() = ANY_VALUE; tmp_8.o__Bit() = bs_1; tmp_8.m__Bit() = bs_1; tmp_8.routerLifetime() = ANY_VALUE; tmp_8.reachableTime() = ANY_VALUE; tmp_8.retransTimer() = ANY_VALUE; { ICMPv6__Types::Options_template& tmp_9 = tmp_8.options(); tmp_9.set_type(VALUE_LIST, 2); { ICMPv6__Types::Options_template& tmp_10 = tmp_9.list_item(0); tmp_10.set_size(1); tmp_10[0] = tr__ICMP6__OptPrefix(prefix, prefix__len); } { ICMPv6__Types::Options_template& tmp_11 = tmp_9.list_item(1); tmp_11.set_size(2); tmp_11[0] = tr__ICMP6__OptPrefix(prefix, prefix__len); tmp_11[1] = tr__ICMP6__OptMTU(tr__ICMP6__OptMTU_mtu_defval); } } } return ret_val; } ICMPv6__Types::PDU__ICMPv6_template tr__ICMPv6__ERP(const OCTETSTRING_template& data) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 159, TTCN_Location::LOCATION_TEMPLATE, "tr_ICMPv6_ERP"); ICMPv6__Types::PDU__ICMPv6_template ret_val; { ICMPv6__Types::ICMPv6__EchoReply_template& tmp_14 = ret_val.echoReply(); tmp_14.typeField() = 129; tmp_14.code() = 0; tmp_14.checksum() = ANY_VALUE; tmp_14.identifier() = ANY_VALUE; tmp_14.sequenceNr() = ANY_VALUE; tmp_14.data() = data; } return ret_val; } IP__Types::IPv6__packet_template ts__IP6(const OCTETSTRING& srcaddr, const OCTETSTRING& dstaddr, const INTEGER& nexthead, const OCTETSTRING& payload, const INTEGER& hlim) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 171, TTCN_Location::LOCATION_TEMPLATE, "ts_IP6"); IP__Types::IPv6__packet_template ret_val; { IP__Types::IPv6__header_template& tmp_15 = ret_val.header(); tmp_15.ver() = 6; tmp_15.trclass() = 0; tmp_15.flabel() = 0; tmp_15.plen() = 0; tmp_15.nexthead() = nexthead; tmp_15.hlim() = hlim; tmp_15.srcaddr() = srcaddr; tmp_15.dstaddr() = dstaddr; } ret_val.ext__headers() = OMIT_VALUE; ret_val.payload() = payload; return ret_val; } OCTETSTRING f__ipv6__link__local(const OCTETSTRING& link__id) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 186, TTCN_Location::LOCATION_FUNCTION, "f_ipv6_link_local"); current_location.update_lineno(187); /* ICMPv6_Templates.ttcn, line 187 */ return (os_3 + substr(link__id, 8, 8)); } OCTETSTRING f__ipv6__global(const OCTETSTRING& link__id) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 190, TTCN_Location::LOCATION_FUNCTION, "f_ipv6_global"); current_location.update_lineno(191); /* ICMPv6_Templates.ttcn, line 191 */ return (substr(link__id, 0, 8) + os_4); } OCTETSTRING f__ipv6__mangle(const OCTETSTRING& addr, const INTEGER& prefix) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 195, TTCN_Location::LOCATION_FUNCTION, "f_ipv6_mangle"); current_location.update_lineno(196); /* ICMPv6_Templates.ttcn, line 196 */ INTEGER i; current_location.update_lineno(197); /* ICMPv6_Templates.ttcn, line 197 */ OCTETSTRING res(substr(addr, 0, prefix)); current_location.update_lineno(198); /* ICMPv6_Templates.ttcn, line 198 */ i = prefix; current_location.update_lineno(198); /* ICMPv6_Templates.ttcn, line 198 */ for ( ; ; ) { current_location.update_lineno(198); /* ICMPv6_Templates.ttcn, line 198 */ if (!(i < addr.lengthof())) break; current_location.update_lineno(199); /* ICMPv6_Templates.ttcn, line 199 */ OCTETSTRING a((const_cast< const OCTETSTRING&>(addr)[i] ^ os_5)); current_location.update_lineno(200); /* ICMPv6_Templates.ttcn, line 200 */ { OCTETSTRING tmp_17; tmp_17 = (res + a); res = tmp_17; } current_location.update_lineno(198); /* ICMPv6_Templates.ttcn, line 198 */ { INTEGER tmp_18; ++i; } } current_location.update_lineno(202); /* ICMPv6_Templates.ttcn, line 202 */ return res; } OCTETSTRING f__gen__icmpv6__echo(const OCTETSTRING& saddr, const OCTETSTRING& daddr) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 206, TTCN_Location::LOCATION_FUNCTION, "f_gen_icmpv6_echo"); current_location.update_lineno(207); /* ICMPv6_Templates.ttcn, line 207 */ OCTETSTRING tmp(ICMPv6__Types::f__enc__PDU__ICMPv6(ts__ICMPv6__ERQ.valueof(), saddr, daddr)); current_location.update_lineno(208); /* ICMPv6_Templates.ttcn, line 208 */ IP__Types::IPv6__packet ip6(ts__IP6(saddr, daddr, 58, tmp, ts__IP6_hlim_defval).valueof()); current_location.update_lineno(209); /* ICMPv6_Templates.ttcn, line 209 */ OCTETSTRING data(IP__Types::f__IPv6__enc(ip6)); current_location.update_lineno(210); /* ICMPv6_Templates.ttcn, line 210 */ return data; } OCTETSTRING f__ipv6__sol__node__mcast(const OCTETSTRING& addr) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 214, TTCN_Location::LOCATION_FUNCTION, "f_ipv6_sol_node_mcast"); current_location.update_lineno(215); /* ICMPv6_Templates.ttcn, line 215 */ return (os_6 + substr(addr, 13, 3)); } OCTETSTRING f__gen__icmpv6__router__solicitation(const OCTETSTRING& link__id) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 219, TTCN_Location::LOCATION_FUNCTION, "f_gen_icmpv6_router_solicitation"); current_location.update_lineno(220); /* ICMPv6_Templates.ttcn, line 220 */ OCTETSTRING c__ip6__all__router__mcast(os_7); current_location.update_lineno(221); /* ICMPv6_Templates.ttcn, line 221 */ OCTETSTRING saddr(f__ipv6__link__local(link__id)); current_location.update_lineno(223); /* ICMPv6_Templates.ttcn, line 223 */ OCTETSTRING tmp; current_location.update_lineno(224); /* ICMPv6_Templates.ttcn, line 224 */ tmp = ICMPv6__Types::f__enc__PDU__ICMPv6(ts__ICMPv6__RS.valueof(), saddr, os_7); current_location.update_lineno(225); /* ICMPv6_Templates.ttcn, line 225 */ IP__Types::IPv6__packet ip6(ts__IP6(saddr, os_7, 58, tmp, ts__IP6_hlim_defval).valueof()); current_location.update_lineno(227); /* ICMPv6_Templates.ttcn, line 227 */ return IP__Types::f__IPv6__enc(ip6); } OCTETSTRING f__gen__icmpv6__neigh__solicit(const OCTETSTRING& saddr, const OCTETSTRING& daddr, const OCTETSTRING& tgt__addr) { TTCN_Location current_location("ICMPv6_Templates.ttcn", 231, TTCN_Location::LOCATION_FUNCTION, "f_gen_icmpv6_neigh_solicit"); current_location.update_lineno(232); /* ICMPv6_Templates.ttcn, line 232 */ OCTETSTRING tmp; current_location.update_lineno(233); /* ICMPv6_Templates.ttcn, line 233 */ tmp = ICMPv6__Types::f__enc__PDU__ICMPv6(ts__ICMPv6__NS(tgt__addr).valueof(), saddr, daddr); current_location.update_lineno(234); /* ICMPv6_Templates.ttcn, line 234 */ IP__Types::IPv6__packet ip6(ts__IP6(saddr, daddr, 58, tmp, ts__IP6_hlim_defval).valueof()); current_location.update_lineno(235); /* ICMPv6_Templates.ttcn, line 235 */ return IP__Types::f__IPv6__enc(ip6); } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("ICMPv6_Templates.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "ICMPv6_Templates"); IP__Types::module_object.pre_init_module(); ICMPv6__Types::module_object.pre_init_module(); module_object.add_function("f_ipv6_link_local", (genericfunc_t)&f__ipv6__link__local, NULL); module_object.add_function("f_ipv6_global", (genericfunc_t)&f__ipv6__global, NULL); module_object.add_function("f_ipv6_mangle", (genericfunc_t)&f__ipv6__mangle, NULL); module_object.add_function("f_gen_icmpv6_echo", (genericfunc_t)&f__gen__icmpv6__echo, NULL); module_object.add_function("f_ipv6_sol_node_mcast", (genericfunc_t)&f__ipv6__sol__node__mcast, NULL); module_object.add_function("f_gen_icmpv6_router_solicitation", (genericfunc_t)&f__gen__icmpv6__router__solicitation, NULL); module_object.add_function("f_gen_icmpv6_neigh_solicit", (genericfunc_t)&f__gen__icmpv6__neigh__solicit, NULL); } void post_init_module() { TTCN_Location current_location("ICMPv6_Templates.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "ICMPv6_Templates"); IP__Types::module_object.post_init_module(); ICMPv6__Types::module_object.post_init_module(); current_location.update_lineno(34); /* ICMPv6_Templates.ttcn, line 34 */ { ICMPv6__Types::ICMPv6__EchoRequest_template& tmp_1 = template_ts__ICMPv6__ERQ.echoRequest(); tmp_1.typeField() = 128; tmp_1.code() = 0; tmp_1.checksum() = os_1; tmp_1.identifier() = 0; tmp_1.sequenceNr() = 0; tmp_1.data() = os_2; } current_location.update_lineno(46); /* ICMPv6_Templates.ttcn, line 46 */ { ICMPv6__Types::ICMPv6__RouterSolicitation_template& tmp_2 = template_ts__ICMPv6__RS.routerSolicitation(); tmp_2.typeField() = 133; tmp_2.code() = 0; tmp_2.checksum() = os_1; tmp_2.reserved() = os_0; tmp_2.options() = OMIT_VALUE; } current_location.update_lineno(107); /* ICMPv6_Templates.ttcn, line 107 */ template_tr__ICMP6__OptMTU_mtu_defval = ANY_VALUE; current_location.update_lineno(136); /* ICMPv6_Templates.ttcn, line 136 */ { ICMPv6__Types::ICMPv6__DestinationUnreachable_template& tmp_12 = template_tr__ICMPv6__DU.destinationUnreachable(); tmp_12.typeField() = 1; tmp_12.code() = ANY_VALUE; tmp_12.checksum() = ANY_VALUE; tmp_12.unused() = ANY_VALUE; tmp_12.originalIpMsg() = ANY_VALUE; } current_location.update_lineno(147); /* ICMPv6_Templates.ttcn, line 147 */ { ICMPv6__Types::ICMPv6__EchoRequest_template& tmp_13 = template_tr__ICMPv6__ERQ.echoRequest(); tmp_13.typeField() = 128; tmp_13.code() = 0; tmp_13.checksum() = ANY_VALUE; tmp_13.identifier() = ANY_VALUE; tmp_13.sequenceNr() = ANY_VALUE; tmp_13.data() = ANY_VALUE; } current_location.update_lineno(159); /* ICMPv6_Templates.ttcn, line 159 */ template_tr__ICMPv6__ERP_data_defval = ANY_OR_OMIT; current_location.update_lineno(171); /* ICMPv6_Templates.ttcn, line 171 */ const_ts__IP6_hlim_defval = 255; current_location.update_lineno(195); /* ICMPv6_Templates.ttcn, line 195 */ const_f__ipv6__mangle_prefix_defval = 0; } } /* end of namespace */