// 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 "ICMP_Templates.hh" namespace ICMP__Templates { /* Literal string constants */ const unsigned char bs_0_bits[] = { 0 }, bs_1_bits[] = { 1 }; extern const BITSTRING bs_0(1, bs_0_bits), bs_1(1, bs_1_bits); const unsigned char os_0_octets[] = { 0, 0 }, os_2_octets[] = { 0, 1 }, os_1_octets[] = { 3, 69 }; extern const OCTETSTRING os_3(0, NULL), os_0(2, os_0_octets), os_2(2, os_2_octets), os_1(2, os_1_octets); const unsigned char module_checksum[] = { 0x46, 0x34, 0x45, 0x36, 0x74, 0x98, 0xd9, 0x19, 0x69, 0xf4, 0x07, 0x12, 0xfa, 0x50, 0xab, 0x81 }; /* Global variable definitions */ OCTETSTRING const_ts__ICMPv4__ERQ_data_defval; const OCTETSTRING& ts__ICMPv4__ERQ_data_defval = const_ts__ICMPv4__ERQ_data_defval; ICMP__Types::PDU__ICMP_template template_tr__ICMPv4__ERQ; const ICMP__Types::PDU__ICMP_template& tr__ICMPv4__ERQ = template_tr__ICMPv4__ERQ; OCTETSTRING_template template_tr__ICMPv4__ERP_data_defval; const OCTETSTRING_template& tr__ICMPv4__ERP_data_defval = template_tr__ICMPv4__ERP_data_defval; ICMP__Types::PDU__ICMP_template template_tr__ICMPv4__DU; const ICMP__Types::PDU__ICMP_template& tr__ICMPv4__DU = template_tr__ICMPv4__DU; OCTETSTRING const_f__gen__icmpv4__echo_pl_defval; const OCTETSTRING& f__gen__icmpv4__echo_pl_defval = const_f__gen__icmpv4__echo_pl_defval; TTCN_Module module_object("ICMP_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 */ ICMP__Types::PDU__ICMP_template ts__ICMPv4__ERQ(const OCTETSTRING& data) { TTCN_Location current_location("ICMP_Templates.ttcn", 18, TTCN_Location::LOCATION_TEMPLATE, "ts_ICMPv4_ERQ"); ICMP__Types::PDU__ICMP_template ret_val; { ICMP__Types::ICMP__Echo_template& tmp_0 = ret_val.echo(); tmp_0.type__field() = 8; tmp_0.code() = 0; tmp_0.checksum() = os_0; tmp_0.identifier() = os_1; tmp_0.sequence__number() = os_2; tmp_0.data() = data; } return ret_val; } ICMP__Types::PDU__ICMP_template tr__ICMPv4__ERP(const OCTETSTRING_template& data) { TTCN_Location current_location("ICMP_Templates.ttcn", 42, TTCN_Location::LOCATION_TEMPLATE, "tr_ICMPv4_ERP"); ICMP__Types::PDU__ICMP_template ret_val; { ICMP__Types::ICMP__EchoReply_template& tmp_2 = ret_val.echo__reply(); tmp_2.type__field() = 0; tmp_2.code() = 0; tmp_2.checksum() = ANY_VALUE; tmp_2.identifier() = ANY_VALUE; tmp_2.sequence__number() = ANY_VALUE; tmp_2.data() = data; } return ret_val; } IP__Types::IPv4__packet_template ts__IP4(const OCTETSTRING& srcaddr, const OCTETSTRING& dstaddr, const INTEGER& proto, const INTEGER& tlen, const OCTETSTRING& payload) { TTCN_Location current_location("ICMP_Templates.ttcn", 65, TTCN_Location::LOCATION_TEMPLATE, "ts_IP4"); IP__Types::IPv4__packet_template ret_val; { IP__Types::IPv4__header_template& tmp_4 = ret_val.header(); tmp_4.ver() = 4; tmp_4.hlen() = 5; tmp_4.tos() = 0; tmp_4.tlen() = tlen; tmp_4.id() = 35902; tmp_4.res() = bs_0; tmp_4.dfrag() = bs_1; tmp_4.mfrag() = bs_0; tmp_4.foffset() = 0; tmp_4.ttl() = 64; tmp_4.proto() = proto; tmp_4.cksum() = 0; tmp_4.srcaddr() = srcaddr; tmp_4.dstaddr() = dstaddr; } ret_val.ext__headers() = OMIT_VALUE; ret_val.payload() = payload; return ret_val; } OCTETSTRING f__gen__icmpv4__echo(const OCTETSTRING& saddr, const OCTETSTRING& daddr, const OCTETSTRING& pl) { TTCN_Location current_location("ICMP_Templates.ttcn", 87, TTCN_Location::LOCATION_FUNCTION, "f_gen_icmpv4_echo"); current_location.update_lineno(88); /* ICMP_Templates.ttcn, line 88 */ OCTETSTRING tmp(ICMP__Types::f__enc__PDU__ICMP(ts__ICMPv4__ERQ(pl).valueof())); current_location.update_lineno(89); /* ICMP_Templates.ttcn, line 89 */ IP__Types::IPv4__packet ip4(ts__IP4(saddr, daddr, 1, 50, tmp).valueof()); current_location.update_lineno(90); /* ICMP_Templates.ttcn, line 90 */ OCTETSTRING data(IP__Types::f__IPv4__enc(ip4)); current_location.update_lineno(91); /* ICMP_Templates.ttcn, line 91 */ OCTETSTRING cksum(IP__Types::f__IPv4__checksum(data)); current_location.update_lineno(92); /* ICMP_Templates.ttcn, line 92 */ data[10] = const_cast< const OCTETSTRING&>(cksum)[0]; current_location.update_lineno(93); /* ICMP_Templates.ttcn, line 93 */ data[11] = const_cast< const OCTETSTRING&>(cksum)[1]; current_location.update_lineno(94); /* ICMP_Templates.ttcn, line 94 */ return data; } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("ICMP_Templates.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "ICMP_Templates"); IP__Types::module_object.pre_init_module(); ICMP__Types::module_object.pre_init_module(); module_object.add_function("f_gen_icmpv4_echo", (genericfunc_t)&f__gen__icmpv4__echo, NULL); } void post_init_module() { TTCN_Location current_location("ICMP_Templates.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "ICMP_Templates"); IP__Types::module_object.post_init_module(); ICMP__Types::module_object.post_init_module(); current_location.update_lineno(18); /* ICMP_Templates.ttcn, line 18 */ const_ts__ICMPv4__ERQ_data_defval = os_3; current_location.update_lineno(30); /* ICMP_Templates.ttcn, line 30 */ { ICMP__Types::ICMP__Echo_template& tmp_1 = template_tr__ICMPv4__ERQ.echo(); tmp_1.type__field() = 8; tmp_1.code() = 0; tmp_1.checksum() = ANY_VALUE; tmp_1.identifier() = ANY_VALUE; tmp_1.sequence__number() = ANY_VALUE; tmp_1.data() = ANY_VALUE; } current_location.update_lineno(42); /* ICMP_Templates.ttcn, line 42 */ template_tr__ICMPv4__ERP_data_defval = ANY_OR_OMIT; current_location.update_lineno(54); /* ICMP_Templates.ttcn, line 54 */ { ICMP__Types::ICMP__DestinationUnreachable_template& tmp_3 = template_tr__ICMPv4__DU.destination__unreachable(); tmp_3.type__field() = 1; tmp_3.code() = ANY_VALUE; tmp_3.checksum() = ANY_VALUE; tmp_3.unused() = ANY_VALUE; tmp_3.original__ip__msg() = ANY_VALUE; } current_location.update_lineno(87); /* ICMP_Templates.ttcn, line 87 */ const_f__gen__icmpv4__echo_pl_defval = os_3; } } /* end of namespace */