// 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 "IPL4asp_Functions.hh"

namespace IPL4asp__Functions {

/* Literal string constants */

extern const CHARSTRING cs_2(0, NULL),
cs_1('.'),
cs_0(':');
const unsigned char module_checksum[] = { 0x60, 0x0e, 0xa9, 0x4f, 0xd5, 0x5b, 0x40, 0x7e, 0x8a, 0x7b, 0x60, 0xdd, 0xc2, 0xc0, 0x16, 0x0d };

/* Global variable definitions */

TTCN_Module module_object("IPL4asp_Functions", __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);

/* Bodies of functions, altsteps and testcases */

void f__setUpInterface(const CHARSTRING& startIPAddress, const CHARSTRING& netmask, const CHARSTRING& broadcast, const INTEGER& count, const CHARSTRING& ifname, const INTEGER& virtualIfaceStart)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 20, TTCN_Location::LOCATION_FUNCTION, "f_setUpInterface");
current_location.update_lineno(28);
/* IPL4asp_Functions.ttcn, line 28 */
Socket__API__Definitions::ro__integer startIPAddress__Record(f__splitIpAddress(startIPAddress));
{
current_location.update_lineno(32);
/* IPL4asp_Functions.ttcn, line 32 */
INTEGER i(virtualIfaceStart);
current_location.update_lineno(32);
/* IPL4asp_Functions.ttcn, line 32 */
for ( ; ; ) {
current_location.update_lineno(33);
/* IPL4asp_Functions.ttcn, line 33 */
if (!(i < (virtualIfaceStart + count))) break;
current_location.update_lineno(34);
/* IPL4asp_Functions.ttcn, line 34 */
TCCInterface__Functions::f__setIP(((ifname + cs_0) + int2str(i)), f__presentIpAddress(startIPAddress__Record), netmask, broadcast, TCCInterface__Functions::f__setIP_number_defval);
current_location.update_lineno(36);
/* IPL4asp_Functions.ttcn, line 36 */
f__nextIpAddress(startIPAddress__Record);
current_location.update_lineno(33);
/* IPL4asp_Functions.ttcn, line 33 */
{
INTEGER tmp_0;
++i;
}
}
}
}

void f__setDownInterface(const CHARSTRING& ifname, const INTEGER& count, const INTEGER& virtualIfaceStart)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 40, TTCN_Location::LOCATION_FUNCTION, "f_setDownInterface");
{
current_location.update_lineno(45);
/* IPL4asp_Functions.ttcn, line 45 */
INTEGER i(virtualIfaceStart);
current_location.update_lineno(45);
/* IPL4asp_Functions.ttcn, line 45 */
for ( ; ; ) {
current_location.update_lineno(46);
/* IPL4asp_Functions.ttcn, line 46 */
if (!(i < (virtualIfaceStart + count))) break;
current_location.update_lineno(47);
/* IPL4asp_Functions.ttcn, line 47 */
TCCInterface__Functions::f__deleteIP(((ifname + cs_0) + int2str(i)));
current_location.update_lineno(46);
/* IPL4asp_Functions.ttcn, line 46 */
{
INTEGER tmp_1;
++i;
}
}
}
}

BOOLEAN f__hasColon(const CHARSTRING& str)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 51, TTCN_Location::LOCATION_FUNCTION, "f_hasColon");
current_location.update_lineno(52);
/* IPL4asp_Functions.ttcn, line 52 */
if ((!(str.is_value()))) {
current_location.update_lineno(52);
/* IPL4asp_Functions.ttcn, line 52 */
return FALSE;
}
{
current_location.update_lineno(53);
/* IPL4asp_Functions.ttcn, line 53 */
INTEGER i(0);
current_location.update_lineno(53);
/* IPL4asp_Functions.ttcn, line 53 */
for ( ; ; ) {
current_location.update_lineno(53);
/* IPL4asp_Functions.ttcn, line 53 */
if (!(i < str.lengthof())) break;
current_location.update_lineno(54);
/* IPL4asp_Functions.ttcn, line 54 */
if ((const_cast< const CHARSTRING&>(str)[i] == cs_0)) {
current_location.update_lineno(54);
/* IPL4asp_Functions.ttcn, line 54 */
return TRUE;
}
current_location.update_lineno(53);
/* IPL4asp_Functions.ttcn, line 53 */
{
INTEGER tmp_2;
++i;
}
}
}
current_location.update_lineno(56);
/* IPL4asp_Functions.ttcn, line 56 */
return FALSE;
}

