// 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 "DNS_Helpers.hh" namespace DNS__Helpers { /* Literal string constants */ extern const OCTETSTRING os_0(0, NULL); extern const CHARSTRING cs_1(0, NULL), cs_0('.'); const unsigned char module_checksum[] = { 0xeb, 0xf6, 0x92, 0x9d, 0xa8, 0xbb, 0x79, 0x0a, 0x1a, 0x0a, 0xff, 0xb8, 0xcb, 0xab, 0x8e, 0x8e }; /* Global variable definitions */ TTCN_Module module_object("DNS_Helpers", __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_11, current_runtime_version.requires_minor_version_1, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Bodies of functions, altsteps and testcases */ INTEGER f__strchr(const CHARSTRING& s, const CHARSTRING& c) { TTCN_Location current_location("DNS_Helpers.ttcn", 13, TTCN_Location::LOCATION_FUNCTION, "f_strchr"); current_location.update_lineno(14); /* DNS_Helpers.ttcn, line 14 */ INTEGER i; current_location.update_lineno(15); /* DNS_Helpers.ttcn, line 15 */ i = 0; current_location.update_lineno(15); /* DNS_Helpers.ttcn, line 15 */ for ( ; ; ) { current_location.update_lineno(15); /* DNS_Helpers.ttcn, line 15 */ if (!(i < s.lengthof())) break; current_location.update_lineno(16); /* DNS_Helpers.ttcn, line 16 */ if ((const_cast< const CHARSTRING&>(s)[i] == c)) { current_location.update_lineno(17); /* DNS_Helpers.ttcn, line 17 */ return i; } current_location.update_lineno(15); /* DNS_Helpers.ttcn, line 15 */ { INTEGER tmp_1; ++i; } } current_location.update_lineno(20); /* DNS_Helpers.ttcn, line 20 */ return -1; } OCTETSTRING f__dns__enc__label(const CHARSTRING& str) { TTCN_Location current_location("DNS_Helpers.ttcn", 23, TTCN_Location::LOCATION_FUNCTION, "f_dns_enc_label"); current_location.update_lineno(24); /* DNS_Helpers.ttcn, line 24 */ OCTETSTRING ret; current_location.update_lineno(26); /* DNS_Helpers.ttcn, line 26 */ ret[0] = int2oct(str.lengthof(), 1); current_location.update_lineno(27); /* DNS_Helpers.ttcn, line 27 */ return (ret + char2oct(str)); } OCTETSTRING f__enc__dns__hostname(const CHARSTRING& str) { CHARSTRING str_shadow(str); TTCN_Location current_location("DNS_Helpers.ttcn", 30, TTCN_Location::LOCATION_FUNCTION, "f_enc_dns_hostname"); current_location.update_lineno(31); /* DNS_Helpers.ttcn, line 31 */ OCTETSTRING ret(os_0); for ( ; ; ) { current_location.update_lineno(32); /* DNS_Helpers.ttcn, line 32 */ if (!(str_shadow.lengthof() > 0)) break; current_location.update_lineno(33); /* DNS_Helpers.ttcn, line 33 */ INTEGER dot__idx; current_location.update_lineno(34); /* DNS_Helpers.ttcn, line 34 */ OCTETSTRING lbl; current_location.update_lineno(36); /* DNS_Helpers.ttcn, line 36 */ dot__idx = f__strchr(str_shadow, cs_0); current_location.update_lineno(37); /* DNS_Helpers.ttcn, line 37 */ if ((dot__idx >= 0)) { current_location.update_lineno(39); /* DNS_Helpers.ttcn, line 39 */ lbl = f__dns__enc__label(substr(str_shadow, 0, dot__idx)); current_location.update_lineno(40); /* DNS_Helpers.ttcn, line 40 */ { CHARSTRING tmp_5; tmp_5 = substr(str_shadow, (dot__idx + 1), ((str_shadow.lengthof() - dot__idx) - 1)); str_shadow = tmp_5; } } else { current_location.update_lineno(43); /* DNS_Helpers.ttcn, line 43 */ lbl = f__dns__enc__label(str_shadow); current_location.update_lineno(44); /* DNS_Helpers.ttcn, line 44 */ str_shadow = cs_1; } current_location.update_lineno(46); /* DNS_Helpers.ttcn, line 46 */ { OCTETSTRING tmp_8; tmp_8 = (ret + lbl); ret = tmp_8; } } current_location.update_lineno(48); /* DNS_Helpers.ttcn, line 48 */ return ret; } CHARSTRING f__dec__dns__hostname(const OCTETSTRING& inp) { OCTETSTRING inp_shadow(inp); TTCN_Location current_location("DNS_Helpers.ttcn", 54, TTCN_Location::LOCATION_FUNCTION, "f_dec_dns_hostname"); current_location.update_lineno(55); /* DNS_Helpers.ttcn, line 55 */ CHARSTRING ret(cs_1); for ( ; ; ) { current_location.update_lineno(56); /* DNS_Helpers.ttcn, line 56 */ if (!(inp_shadow.lengthof() > 0)) break; current_location.update_lineno(57); /* DNS_Helpers.ttcn, line 57 */ INTEGER label__len; current_location.update_lineno(58); /* DNS_Helpers.ttcn, line 58 */ CHARSTRING lbl; current_location.update_lineno(60); /* DNS_Helpers.ttcn, line 60 */ label__len = oct2int(substr(inp_shadow, 0, 1)); current_location.update_lineno(61); /* DNS_Helpers.ttcn, line 61 */ lbl = oct2char(substr(inp_shadow, 1, label__len)); current_location.update_lineno(62); /* DNS_Helpers.ttcn, line 62 */ { OCTETSTRING tmp_11; tmp_11 = substr(inp_shadow, (1 + label__len), ((inp_shadow.lengthof() - 1) - label__len)); inp_shadow = tmp_11; } current_location.update_lineno(64); /* DNS_Helpers.ttcn, line 64 */ { CHARSTRING tmp_12; tmp_12 = (ret + lbl); ret = tmp_12; } current_location.update_lineno(65); /* DNS_Helpers.ttcn, line 65 */ if ((inp_shadow.lengthof() > 0)) { current_location.update_lineno(66); /* DNS_Helpers.ttcn, line 66 */ { CHARSTRING tmp_13; tmp_13 = (ret + cs_0); ret = tmp_13; } } } current_location.update_lineno(69); /* DNS_Helpers.ttcn, line 69 */ return ret; } OCTETSTRING f__enc__IPv4(const CHARSTRING& str) { CHARSTRING str_shadow(str); TTCN_Location current_location("DNS_Helpers.ttcn", 73, TTCN_Location::LOCATION_FUNCTION, "f_enc_IPv4"); current_location.update_lineno(74); /* DNS_Helpers.ttcn, line 74 */ OCTETSTRING ret(os_0); for ( ; ; ) { current_location.update_lineno(76); /* DNS_Helpers.ttcn, line 76 */ if (!(str_shadow.lengthof() > 0)) break; current_location.update_lineno(77); /* DNS_Helpers.ttcn, line 77 */ INTEGER dot__idx; current_location.update_lineno(78); /* DNS_Helpers.ttcn, line 78 */ CHARSTRING num; current_location.update_lineno(80); /* DNS_Helpers.ttcn, line 80 */ dot__idx = f__strchr(str_shadow, cs_0); current_location.update_lineno(81); /* DNS_Helpers.ttcn, line 81 */ if ((dot__idx >= 0)) { current_location.update_lineno(83); /* DNS_Helpers.ttcn, line 83 */ num = substr(str_shadow, 0, dot__idx); current_location.update_lineno(84); /* DNS_Helpers.ttcn, line 84 */ { CHARSTRING tmp_16; tmp_16 = substr(str_shadow, (dot__idx + 1), ((str_shadow.lengthof() - dot__idx) - 1)); str_shadow = tmp_16; } } else { current_location.update_lineno(87); /* DNS_Helpers.ttcn, line 87 */ num = str_shadow; current_location.update_lineno(88); /* DNS_Helpers.ttcn, line 88 */ str_shadow = cs_1; } current_location.update_lineno(90); /* DNS_Helpers.ttcn, line 90 */ { OCTETSTRING tmp_19; tmp_19 = (ret + int2oct(str2int(num), 1)); ret = tmp_19; } } current_location.update_lineno(93); /* DNS_Helpers.ttcn, line 93 */ return ret; } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("DNS_Helpers.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "DNS_Helpers"); module_object.add_function("f_strchr", (genericfunc_t)&f__strchr, NULL); module_object.add_function("f_dns_enc_label", (genericfunc_t)&f__dns__enc__label, NULL); module_object.add_function("f_enc_dns_hostname", (genericfunc_t)&f__enc__dns__hostname, NULL); module_object.add_function("f_dec_dns_hostname", (genericfunc_t)&f__dec__dns__hostname, NULL); module_object.add_function("f_enc_IPv4", (genericfunc_t)&f__enc__IPv4, NULL); } } /* end of namespace */