multimediacommsengine/tsrc/testdriver/siptester/ttcn/CtrlFunctions.ttcn
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 // File : CtrlFunctions.ttcn
       
     2 //
       
     3 // Info : This file specifies functions for using CTRL elements
       
     4 //
       
     5 //        Do not modify without permission!
       
     6 //
       
     7 
       
     8 module CtrlFunctions
       
     9 {
       
    10 
       
    11 import from CtrlRel2Types all;
       
    12 import from CtrlRel2Templates all;
       
    13 import from ModuleParameters all;
       
    14 import from OtherTypesAndConstants all;
       
    15 import from TestSystem all;
       
    16 import from L4RouterConfig all;  
       
    17 import from TestCoordinationManagement all;
       
    18 import from CtrlTestCaseTemplates all;
       
    19 
       
    20 // Use f_ctrlGetParameter to read actual parameter values from the returned AbstractCtrlResponse	
       
    21 function f_ctrlAuthenticate ( in template ParameterList p_params  ) runs on CtrlCompType return AbstractCtrlResponse
       
    22 	{
       
    23 		return f_ctrlGenericRequest( "Authenticate", {}, omit, p_params );
       
    24 	}
       
    25 	
       
    26 function f_ctrlIgnoreChallenge ( in template ParameterList p_params ) runs on CtrlCompType
       
    27 	{
       
    28 		f_ctrlGenericRequest( "IgnoreChallenge", {}, omit, p_params );
       
    29 	}
       
    30 
       
    31 function f_ctrlGetChallenge ( in template ParameterList p_params ) runs on CtrlCompType return charstring
       
    32 	{
       
    33 		var AbstractCtrlResponse res;
       
    34 		res := f_ctrlGenericRequest( "GetChallenge", {}, omit, p_params );
       
    35 		return f_ctrlGetParameter( res, a_ctrlDigestRealm( ? ) );
       
    36 	}
       
    37 	
       
    38 function f_ctrlSetCredentials ( in template ParameterList p_params ) runs on CtrlCompType
       
    39 	{
       
    40 		f_ctrlGenericRequest( "SetCredentials", {}, omit, p_params );
       
    41 	}
       
    42 	
       
    43 function f_ctrlRemoveCredentials ( in template ParameterList p_params ) runs on CtrlCompType
       
    44 	{
       
    45 		f_ctrlGenericRequest( "RemoveCredentials", {}, omit, p_params );
       
    46 	}
       
    47 	
       
    48 function f_ctrlDeleteConnection ( in template TestClientIdList p_ids ) runs on CtrlCompType
       
    49 	{
       
    50 		f_ctrlGenericRequest( "DeleteConnection", {}, p_ids, omit );
       
    51 	}
       
    52 	
       
    53 function f_ctrlRemoveHttpObserver ( ) runs on CtrlCompType
       
    54 	{
       
    55 		f_ctrlGenericRequest( "RemoveHttpObserver", {}, omit, omit );
       
    56 	}
       
    57 	
       
    58 function f_ctrlFreezeTester ( in template ParameterList p_params  ) runs on CtrlCompType
       
    59 	{
       
    60 		f_ctrlGenericRequest( "FreezeTester", {}, omit, p_params );
       
    61 	}
       
    62 	
       
    63 function f_ctrlChannel ( in ValueList p_headers,
       
    64 												 in template ParameterList p_params  ) runs on CtrlCompType return charstring
       
    65 	{
       
    66 		var AbstractCtrlResponse res;
       
    67 		res := f_ctrlGenericRequest( "Channel", p_headers, omit, p_params  );
       
    68 		return f_ctrlGetParameter( res, a_ctrlClientDiscoveryRequestId( ? ) );
       
    69 	}
       
    70 	
       
    71 function f_ctrlCreateSession ( in template ParameterList p_params  ) runs on CtrlCompType 
       
    72 	{
       
    73 		f_ctrlGenericRequest( "CreateSession", {}, omit, p_params );
       
    74 	}
       
    75 
       
    76 // Use f_ctrlGetParameter to read actual parameter values from the returned AbstractCtrlResponse	
       
    77 function f_ctrlGetClientDiscoveryStatus ( in template ParameterList p_params  ) runs on CtrlCompType return AbstractCtrlResponse
       
    78 	{
       
    79 		return f_ctrlGenericRequest( "GetClientDiscoveryStatus", {}, omit, p_params );
       
    80 	}
       
    81 	
       
    82 function f_ctrlRegisterClient ( in template ParameterList p_params  ) runs on CtrlCompType 
       
    83 	{
       
    84 		f_ctrlGenericRequest( "RegisterClient", {}, omit, p_params );
       
    85 	}
       
    86 
       
    87 
       
    88 // Added by jarim 6.7.2004 for special hardware case INV_16
       
    89 
       
    90 function f_ctrlStartTestCase_hardware (	in charstring p_testCaseName,
       
    91 										CompRefs p_compRefs  ) runs on CtrlCompType
       
    92 	{
       
    93 	f_ctrlInit_hardware( p_compRefs );
       
    94 
       
    95 	CTRL.send( a_ctrlStartTCRequest( p_testCaseName ) );
       
    96 	alt {
       
    97 		[] CTRL.receive( a_ctrlOkResponse )
       
    98 			{
       
    99 			}
       
   100 		}
       
   101 
       
   102 	}
       
   103 
       
   104 
       
   105 function f_ctrlInit_hardware( CompRefs p_compRefs ) runs on CtrlCompType
       
   106 	{
       
   107 	g_v_compRefs := p_compRefs;
       
   108 	f_initAndMapL4rCtrlTcpIpv4_hardware();
       
   109 
       
   110 	var default defaultsRef;
       
   111 	defaultsRef := activate( defaultCTRL() );
       
   112 
       
   113 	f_syncCTRL();
       
   114 	
       
   115 	deactivate(defaultsRef); // Tero added 18.2.
       
   116 	}
       
   117 
       
   118 function f_initAndMapL4rCtrlTcpIpv4_hardware() runs on CtrlCompType
       
   119 	{
       
   120 	map( self:MGMT, system:MGMT );
       
   121 	if( mp_sip_bearer_bt )
       
   122 		{
       
   123 		MGMT.send( a_CreateBluetoothCompProfile( mp_sip_bearer_bt_com_port ) );
       
   124 		map( self:CTRL, system:BT );
       
   125 		}
       
   126 	else
       
   127 		{
       
   128 		MGMT.send( a_CreateMyCompProfile( e_tcp, 5071, mp_sip_emu_ipAddress_ctrl.ipv4, 5070 ) );
       
   129 		map( self:CTRL, system:TCP );
       
   130 		}
       
   131 	}
       
   132 
       
   133 // Added for Remote URI handling in requests for R4 Ite 4 and later
       
   134 
       
   135 function f_constructParameters(in ParameterList p_params,
       
   136 							   in ParameterList p_mandatoryRequestParams) return ParameterList
       
   137 {
       
   138 	var integer i := 0;
       
   139 	var integer ii := 0;
       
   140 	var boolean v_remoteURIWasNotAssigned := true;
       
   141 	var ParameterList v_parameterList;
       
   142 
       
   143 	for ( i := 0; i < sizeof(valueof(p_params)); i := i + 1)
       
   144 	{
       
   145 		if ( valueof(p_params[i].parameter.pName) == "RemoteURI" ) {
       
   146 			v_remoteURIWasNotAssigned := false;
       
   147 		}
       
   148 
       
   149 		v_parameterList[i] := valueof(p_params[i]);
       
   150 	}
       
   151 
       
   152 	if ( v_remoteURIWasNotAssigned ) {
       
   153 		i := sizeof(valueof(p_params));
       
   154 		for ( ii := 0; ii < sizeof(valueof(p_mandatoryRequestParams)); ii := ii + 1)
       
   155 		{
       
   156 			v_parameterList[i] := valueof(p_mandatoryRequestParams[ii]);
       
   157 		}
       
   158 	}
       
   159 
       
   160 	return v_parameterList;
       
   161 }
       
   162 
       
   163 // End of adding by jarim
       
   164 
       
   165 
       
   166 function f_initAndMapL4rCtrlTcpIpv4() runs on CtrlCompType
       
   167 	{
       
   168 	map( self:MGMT, system:MGMT );
       
   169 	if( mp_sip_bearer_bt )
       
   170 		{
       
   171 		MGMT.send( a_CreateBluetoothCompProfile( mp_sip_bearer_bt_com_port ) );
       
   172 		map( self:CTRL, system:BT );
       
   173 		}
       
   174 	else
       
   175 		{
       
   176 		MGMT.send( a_CreateMyCompProfile( e_tcp, 5071, mp_sip_emu_ipAddress.ipv4, 5070 ) );
       
   177 		map( self:CTRL, system:TCP );
       
   178 		}
       
   179 	}
       
   180 
       
   181 
       
   182 //
       
   183 // -- GetXXX functions --------------------------------------------------------
       
   184 //
       
   185 
       
   186 function f_ctrlGetConnectionState ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   187 	{
       
   188 	var AbstractCtrlResponse res;
       
   189 	res := f_ctrlGenericRequest( "GetConnectionState", {}, p_ids, omit );
       
   190 	return f_ctrlGetParameter( res, a_ctrlConnectionState( ? ) );
       
   191 	}
       
   192 
       
   193 function f_ctrlGetDialogAOR ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   194 	{
       
   195 	var AbstractCtrlResponse res;
       
   196 	res := f_ctrlGenericRequest( "GetDialogAOR", {}, p_ids, omit );
       
   197 	return f_ctrlGetParameter( res, a_ctrlAddress( ? ) );
       
   198 	}
       
   199 
       
   200 function f_ctrlGetDialogFrom ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   201 	{
       
   202 	var AbstractCtrlResponse res;
       
   203 	res := f_ctrlGenericRequest( "GetDialogFrom", {}, p_ids, omit );
       
   204 	return f_ctrlGetParameter( res, a_ctrlAddress( ? ) );
       
   205 	}
       
   206 
       
   207 function f_ctrlGetDialogRegistration ( in template TestClientIdList p_ids ) runs on CtrlCompType return AbstractCtrlResponse
       
   208 	{
       
   209 	var AbstractCtrlResponse res;
       
   210 	res := f_ctrlGenericRequest( "GetDialogRegistration", {}, p_ids, omit );
       
   211 	return res;
       
   212 	}
       
   213 
       
   214 function f_ctrlGetDialogRemoteURI ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   215 	{
       
   216 	var AbstractCtrlResponse res;
       
   217 	res := f_ctrlGenericRequest( "GetDialogRemoteURI", {}, p_ids, omit );
       
   218 	return f_ctrlGetParameter( res, a_ctrlRemoteURI( ? ) );
       
   219 	}
       
   220 
       
   221 function f_ctrlGetDialogState ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   222 	{
       
   223 	var AbstractCtrlResponse res;
       
   224 	res := f_ctrlGenericRequest( "GetDialogState", {}, p_ids, omit );
       
   225 	return f_ctrlGetParameter( res, a_ctrlDialogState( ? ) );
       
   226 	}
       
   227 
       
   228 function f_ctrlGetTransactionState ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   229 	{
       
   230 	var AbstractCtrlResponse res;
       
   231 	res := f_ctrlGenericRequest( "GetTransactionState", {}, p_ids, omit );
       
   232 	return f_ctrlGetParameter( res, a_ctrlTransactionState( ? ) );
       
   233 	}
       
   234 
       
   235 function f_ctrlGetTransactionStateWitResponse ( in template TestClientIdList p_ids ) runs on CtrlCompType return AbstractCtrlResponse
       
   236 	{
       
   237 	return f_ctrlGenericRequest( "GetTransactionState", {}, p_ids, omit );
       
   238 	}
       
   239 
       
   240 function f_ctrlGetIAPName ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   241 	{
       
   242 	var AbstractCtrlResponse res;
       
   243 	res := f_ctrlGenericRequest( "GetIAPName", {}, p_ids, omit );
       
   244 	return f_ctrlGetParameter( res, a_ctrlIAPName( ? ) );
       
   245 	}
       
   246 
       
   247 function f_ctrlGetIAPNames ( ) runs on CtrlCompType return ValueList
       
   248 	{
       
   249 	var AbstractCtrlResponse res;
       
   250 	res := f_ctrlGenericRequest( "GetIAPNames", {}, omit, omit );
       
   251 	return f_ctrlGetArray( res, a_ctrlIAPNames( ? ) );
       
   252 	}
       
   253 
       
   254 function f_ctrlGetMessage ( in template ParameterList p_params ) runs on CtrlCompType return ReceivedMsg
       
   255 	{
       
   256 	var AbstractCtrlResponse res;
       
   257 	res := f_ctrlGenericRequest( "GetMessage", {}, omit, p_params );
       
   258 
       
   259 	if ( not ispresent(res.recvMsg))
       
   260 	{
       
   261 		res.recvMsg := {-1,omit,{}}; // add something because there can not be omit -value
       
   262 		return res.recvMsg;
       
   263 	}
       
   264 	else
       
   265 	{
       
   266 		return res.recvMsg;
       
   267 	}
       
   268 	}
       
   269 
       
   270 function f_ctrlGetMessageWithErr ( in template ParameterList p_params ) runs on CtrlCompType return ReceivedMsg
       
   271 	{
       
   272 	var AbstractCtrlResponse res;
       
   273 	res := f_ctrlGenericRequest( "GetMessage", {}, omit, p_params );
       
   274 	
       
   275 	if ( not ispresent(res.recvMsg))
       
   276 	{
       
   277 		res.recvMsg := {-1,omit,{}}; // add something because there can not be omit -value
       
   278 		res.recvMsg.respCode := 200;
       
   279 	}
       
   280 	return res.recvMsg;
       
   281 	}
       
   282 
       
   283 function f_ctrlGetMessageWithResponse ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   284 	{
       
   285 	var AbstractCtrlResponse res;
       
   286 	res := f_ctrlGenericRequest( "GetMessage", {}, omit, p_params );
       
   287 	return res;
       
   288 	}
       
   289 
       
   290 function f_ctrlGetMessageAndCreateAssoc ( in template ParameterList p_params ) runs on CtrlCompType return ReceivedMsg
       
   291 	{
       
   292 	var AbstractCtrlResponse res;
       
   293 	res := f_ctrlGenericRequest( "GetMessageAndCreateAssoc", {}, omit, p_params );
       
   294 
       
   295 	if ( not ispresent(res.recvMsg))
       
   296 	{
       
   297 		res.recvMsg := {-1,omit,{}}; // add something because there can not be omit -value
       
   298 		return res.recvMsg;
       
   299 	}
       
   300 	else
       
   301 	{
       
   302 		return res.recvMsg;
       
   303 	}
       
   304 	}
       
   305 
       
   306 function f_ctrlGetMessageWithResponseWithConnId ( in template ParameterList p_params, in template TestClientIdList p_ids  ) runs on CtrlCompType return AbstractCtrlResponse
       
   307 	{
       
   308 	var AbstractCtrlResponse res;
       
   309 	res := f_ctrlGenericRequest( "GetMessage", {}, p_ids, p_params );
       
   310 	return res;
       
   311 	}
       
   312 
       
   313 function f_ctrlGetOutboundProxy ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   314 	{
       
   315 	var AbstractCtrlResponse res;
       
   316 	res := f_ctrlGenericRequest( "GetOutboundProxy", {}, p_ids, omit );
       
   317 	return f_ctrlGetParameter( res, a_ctrlAddress( ? ) );
       
   318 	}
       
   319 
       
   320 function f_ctrlGetRefresh (	in template TestClientIdList	p_ids ) runs on CtrlCompType
       
   321 	{
       
   322 	f_ctrlGenericRequest( "GetRefresh", {}, p_ids, omit );
       
   323 	}
       
   324 
       
   325 function f_ctrlGetRefreshState ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   326 	{
       
   327 	var AbstractCtrlResponse res;
       
   328 	res := f_ctrlGenericRequest( "GetRefreshState", {}, p_ids, omit );
       
   329 	return f_ctrlGetParameter( res, a_ctrlRefreshState( ? ) );
       
   330 	}
       
   331 
       
   332 function f_ctrlGetRegistrationAOR ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   333 	{
       
   334 	var AbstractCtrlResponse res;
       
   335 	res := f_ctrlGenericRequest( "GetRegistrationAOR", {}, p_ids, omit );
       
   336 	return f_ctrlGetParameter( res, a_ctrlAddress( ? ) );
       
   337 	}
       
   338 	
       
   339 
       
   340 function f_ctrlGetSecurityMechanisms () runs on CtrlCompType return ValueList
       
   341 	{
       
   342 	var AbstractCtrlResponse res;
       
   343 	res := f_ctrlGenericRequest( "GetSecurityMechanisms", {}, omit, omit );
       
   344 	return f_ctrlGetArray( res, a_ctrlSecurityMechanisms( ? ) );
       
   345 	}
       
   346 
       
   347 function f_ctrlGetSigCompCompartmentCount () runs on CtrlCompType return integer
       
   348 	{
       
   349 	var AbstractCtrlResponse res;
       
   350 	res := f_ctrlGenericRequest( "GetSigCompCompartmentCount", {}, omit, omit );
       
   351 	return str2int( f_ctrlGetParameter( res, a_ctrlCompartmentCount( ? ) ) );
       
   352 	}
       
   353 
       
   354 function f_ctrlGetTransactionType ( in template TestClientIdList p_ids ) runs on CtrlCompType return charstring
       
   355 	{
       
   356 	var AbstractCtrlResponse res;
       
   357 	res := f_ctrlGenericRequest( "GetTransactionType", {}, p_ids, omit );
       
   358 	return f_ctrlGetParameter( res, a_ctrlTransactionType( ? ) );
       
   359 	}
       
   360 
       
   361 //
       
   362 // -- IsXXX functions ---------------------------------------------------------
       
   363 //
       
   364 
       
   365 function f_ctrlIsClientTransaction ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   366 	{
       
   367 	return f_ctrlBooleanRequest( "IsClientTransaction", p_ids );
       
   368 	}
       
   369 
       
   370 function f_ctrlIsCancelAllowed ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   371 	{
       
   372 	return f_ctrlBooleanRequest( "IsCancelAllowed", p_ids );
       
   373 	}
       
   374 
       
   375 function f_ctrlIsContextActive ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   376 	{
       
   377 	return f_ctrlBooleanRequest( "IsContextActive", p_ids );
       
   378 	}
       
   379 
       
   380 function f_ctrlIsDialogAssociated ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   381 	{
       
   382 	return f_ctrlBooleanRequest( "IsDialogAssociated", p_ids );
       
   383 	}
       
   384 
       
   385 function f_ctrlIsResponseAllowed ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   386 	{
       
   387 	return f_ctrlBooleanRequest( "IsResponseAllowed", p_ids );
       
   388 	}
       
   389 
       
   390 function f_ctrlIsSigCompSupported ( in template TestClientIdList p_ids ) runs on CtrlCompType return boolean
       
   391 	{
       
   392 	return f_ctrlBooleanRequest( "IsSigCompSupported", p_ids );
       
   393 	}
       
   394 
       
   395 //
       
   396 // -- SendXXX functions -------------------------------------------------------
       
   397 //
       
   398 
       
   399 function f_ctrlSendAck (	in ValueList					p_headers,
       
   400 							in template TestClientIdList	p_ids,
       
   401 							in template ParameterList		p_params ) runs on CtrlCompType
       
   402 	{
       
   403 	f_ctrlGenericRequest( "SendAck", p_headers, p_ids, p_params );
       
   404 	}
       
   405 
       
   406 function f_ctrlSendBye (	in ValueList					p_headers,
       
   407 							in template TestClientIdList	p_ids,
       
   408 							in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   409 	{
       
   410 	return f_ctrlGenericRequest( "SendBye", p_headers, p_ids, p_params );
       
   411 	}
       
   412 
       
   413 function f_ctrlSendCancel ( in template TestClientIdList p_ids ) runs on CtrlCompType return AbstractCtrlResponse
       
   414 	{
       
   415 	var AbstractCtrlResponse res;
       
   416 	res := f_ctrlGenericRequest( "SendCancel", {}, p_ids, omit );
       
   417 	return res;
       
   418 	}
       
   419 
       
   420 group requestFunctionsWithURIHandling {
       
   421 
       
   422 
       
   423 	function f_ctrlSendInvite(in ValueList					p_headers,
       
   424 							  in template TestClientIdList	p_ids,
       
   425 							  in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   426 	{	
       
   427 		var ParameterList v_parameterListConstruction;
       
   428 
       
   429 		if ( mp_remoteURIMandatory ) {
       
   430 			if ( valueof(p_params) == omit ) {
       
   431 				return f_ctrlGenericRequest( "SendInvite", p_headers, p_ids, valueof(a_ctrlInviteParamsMandatory) );
       
   432 			} else {
       
   433 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   434 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlInviteParamsMandatory)));
       
   435 				return f_ctrlGenericRequest( "SendInvite", p_headers, p_ids, v_parameterListConstruction );
       
   436 			}
       
   437 		} else {
       
   438 			return f_ctrlGenericRequest( "SendInvite", p_headers, p_ids, p_params );
       
   439 		}
       
   440 	}
       
   441 
       
   442 
       
   443 	function f_ctrlSendMessage (	in ValueList					p_headers,
       
   444 									in template TestClientIdList	p_ids,
       
   445 									in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   446 	{
       
   447 		var ParameterList v_parameterListConstruction;
       
   448 
       
   449 		if ( mp_remoteURIMandatory ) {
       
   450 			if ( valueof(p_params) == omit ) {
       
   451 				return f_ctrlGenericRequest( "SendMessage", p_headers, p_ids, valueof(a_ctrlMessageParamsMandatory) );
       
   452 			} else {
       
   453 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   454 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlMessageParamsMandatory)));
       
   455 				return f_ctrlGenericRequest( "SendMessage", p_headers, p_ids, v_parameterListConstruction );
       
   456 			}
       
   457 		} else {
       
   458 			return f_ctrlGenericRequest( "SendMessage", p_headers, p_ids, p_params );
       
   459 		}
       
   460 	}
       
   461 
       
   462 
       
   463 	function f_ctrlSendRequest (in ValueList					p_headers,
       
   464 								in template TestClientIdList	p_ids,
       
   465 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   466 	{
       
   467 		var ParameterList v_parameterListConstruction;
       
   468 
       
   469 		if ( mp_remoteURIMandatory ) {
       
   470 			if ( valueof(p_params) == omit ) {
       
   471 				return f_ctrlGenericRequest( "SendRequest", p_headers, p_ids, valueof(a_ctrlRequestParamsMandatory) );
       
   472 			} else {
       
   473 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   474 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlRequestParamsMandatory)));
       
   475 				return f_ctrlGenericRequest( "SendRequest", p_headers, p_ids, v_parameterListConstruction );
       
   476 			}
       
   477 		} else {
       
   478 			return f_ctrlGenericRequest( "SendRequest", p_headers, p_ids, p_params );
       
   479 		}
       
   480 	}
       
   481 
       
   482 	function f_ctrlFetchRegistrations ( in ValueList					p_headers,
       
   483 									  	in template TestClientIdList	p_ids,
       
   484 										in template ParameterList		p_params  ) runs on CtrlCompType return AbstractCtrlResponse
       
   485 	{
       
   486 		var ParameterList v_parameterListConstruction;
       
   487 
       
   488 		if ( mp_remoteURIMandatory ) {
       
   489 			if ( valueof(p_params) == omit ) {
       
   490 				return f_ctrlGenericRequest( "FetchRegistrations", p_headers, p_ids, valueof(a_ctrlFetchRegistrationParamsMandatory) );
       
   491 			} else {
       
   492 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   493 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlFetchRegistrationParamsMandatory)));
       
   494 				return f_ctrlGenericRequest( "FetchRegistrations", p_headers, p_ids, v_parameterListConstruction );
       
   495 			}
       
   496 		} else {
       
   497 			return f_ctrlGenericRequest( "FetchRegistrations", p_headers, p_ids, p_params );
       
   498 		}
       
   499 	}
       
   500 
       
   501 	function f_ctrlSendSubscribe (	in ValueList					p_headers,
       
   502 									in template TestClientIdList	p_ids,
       
   503 									in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   504 	{
       
   505 		var ParameterList v_parameterListConstruction;
       
   506 
       
   507 		if ( mp_remoteURIMandatory ) {
       
   508 			if ( valueof(p_params) == omit ) {
       
   509 				return f_ctrlGenericRequest( "SendSubscribe", p_headers, p_ids, valueof(a_ctrlSubscribeParamsMandatory) );
       
   510 			} else {
       
   511 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   512 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlSubscribeParamsMandatory)));
       
   513 				return f_ctrlGenericRequest( "SendSubscribe", p_headers, p_ids, v_parameterListConstruction );
       
   514 			}
       
   515 		} else {
       
   516 			return f_ctrlGenericRequest( "SendSubscribe", p_headers, p_ids, p_params );
       
   517 		}
       
   518 	}	
       
   519 
       
   520 function f_ctrlSendRefer (	in ValueList					p_headers,
       
   521 				in template TestClientIdList	p_ids,
       
   522 				in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   523 	{	
       
   524 		var ParameterList v_parameterListConstruction;
       
   525 
       
   526 		if ( mp_remoteURIMandatory ) {
       
   527 			if ( valueof(p_params) == omit ) {
       
   528 				return f_ctrlGenericRequest( "SendRefer", p_headers, p_ids, valueof(a_ctrlReferParamsMandatory) );
       
   529 			} else {
       
   530 				// Parameters must be inserted into variable before sending to ctrlGenericRequest
       
   531 				v_parameterListConstruction := valueof(f_constructParameters(valueof(p_params),valueof(a_ctrlReferParamsMandatory)));
       
   532 				return f_ctrlGenericRequest( "SendRefer", p_headers, p_ids, v_parameterListConstruction );
       
   533 			}
       
   534 		} else {
       
   535 
       
   536 			return f_ctrlGenericRequest( "SendRefer", p_headers, p_ids, p_params );
       
   537 		}
       
   538 		
       
   539 	}
       
   540 
       
   541 
       
   542 }	// End of group requestFunctionsWithURIHandling
       
   543 
       
   544 
       
   545 function f_ctrlSendInviteUsingProfile (	in ValueList p_headers,
       
   546 							in template TestClientIdList	p_ids,
       
   547 							in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   548 	{	
       
   549 		return f_ctrlGenericRequest( "SendInviteUsingProfile", p_headers, p_ids, p_params );
       
   550 	}
       
   551 
       
   552 function f_ctrlSendInviteWithinDriver (	in ValueList					p_headers,
       
   553 										in template TestClientIdList	p_ids,
       
   554 										in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   555 	{
       
   556 	return f_ctrlGenericRequest( "SendInviteWithinDriver", p_headers, p_ids, p_params );
       
   557 	}
       
   558 
       
   559 function f_ctrlSendInviteWithinDialog (	in ValueList					p_headers,
       
   560 										in template TestClientIdList	p_ids,
       
   561 										in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   562 	{
       
   563 	var AbstractCtrlResponse res;
       
   564 	res := 	f_ctrlGenericRequest( "SendInviteWithinDialog", p_headers, p_ids, p_params );
       
   565 	return res;
       
   566 	}
       
   567 
       
   568 function f_ctrlSendNotify (	in template TestClientIdList	p_ids) runs on CtrlCompType return AbstractCtrlResponse
       
   569 	{	
       
   570 		return f_ctrlGenericRequest( "SendNotify", {}, p_ids, omit );
       
   571 	}
       
   572 
       
   573 function f_ctrlSendReferWithinDialog (	in ValueList					p_headers,
       
   574 										in template TestClientIdList	p_ids,
       
   575 										in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   576 	{
       
   577 	var AbstractCtrlResponse res;
       
   578 	res := 	f_ctrlGenericRequest( "SendReferWithinDialog", p_headers, p_ids, p_params );
       
   579 	return res;
       
   580 	}
       
   581 
       
   582 function f_ctrlSendReferResponseCreateDialog (	in ValueList					p_headers,
       
   583 											in template TestClientIdList	p_ids,
       
   584 											in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   585 	{	
       
   586 		var AbstractCtrlResponse res;
       
   587 		res := f_ctrlGenericRequest( "SendReferResponseCreateDialog", p_headers, p_ids, p_params );
       
   588 		return res;
       
   589 	}	
       
   590 
       
   591 
       
   592 function f_ctrlSendNonTargetRefreshRequest ( in ValueList					p_headers,
       
   593 										     in template TestClientIdList	p_ids,
       
   594 										     in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   595 	{
       
   596 	var AbstractCtrlResponse res;
       
   597 	res := f_ctrlGenericRequest( "SendNonTargetRefreshRequest", p_headers, p_ids, p_params );
       
   598 	return res;
       
   599 	}
       
   600 
       
   601 
       
   602 function f_ctrlSendPrack (	in ValueList					p_headers,
       
   603 								in template TestClientIdList	p_ids,
       
   604 								in template ParameterList		p_params ) runs on CtrlCompType  return AbstractCtrlResponse
       
   605 	{
       
   606 	var AbstractCtrlResponse res;
       
   607 	res := f_ctrlGenericRequest( "SendPrack", p_headers, p_ids, p_params );
       
   608 	return res;
       
   609 	}
       
   610 
       
   611 function f_ctrlSendRegister (	in ValueList					p_headers,
       
   612 								in template TestClientIdList	p_ids,
       
   613 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   614 	{
       
   615 	var AbstractCtrlResponse res;
       
   616 	res := f_ctrlGenericRequest( "SendRegister", p_headers, p_ids, p_params );
       
   617 	return res;
       
   618 	}
       
   619 
       
   620 function f_ctrlSendResponse (	in ValueList					p_headers,
       
   621 								in template TestClientIdList	p_ids,
       
   622 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   623 	{
       
   624 	var AbstractCtrlResponse res;
       
   625 	res := f_ctrlGenericRequest( "SendResponse", p_headers, p_ids, p_params );
       
   626 	return res;
       
   627 	}
       
   628 
       
   629 function f_ctrlSendResponseCreateAssoc (	in ValueList					p_headers,
       
   630 								in template TestClientIdList	p_ids,
       
   631 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   632 	{
       
   633 	return f_ctrlGenericRequest( "SendResponseCreateAssoc", p_headers, p_ids, p_params );
       
   634 	}
       
   635 
       
   636 function f_ctrlCreateInviteDialogAssociation ( in template TestClientIdList	p_ids ) runs on CtrlCompType return AbstractCtrlResponse
       
   637 	{
       
   638 	return f_ctrlGenericRequest( "CreateInviteDialogAssociation", omit, p_ids, omit );
       
   639 	}
       
   640 	
       
   641 function f_ctrlCreateNotifyAssoc (	in ValueList					p_headers,
       
   642 								in template TestClientIdList	p_ids,
       
   643 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   644 	{
       
   645 	return f_ctrlGenericRequest( "CreateNotifyDialogAssociation", p_headers, p_ids, p_params );
       
   646 	}
       
   647 
       
   648 
       
   649 function f_ctrlSendResponseCreateDialog (	in ValueList					p_headers,
       
   650 											in template TestClientIdList	p_ids,
       
   651 											in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   652 	{	
       
   653 		var AbstractCtrlResponse res;
       
   654 		res := f_ctrlGenericRequest( "SendResponseCreateDialog", p_headers, p_ids, p_params );
       
   655 		return res;
       
   656 	}
       
   657 	
       
   658 function f_ctrlUpdateInvite (	in ValueList					p_headers,
       
   659 									in template TestClientIdList	p_ids,
       
   660 									in template ParameterList		p_params ) runs on CtrlCompType
       
   661 	{
       
   662 	f_ctrlGenericRequest( "UpdateInvite", p_headers, p_ids, p_params );
       
   663 	}
       
   664 
       
   665 function f_ctrlUpdateRefer(	in ValueList					p_headers,
       
   666 									in template TestClientIdList	p_ids,
       
   667 									in template ParameterList		p_params ) runs on CtrlCompType
       
   668 	{
       
   669 	f_ctrlGenericRequest( "UpdateRefer", p_headers, p_ids, p_params );
       
   670 	}
       
   671 
       
   672 function f_ctrlUpdateNotify(	in ValueList					p_headers,
       
   673 									in template TestClientIdList	p_ids,
       
   674 									in template ParameterList		p_params ) runs on CtrlCompType
       
   675 	{
       
   676 	f_ctrlGenericRequest( "UpdateNotify", p_headers, p_ids, p_params );
       
   677 	}	
       
   678 
       
   679 function f_ctrlUpdateSubscribe (	in ValueList					p_headers,
       
   680 									in template TestClientIdList	p_ids,
       
   681 									in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   682 	{		
       
   683 		return f_ctrlGenericRequest( "UpdateSubscribe", p_headers, p_ids, p_params );
       
   684 	}
       
   685 
       
   686 
       
   687 // Added by jarim
       
   688 function f_ctrlSendSubscribeWithinDialog (	in ValueList					p_headers,
       
   689 											in template TestClientIdList	p_ids,
       
   690 											in template ParameterList		p_params ) runs on CtrlCompType
       
   691 	{
       
   692 	f_ctrlGenericRequest( "SendSubscribeWithinDialog", p_headers, p_ids, p_params );
       
   693 	}
       
   694 
       
   695 function f_ctrlSendUnsubscribe (	in ValueList					p_headers,
       
   696 									in template TestClientIdList	p_ids,
       
   697 									in template ParameterList		p_params ) runs on CtrlCompType
       
   698 	{
       
   699 	f_ctrlGenericRequest( "SendUnsubscribe", {}, p_ids, omit );
       
   700 	}
       
   701 
       
   702 function f_ctrlSendUpdate (	in ValueList					p_headers,
       
   703 							in template TestClientIdList	p_ids,
       
   704 							in template ParameterList		p_params ) runs on CtrlCompType
       
   705 	{
       
   706 	f_ctrlGenericRequest( "SendUpdate", {}, p_ids, omit );
       
   707 	}
       
   708 
       
   709 //
       
   710 // -- SetXXX functions --------------------------------------------------------
       
   711 //
       
   712 
       
   713 function f_ctrlSetOutboundProxy (	in template ParameterList					p_params,
       
   714 									in template TestClientIdList	p_ids ) runs on CtrlCompType
       
   715 	{
       
   716 	f_ctrlGenericRequest( "SetOutboundProxy", {}, p_ids, p_params );
       
   717 	}
       
   718 
       
   719 function f_ctrlSetSecurityParams ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   720 	{
       
   721 	return f_ctrlGenericRequest( "SetSecurityParams", {}, omit, p_params );
       
   722 	}
       
   723 
       
   724 //
       
   725 // -- UpdateXXX functions --------------------------------------------------------
       
   726 //
       
   727 
       
   728 function f_ctrlUpdateRefresh (	in ValueList					p_headers,
       
   729 								in template TestClientIdList	p_ids,
       
   730 								in template ParameterList		p_params ) runs on CtrlCompType
       
   731 	{
       
   732 	f_ctrlGenericRequest( "UpdateRefresh", p_headers, p_ids, p_params );
       
   733 	}
       
   734 
       
   735 function f_ctrlUpdateRegistration (	in ValueList					p_headers,
       
   736 									in template TestClientIdList	p_ids,
       
   737 									in template ParameterList		p_params ) runs on CtrlCompType
       
   738 	{
       
   739 	f_ctrlGenericRequest( "UpdateRegistration", p_headers, p_ids, p_params );
       
   740 	}
       
   741 
       
   742 //
       
   743 // -- Misc functions ----------------------------------------------------------
       
   744 //
       
   745 function f_ctrlDeleteFile ( in template ParameterList p_params ) runs on CtrlCompType
       
   746 	{
       
   747 	f_ctrlGenericRequest( "DeleteFile", {}, omit, p_params );
       
   748 	}
       
   749 
       
   750 function f_ctrlCreateConnection ( in template ParameterList p_params ) runs on CtrlCompType
       
   751 	{
       
   752 	f_ctrlGenericRequest( "CreateConnection", {}, omit, p_params );
       
   753 	}
       
   754 
       
   755 
       
   756 function f_ctrlInstallClient ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   757 	{
       
   758 	return f_ctrlGenericRequest( "InstallClient", {}, omit, p_params );
       
   759 	}
       
   760 	
       
   761 
       
   762 function f_ctrlTerminate ( in template TestClientIdList p_ids ) runs on CtrlCompType
       
   763 	{
       
   764 	f_ctrlGenericRequest( "Terminate", {}, p_ids, omit );
       
   765 	}
       
   766 
       
   767 function f_ctrlTerminateProcess ( in template ParameterList p_params ) runs on CtrlCompType
       
   768 	{
       
   769 	f_ctrlGenericRequest( "TerminateProcess", {}, omit, p_params );
       
   770 	}
       
   771 
       
   772 function f_ctrlUninstallClient ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   773 	{
       
   774 	return f_ctrlGenericRequest( "UninstallClient", {}, omit, p_params );
       
   775 	}
       
   776 	
       
   777 function f_ctrlUnregister ( in template TestClientIdList p_ids ) runs on CtrlCompType
       
   778 	{
       
   779 	f_ctrlGenericRequest( "Unregister", {}, p_ids, omit );
       
   780 	}
       
   781 
       
   782 
       
   783 //New Transfer File function Added by Satish
       
   784 function f_ctrlTransferFile ( in charstring p_srcFileName, charstring p_destFileName, octetstring p_fileContent  ) runs on CtrlCompType
       
   785 	{
       
   786 
       
   787 	CTRL.send( a_ctrlFileXferRequest( p_srcFileName, p_destFileName, p_fileContent ) );
       
   788 	alt {
       
   789 		[] CTRL.receive /*( a_ctrlOkResponse )*/
       
   790 			{
       
   791 			}
       
   792 		}
       
   793 
       
   794 	}	
       
   795 
       
   796 function f_ctrlGetMemoryUsage ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   797 	{
       
   798 	return f_ctrlGenericRequest( "GetMemoryUsage", {}, omit, p_params );	
       
   799 	}
       
   800 
       
   801 
       
   802 function f_ctrlGetUNSAFTimers ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   803 	{
       
   804 	return f_ctrlGenericRequest( "GetUNSAFTimers", {}, omit, p_params );
       
   805 	}
       
   806 
       
   807 
       
   808 function f_ctrlSetUNSAFTimers ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   809 	{
       
   810 	return f_ctrlGenericRequest( "SetUNSAFTimers", {}, omit, p_params );
       
   811 	}
       
   812 
       
   813 
       
   814 function f_ctrlEnableCRLFRefresh ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   815 	{
       
   816 	return f_ctrlGenericRequest( "EnableCRLFRefresh", {}, omit, p_params );
       
   817 	}
       
   818 
       
   819 
       
   820 function f_ctrlSetSTUNServer ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   821 	{
       
   822 	return f_ctrlGenericRequest( "SetSTUNServer", {}, omit, p_params );
       
   823 	}
       
   824 	
       
   825 function f_ctrlSetDomainParams ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   826 	{
       
   827 	return f_ctrlGenericRequest( "SetDomainParams", {}, omit, p_params );
       
   828 	}
       
   829 	
       
   830 function f_ctrlGetDomainParams ( in template ParameterList p_params ) runs on CtrlCompType return AbstractCtrlResponse
       
   831 	{
       
   832 	return f_ctrlGenericRequest( "GetDomainParams", {}, omit, p_params );
       
   833 	}
       
   834 
       
   835 function f_ctrlStopIAP ( in template ParameterList p_params ) runs on CtrlCompType
       
   836 	{
       
   837 	f_ctrlGenericRequest( "StopIAP", {}, omit, p_params );
       
   838 	}
       
   839 	
       
   840 
       
   841 //
       
   842 // -- Test case start & end & reset -------------------------------------------
       
   843 //
       
   844 
       
   845 function f_ctrlStartTestCase ( in charstring p_testCaseName ) runs on CtrlCompType
       
   846 	{
       
   847 	f_ctrlInit();
       
   848 
       
   849 	CTRL.send( a_ctrlStartTCRequest( p_testCaseName ) );
       
   850 	alt {
       
   851 		[] CTRL.receive( a_ctrlOkResponse )
       
   852 			{
       
   853 			}
       
   854 		}
       
   855 
       
   856 	}
       
   857 	
       
   858 function f_ctrlStartTestCase_1 (	in charstring p_testCaseName,
       
   859 								CompRefs p_compRefs  ) runs on CtrlCompType
       
   860 	{
       
   861 	f_ctrlInit_1( p_compRefs );
       
   862 
       
   863 	CTRL.send( a_ctrlStartTCRequest( p_testCaseName ) );
       
   864 	alt {
       
   865 		[] CTRL.receive( a_ctrlOkResponse )
       
   866 			{
       
   867 			}
       
   868 		}
       
   869 
       
   870 	}
       
   871 
       
   872 
       
   873 function f_ctrlEndTestCase () runs on CtrlCompType
       
   874 	{
       
   875 	CTRL.send( a_ctrlEndTCRequest( omit ) );
       
   876 	timer mytimer;
       
   877 	mytimer.start(5.0);
       
   878 	alt {
       
   879 		[] CTRL.receive( a_ctrlOkResponse )
       
   880 			{
       
   881 			}
       
   882 		[] mytimer.timeout
       
   883 			{
       
   884 				f_ctrlResetAll();
       
   885 			}
       
   886 		}
       
   887 
       
   888 	setverdict( pass );
       
   889 	stop;
       
   890 	}
       
   891 	
       
   892 function f_ctrlReset ( in integer p_objectId ) runs on CtrlCompType
       
   893 	{
       
   894 	CTRL.send( a_ctrlResetRequest( int2str( p_objectId ) ) );
       
   895 	alt {
       
   896 		[] CTRL.receive( a_ctrlOkResponse )
       
   897 			{
       
   898 			}
       
   899 		}
       
   900 
       
   901 	}
       
   902 	
       
   903 function f_ctrlStartTester (	in charstring p_testCaseName,
       
   904 								CompRefs p_compRefs  ) runs on CtrlCompType
       
   905 	{
       
   906 	//f_ctrlInitWithOnePort( p_compRefs );
       
   907 
       
   908 	CTRL.send( a_ctrlStartTCRequest( p_testCaseName ) );
       
   909 	alt {
       
   910 		[] CTRL.receive( a_ctrlOkResponse )
       
   911 			{
       
   912 			}
       
   913 		}
       
   914 
       
   915 	}
       
   916 	
       
   917 function f_ctrlEndTester () runs on CtrlCompType
       
   918 	{
       
   919 	CTRL.send( a_ctrlEndTCRequest( omit ) );
       
   920 	alt {
       
   921 		[] CTRL.receive( a_ctrlOkResponse )
       
   922 			{
       
   923 			}
       
   924 		}
       
   925 
       
   926 	}	
       
   927 	
       
   928 function f_ctrlResetAll ( ) runs on CtrlCompType
       
   929 	{
       
   930 
       
   931 	CTRL.send( a_ctrlResetRequest( omit ) );
       
   932 	alt {
       
   933 		[] CTRL.receive( a_ctrlOkResponse )
       
   934 			{
       
   935 			}
       
   936 		}
       
   937 
       
   938 	}
       
   939 
       
   940 function f_ctrlInit() runs on CtrlCompType
       
   941 	{
       
   942 
       
   943 	f_initAndMapL4rCtrlTcpIpv4();
       
   944 
       
   945 	var default defaultsRef;
       
   946 	defaultsRef := activate( defaultCTRL() );
       
   947 
       
   948 	f_syncCTRL();
       
   949 	
       
   950 	deactivate(defaultsRef); // Tero added 18.2.
       
   951 	}
       
   952 	
       
   953 function f_ctrlInit_1( CompRefs p_compRefs ) runs on CtrlCompType
       
   954 	{
       
   955 	g_v_compRefs := p_compRefs;
       
   956 	f_initAndMapL4rCtrlTcpIpv4();
       
   957 
       
   958 	var default defaultsRef;
       
   959 	defaultsRef := activate( defaultCTRL() );
       
   960 
       
   961 	f_syncCTRL();
       
   962 	
       
   963 	deactivate(defaultsRef); // Tero added 18.2.
       
   964 	}	
       
   965 
       
   966 //
       
   967 // -- Internal request wrapper functions --------------------------------------
       
   968 //
       
   969 
       
   970 function f_ctrlBooleanRequest (	in charstring p_action,
       
   971 								in template TestClientIdList	p_ids ) runs on CtrlCompType return boolean
       
   972 	{
       
   973 	var AbstractCtrlResponse res;
       
   974 	res := f_ctrlGenericRequest( p_action, {}, p_ids, omit );
       
   975 	return match( f_ctrlGetParameter( res, a_ctrlBoolean( ? ) ), a_ctrlBooleanTrue );
       
   976 	}
       
   977 
       
   978 function f_ctrlGenericRequest (	in charstring					p_action,
       
   979 								in ValueList					p_headers,
       
   980 								in template TestClientIdList	p_ids,
       
   981 								in template ParameterList		p_params ) runs on CtrlCompType return AbstractCtrlResponse 
       
   982 	{
       
   983 	
       
   984 	var AbstractCtrlResponse res;
       
   985 	CTRL.send( a_ctrlRequest( p_action, p_headers, p_ids, p_params ) );
       
   986 	alt {
       
   987 //		[] CTRL.receive( a_ctrlResponse( p_action, 0, *, *, * ) ) -> value res
       
   988 		[] CTRL.receive( a_ctrlResponse( p_action, *, *, *, * ) ) -> value res
       
   989 			{
       
   990 			// As a work-around to avoid TEMPLATE MISMATHCES in the Tau log, we're having
       
   991 			// all (or none) of the ID fields present in the messages
       
   992 			// For SIP =4.0
       
   993 
       
   994 			//HS
       
   995 			if( ispresent( res.ids ) ) {
       
   996 				if (sizeof(res.ids) == 12 ) {
       
   997 					log("12"); //HS
       
   998 					if( res.ids[ 0 ].idValue > 0 ) { v_ctrlCompState.v_connectionId := res.ids[ 0 ].idValue }
       
   999 					if( res.ids[ 1 ].idValue > 0 ) { v_ctrlCompState.v_dialogId := res.ids[ 1 ].idValue }
       
  1000 					if( res.ids[ 2 ].idValue > 0 ) { v_ctrlCompState.v_inviteDialogId := res.ids[ 2 ].idValue }
       
  1001 
       
  1002 					// New value
       
  1003 					if( res.ids[ 3 ].idValue > 0 ) { v_ctrlCompState.v_notifyDialogId := res.ids[ 3 ].idValue }
       
  1004 
       
  1005 					if( res.ids[ 4 ].idValue > 0 ) { v_ctrlCompState.v_profileId := res.ids[ 4 ].idValue }
       
  1006 
       
  1007 					// New value
       
  1008 					if( res.ids[ 5 ].idValue > 0 ) { v_ctrlCompState.v_referDialogId := res.ids[ 5 ].idValue }
       
  1009 
       
  1010 					if( res.ids[ 6 ].idValue > 0 ) { v_ctrlCompState.v_refreshId := res.ids[ 6 ].idValue }
       
  1011 					if( res.ids[ 7 ].idValue > 0 ) { v_ctrlCompState.v_registryId := res.ids[ 7 ].idValue }
       
  1012 					if( res.ids[ 8 ].idValue > 0 ) { v_ctrlCompState.v_registrationId := res.ids[ 8 ].idValue }
       
  1013 					if( res.ids[ 9 ].idValue > 0 ) { v_ctrlCompState.v_serverTransactionId := res.ids[ 9 ].idValue }
       
  1014 					if( res.ids[ 10 ].idValue > 0 ) { v_ctrlCompState.v_subscribeDialogId := res.ids[ 10 ].idValue }
       
  1015 					if( res.ids[ 11 ].idValue > 0 ) { v_ctrlCompState.v_transactionId := res.ids[ 11 ].idValue }			
       
  1016 				} else if (sizeof(res.ids) == 10 ) {
       
  1017 					log("10"); //HS
       
  1018 					if( res.ids[ 0 ].idValue > 0 ) { v_ctrlCompState.v_connectionId := res.ids[ 0 ].idValue }
       
  1019 					if( res.ids[ 1 ].idValue > 0 ) { v_ctrlCompState.v_dialogId := res.ids[ 1 ].idValue }
       
  1020 					if( res.ids[ 2 ].idValue > 0 ) { v_ctrlCompState.v_inviteDialogId := res.ids[ 2 ].idValue }
       
  1021 					if( res.ids[ 3 ].idValue > 0 ) { v_ctrlCompState.v_profileId := res.ids[ 3 ].idValue }
       
  1022 					if( res.ids[ 4 ].idValue > 0 ) { v_ctrlCompState.v_refreshId := res.ids[ 4 ].idValue }
       
  1023 
       
  1024 					// New value 29.6.2004
       
  1025 					if( res.ids[ 5 ].idValue > 0 ) { v_ctrlCompState.v_registryId := res.ids[ 5 ].idValue }
       
  1026 
       
  1027 					if( res.ids[ 6 ].idValue > 0 ) { v_ctrlCompState.v_registrationId := res.ids[ 6 ].idValue }
       
  1028 					if( res.ids[ 7 ].idValue > 0 ) { v_ctrlCompState.v_serverTransactionId := res.ids[ 7 ].idValue }
       
  1029 					if( res.ids[ 8 ].idValue > 0 ) { v_ctrlCompState.v_subscribeDialogId := res.ids[ 8 ].idValue }
       
  1030 					if( res.ids[ 9 ].idValue > 0 ) { v_ctrlCompState.v_transactionId := res.ids[ 9 ].idValue }			
       
  1031 				}
       
  1032 			} //ispresent
       
  1033 			} //receive
       
  1034 		} //alt
       
  1035 	return res;
       
  1036 	}
       
  1037 
       
  1038 //
       
  1039 // -- Internal utility functions for getting data out of responses ------------
       
  1040 //
       
  1041 
       
  1042 function f_ctrlGetParameter(	in AbstractCtrlResponse p_response,
       
  1043 								in template ParameterListElement p_param ) runs on CtrlCompType return charstring
       
  1044 	{
       
  1045 	var integer I;
       
  1046 
       
  1047 	if( ispresent( p_response.params ) ) {
       
  1048 		for( I := 0; I < sizeof( p_response.params ); I := I + 1 ) {
       
  1049 			if( match( p_response.params[ I ], p_param ) ) {
       
  1050 				return p_response.params[ I ].parameter.pValue;
       
  1051 				}
       
  1052 			}
       
  1053 		}
       
  1054 
       
  1055 	return "";
       
  1056 	}
       
  1057 
       
  1058 
       
  1059 function f_ctrlGetArray(	in AbstractCtrlResponse p_response,
       
  1060 							in template ParameterListElement p_array ) runs on CtrlCompType return ValueList
       
  1061 	{
       
  1062 	var integer I;
       
  1063 
       
  1064 	if( ispresent( p_response.params ) ) {
       
  1065 		for( I := 0; I < sizeof( p_response.params ); I := I + 1 ) {
       
  1066 			if( match( p_response.params[ I ], p_array ) ) {
       
  1067 				return p_response.params[ I ].array.aValues;
       
  1068 				}
       
  1069 			}
       
  1070 		}
       
  1071 	return {};
       
  1072 	}
       
  1073 
       
  1074 function f_ctrlGetStructure(	in AbstractCtrlResponse p_response,
       
  1075 								in template ParameterListElement p_struct ) runs on CtrlCompType return FieldList
       
  1076 	{
       
  1077 	var integer I;
       
  1078 
       
  1079 	if( ispresent( p_response.params ) ) {
       
  1080 		for( I := 0; I < sizeof( p_response.params ); I := I + 1 ) {
       
  1081 			if( match( p_response.params[ I ], p_struct ) ) {
       
  1082 				return p_response.params[ I ].struct.sFields;
       
  1083 				}
       
  1084 			}
       
  1085 		}
       
  1086 	return {};
       
  1087 	}
       
  1088 }