Socket__API__Definitions::ro__charstring f__tokenizeIP(const CHARSTRING& addr)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 59, TTCN_Location::LOCATION_FUNCTION, "f_tokenizeIP");
current_location.update_lineno(60);
/* IPL4asp_Functions.ttcn, line 60 */
Socket__API__Definitions::ro__charstring tokens(NULL_VALUE);
current_location.update_lineno(61);
/* IPL4asp_Functions.ttcn, line 61 */
CHARSTRING l__delim(cs_1);
current_location.update_lineno(62);
/* IPL4asp_Functions.ttcn, line 62 */
if (f__hasColon(addr)) {
current_location.update_lineno(62);
/* IPL4asp_Functions.ttcn, line 62 */
l__delim = cs_0;
}
current_location.update_lineno(63);
/* IPL4asp_Functions.ttcn, line 63 */
CHARSTRING l__token(cs_2);
current_location.update_lineno(64);
/* IPL4asp_Functions.ttcn, line 64 */
INTEGER addrlen(addr.lengthof());
{
current_location.update_lineno(65);
/* IPL4asp_Functions.ttcn, line 65 */
INTEGER i(0);
current_location.update_lineno(65);
/* IPL4asp_Functions.ttcn, line 65 */
for ( ; ; ) {
current_location.update_lineno(65);
/* IPL4asp_Functions.ttcn, line 65 */
if (!(i < addrlen)) break;
current_location.update_lineno(67);
/* IPL4asp_Functions.ttcn, line 67 */
if ((const_cast< const CHARSTRING&>(addr)[i] == l__delim)) {
current_location.update_lineno(68);
/* IPL4asp_Functions.ttcn, line 68 */
tokens[tokens.size_of()] = l__token;
current_location.update_lineno(69);
/* IPL4asp_Functions.ttcn, line 69 */
l__token = cs_2;
}
else {
current_location.update_lineno(71);
/* IPL4asp_Functions.ttcn, line 71 */
{
CHARSTRING tmp_6;
tmp_6 = (l__token + const_cast< const CHARSTRING&>(addr)[i]);
l__token = tmp_6;
}
}
current_location.update_lineno(65);
/* IPL4asp_Functions.ttcn, line 65 */
{
INTEGER tmp_7;
++i;
}
}
}
current_location.update_lineno(74);
/* IPL4asp_Functions.ttcn, line 74 */
if ((l__token != cs_2)) {
current_location.update_lineno(75);
/* IPL4asp_Functions.ttcn, line 75 */
tokens[tokens.size_of()] = l__token;
}
current_location.update_lineno(77);
/* IPL4asp_Functions.ttcn, line 77 */
return tokens;
}

Socket__API__Definitions::ro__integer f__splitIpAddress(const CHARSTRING& addr)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 80, TTCN_Location::LOCATION_FUNCTION, "f_splitIpAddress");
current_location.update_lineno(83);
/* IPL4asp_Functions.ttcn, line 83 */
Socket__API__Definitions::ro__integer segAddr(NULL_VALUE);
current_location.update_lineno(84);
/* IPL4asp_Functions.ttcn, line 84 */
Socket__API__Definitions::ro__charstring ip(f__tokenizeIP(addr));
current_location.update_lineno(85);
/* IPL4asp_Functions.ttcn, line 85 */
if (f__hasColon(addr)) {
current_location.update_lineno(87);
/* IPL4asp_Functions.ttcn, line 87 */
INTEGER i(0);
for ( ; ; ) {
current_location.update_lineno(88);
/* IPL4asp_Functions.ttcn, line 88 */
if (!(const_cast< const Socket__API__Definitions::ro__charstring&>(ip)[i] != cs_2)) break;
current_location.update_lineno(89);
/* IPL4asp_Functions.ttcn, line 89 */
segAddr[i] = hex2int(str2hex(const_cast< const Socket__API__Definitions::ro__charstring&>(ip)[i]));
current_location.update_lineno(90);
/* IPL4asp_Functions.ttcn, line 90 */
{
INTEGER tmp_10;
++i;
}
current_location.update_lineno(91);
/* IPL4asp_Functions.ttcn, line 91 */
if ((i == ip.size_of())) {
current_location.update_lineno(92);
/* IPL4asp_Functions.ttcn, line 92 */
return segAddr;
}
}
current_location.update_lineno(95);
/* IPL4asp_Functions.ttcn, line 95 */
INTEGER memo((i + 1));
current_location.update_lineno(96);
/* IPL4asp_Functions.ttcn, line 96 */
INTEGER zs(((8 - ip.size_of()) + 1));
{
current_location.update_lineno(97);
/* IPL4asp_Functions.ttcn, line 97 */
INTEGER k(i);
current_location.update_lineno(97);
/* IPL4asp_Functions.ttcn, line 97 */
for ( ; ; ) {
current_location.update_lineno(97);
/* IPL4asp_Functions.ttcn, line 97 */
if (!(k < (zs + i))) break;
current_location.update_lineno(98);
/* IPL4asp_Functions.ttcn, line 98 */
segAddr[k] = 0;
current_location.update_lineno(97);
/* IPL4asp_Functions.ttcn, line 97 */
{
INTEGER tmp_12;
++k;
}
}
}
current_location.update_lineno(100);
/* IPL4asp_Functions.ttcn, line 100 */
{
INTEGER tmp_13;
tmp_13 = (i + zs);
i = tmp_13;
}
for ( ; ; ) {
current_location.update_lineno(101);
/* IPL4asp_Functions.ttcn, line 101 */
{
boolean tmp_14;
tmp_14 = (i < 8);
if (tmp_14) tmp_14 = (memo < ip.size_of());
if (!tmp_14) break;
}
current_location.update_lineno(102);
/* IPL4asp_Functions.ttcn, line 102 */
segAddr[i] = hex2int(str2hex(const_cast< const Socket__API__Definitions::ro__charstring&>(ip)[memo]));
current_location.update_lineno(103);
/* IPL4asp_Functions.ttcn, line 103 */
{
INTEGER tmp_16;
++i;
}
current_location.update_lineno(103);
/* IPL4asp_Functions.ttcn, line 103 */
{
INTEGER tmp_17;
++memo;
}
}
}
else {
{
current_location.update_lineno(107);
/* IPL4asp_Functions.ttcn, line 107 */
INTEGER i(0);
current_location.update_lineno(107);
/* IPL4asp_Functions.ttcn, line 107 */
for ( ; ; ) {
current_location.update_lineno(107);
/* IPL4asp_Functions.ttcn, line 107 */
if (!(i < 4)) break;
current_location.update_lineno(108);
/* IPL4asp_Functions.ttcn, line 108 */
segAddr[i] = str2int(const_cast< const Socket__API__Definitions::ro__charstring&>(ip)[i]);
current_location.update_lineno(107);
/* IPL4asp_Functions.ttcn, line 107 */
{
INTEGER tmp_19;
++i;
}
}
}
}
current_location.update_lineno(112);
/* IPL4asp_Functions.ttcn, line 112 */
return segAddr;
}

CHARSTRING f__presentIpAddress(const Socket__API__Definitions::ro__integer& addr)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 115, TTCN_Location::LOCATION_FUNCTION, "f_presentIpAddress");
current_location.update_lineno(116);
/* IPL4asp_Functions.ttcn, line 116 */
if ((addr.size_of() == 4)) {
current_location.update_lineno(117);
/* IPL4asp_Functions.ttcn, line 117 */
return ((((((int2str(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[0]) + cs_1) + int2str(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[1])) + cs_1) + int2str(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[2])) + cs_1) + int2str(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[3]));
}
else {
current_location.update_lineno(122);
/* IPL4asp_Functions.ttcn, line 122 */
return ((((((((((((((hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[0], 4)) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[1], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[2], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[3], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[4], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[5], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[6], 4))) + cs_0) + hex2str(int2hex(const_cast< const Socket__API__Definitions::ro__integer&>(addr)[7], 4)));
}
}

void f__nextIpAddress(Socket__API__Definitions::ro__integer& addr)
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 135, TTCN_Location::LOCATION_FUNCTION, "f_nextIpAddress");
current_location.update_lineno(138);
/* IPL4asp_Functions.ttcn, line 138 */
INTEGER n(addr.size_of());
current_location.update_lineno(139);
/* IPL4asp_Functions.ttcn, line 139 */
INTEGER segMax(255);
current_location.update_lineno(140);
/* IPL4asp_Functions.ttcn, line 140 */
if ((n == 8)) {
current_location.update_lineno(141);
/* IPL4asp_Functions.ttcn, line 141 */
segMax = 65535;
}
{
current_location.update_lineno(144);
/* IPL4asp_Functions.ttcn, line 144 */
INTEGER i((n - 1));
current_location.update_lineno(144);
/* IPL4asp_Functions.ttcn, line 144 */
for ( ; ; ) {
current_location.update_lineno(144);
/* IPL4asp_Functions.ttcn, line 144 */
if (!(i >= 0)) break;
current_location.update_lineno(145);
/* IPL4asp_Functions.ttcn, line 145 */
if ((const_cast< const Socket__API__Definitions::ro__integer&>(addr)[i] < segMax)) {
current_location.update_lineno(146);
/* IPL4asp_Functions.ttcn, line 146 */
{
INTEGER tmp_21;
tmp_21 = (const_cast< const Socket__API__Definitions::ro__integer&>(addr)[i] + 1);
addr[i] = tmp_21;
}
current_location.update_lineno(147);
/* IPL4asp_Functions.ttcn, line 147 */
return;
}
else {
current_location.update_lineno(149);
/* IPL4asp_Functions.ttcn, line 149 */
addr[i] = 0;
}
current_location.update_lineno(144);
/* IPL4asp_Functions.ttcn, line 144 */
{
INTEGER tmp_23;
--i;
}
}
}
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPL4asp_Functions");
IPL4asp__PortType::module_object.pre_init_module();
TCCInterface__Functions::module_object.pre_init_module();
module_object.add_function("f_setUpInterface", (genericfunc_t)&f__setUpInterface, NULL);
module_object.add_function("f_setDownInterface", (genericfunc_t)&f__setDownInterface, NULL);
module_object.add_function("f_hasColon", (genericfunc_t)&f__hasColon, NULL);
module_object.add_function("f_tokenizeIP", (genericfunc_t)&f__tokenizeIP, NULL);
module_object.add_function("f_splitIpAddress", (genericfunc_t)&f__splitIpAddress, NULL);
module_object.add_function("f_presentIpAddress", (genericfunc_t)&f__presentIpAddress, NULL);
module_object.add_function("f_nextIpAddress", (genericfunc_t)&f__nextIpAddress, NULL);
module_object.add_function("f_findIpAddressesWithDhcp", (genericfunc_t)&f__findIpAddressesWithDhcp, NULL);
module_object.add_function("f_releaseIpAddressesFromDhcp", (genericfunc_t)&f__releaseIpAddressesFromDhcp, NULL);
module_object.add_function("f_findIpAddressesWithARP", (genericfunc_t)&f__findIpAddressesWithARP, NULL);
module_object.add_function("f_findIpAddresses", (genericfunc_t)&f__findIpAddresses, NULL);
}

void post_init_module()
{
TTCN_Location current_location("IPL4asp_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPL4asp_Functions");
IPL4asp__PortType::module_object.post_init_module();
TCCInterface__Functions::module_object.post_init_module();
}


} /* end of namespace */
