testexecmgmt/ucc/Source/mncontroller/CSvcMncontroller.cpp
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   
       
    15 * This file was autogenerated by rpcgen, but should be modified by the developer.
       
    16 * Make sure you don't use the -component_mod flag in future or this file will be overwritten.
       
    17 * Wed Oct 01 17:43:02 2003
       
    18 * System Includes
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #include <stdio.h>
       
    26 
       
    27 
       
    28 /****************************************************************************************
       
    29  * 
       
    30  * Local Includes
       
    31  * 
       
    32  ***************************************************************************************/
       
    33 #include "CSvcMncontroller.h"
       
    34 #include "mncontroller.h"
       
    35 #include "standard_service_manager.h"
       
    36 
       
    37 
       
    38 /****************************************************************************************
       
    39  * 
       
    40  * File-scope variables
       
    41  * 
       
    42  ***************************************************************************************/
       
    43 static CComponentManager<CSMncontroller> *iComponentManager;
       
    44 
       
    45 
       
    46 /****************************************************************************************
       
    47  * 
       
    48  * Implementation
       
    49  * 
       
    50  ***************************************************************************************/
       
    51 
       
    52 
       
    53 /****************************************************************************************
       
    54  * 
       
    55  * PUBLIC: GetInstanceKeyFromArgs
       
    56  * 
       
    57  ***************************************************************************************/
       
    58 int CSvcMncontroller::GetInstanceKeyFromArgs( int aMethod, void *aArgs )
       
    59 {
       
    60 	int rv;
       
    61 	int *integer_ik;
       
    62 	TOptionDesc *option_ik;
       
    63 	TTunnelingModeDesc *tunnel_mode_ik;
       
    64 	TPolicyRequest *policy_ik;
       
    65 	TTimeoutRequest *timeout_ik;
       
    66 	TForeignAgentInfoRequest *fa_info_ik;
       
    67 	THomeAddressDesc *home_address_desc_ik;
       
    68 
       
    69 	switch( aMethod ) {
       
    70 
       
    71 	// Handle cases where there is an integer argument that is the instance key
       
    72 	case DSTR_REMOVEAGENT:
       
    73 	case STARTMOBILEAGENT:
       
    74 	case STOPMOBILEAGENT:
       
    75 	case GETMOBILEAGENTSTATUS:
       
    76 	case GETCAREOFADDRESS:
       
    77 	case DISCONNECT:
       
    78 	case CONFIRM:
       
    79 	case RESCANINTERFACES:
       
    80 	case GETFAPOLICY:
       
    81 	case GETSTATUS:
       
    82 	case LISTFOREIGNAGENTS:
       
    83 		integer_ik = (int*)aArgs;
       
    84 		rv = *integer_ik;
       
    85 		break;
       
    86 
       
    87 	// Handle options
       
    88 	case SETSINGLEOPTION:
       
    89 	case REMOVESINGLEOPTION:
       
    90 	case ADDLISTOPTION:
       
    91 	case REMOVELISTOPTION:
       
    92 		option_ik = (TOptionDesc*)aArgs;
       
    93 		rv = option_ik->iAgentID;
       
    94 		break;
       
    95 
       
    96 	// THomeAddressDesc
       
    97 	case SETHOMEADDRESS:
       
    98 		home_address_desc_ik = (THomeAddressDesc*)aArgs;
       
    99 		rv = home_address_desc_ik->iAgentID;
       
   100 		break;
       
   101 
       
   102 	// TForeignAgentInfoRequest
       
   103 	case GETFOREIGNAGENTINFO:
       
   104 		fa_info_ik = (TForeignAgentInfoRequest*)aArgs;
       
   105 		rv = fa_info_ik->iAgentID;
       
   106 		break;
       
   107 
       
   108 	// Connect
       
   109 	case CONNECT:
       
   110 		tunnel_mode_ik = (TTunnelingModeDesc*)aArgs;
       
   111 		rv = tunnel_mode_ik->iAgentID;
       
   112 		break;
       
   113 
       
   114 	// Policy
       
   115 	case SETFAPOLICY:
       
   116 		policy_ik = (TPolicyRequest*)aArgs;
       
   117 		rv = policy_ik->iAgentID;
       
   118 		break;
       
   119 
       
   120 	// Timeout
       
   121 	case SETTIMEOUT:
       
   122 		timeout_ik = (TTimeoutRequest*)aArgs;
       
   123 		rv = timeout_ik->iAgentID;
       
   124 		break;
       
   125 
       
   126 	// Default
       
   127 	default:
       
   128 		rv = ERR_INVALID_METHOD;
       
   129 		break;
       
   130 	}
       
   131 	return rv;
       
   132 }
       
   133 
       
   134 
       
   135 /****************************************************************************************
       
   136  * 
       
   137  * PUBLIC: SetError
       
   138  * 
       
   139  ***************************************************************************************/
       
   140 int CSvcMncontroller::SetError( int aMethod, void *aArgs, int aError )
       
   141 {
       
   142 	int rv = ERR_NONE;
       
   143 	TResult *result_rv;
       
   144 	TComponentList *result_cl;
       
   145 	TForeignAgentList *result_fal;
       
   146 	TForeignAgentInfo *result_fai;
       
   147 	TMobileNodeStatus *result_status;
       
   148 
       
   149 	switch( aMethod ) {
       
   150 
       
   151 	// Handle the TResult case
       
   152 	case CSTR_CREATEAGENT:
       
   153 	case STARTMOBILEAGENT:
       
   154 	case STOPMOBILEAGENT:
       
   155 	case GETMOBILEAGENTSTATUS:
       
   156 	case SETSINGLEOPTION:
       
   157 	case REMOVESINGLEOPTION:
       
   158 	case ADDLISTOPTION:
       
   159 	case REMOVELISTOPTION:
       
   160 	case SETHOMEADDRESS:
       
   161 	case SETFAPOLICY:
       
   162 	case GETFAPOLICY:
       
   163 	case CONNECT:
       
   164 	case DISCONNECT:
       
   165 	case CONFIRM:
       
   166 	case RESCANINTERFACES:
       
   167 	case GETCAREOFADDRESS:
       
   168 		SET_ERROR_CODE( TResult, iServiceResult, result_rv );
       
   169 		break;
       
   170 
       
   171 	// Handle TMobileNodeStatus
       
   172 	case GETSTATUS:
       
   173 		result_status = (TMobileNodeStatus*)aArgs;
       
   174 		memset( result_status, 0, sizeof(*result_status) );
       
   175 		(result_status->iCallResult).iServiceResult = aError;
       
   176 		break;
       
   177 
       
   178 	// Handle ListDevices
       
   179 	case LIST_DEVICES:
       
   180 	    SET_LIST_ERROR_CODE( TComponentList, result_cl );
       
   181 		break;
       
   182 
       
   183 	// List Foreign Agents	
       
   184 	case LISTFOREIGNAGENTS:
       
   185 	    SET_LIST_ERROR_CODE( TForeignAgentList, result_fal );
       
   186 		break;
       
   187 
       
   188 	// Foreign agent info
       
   189 	case GETFOREIGNAGENTINFO:
       
   190 		result_fai = (TForeignAgentInfo*)aArgs;
       
   191 		memset( result_fai, 0, sizeof(*result_fai) );
       
   192 		(result_fai->iCallResult).iServiceResult = aError;
       
   193 		break;
       
   194 
       
   195 	// Default
       
   196 	default:
       
   197 		rv = ERR_INVALID_METHOD;
       
   198 		break;
       
   199 	}
       
   200 	return rv;
       
   201 }
       
   202 
       
   203 
       
   204 /****************************************************************************************
       
   205  * 
       
   206  * PUBLIC: GetError
       
   207  * 
       
   208  ***************************************************************************************/
       
   209 int CSvcMncontroller::GetError( int aMethod, void *aArgs )
       
   210 {
       
   211 	TResult *result;
       
   212 
       
   213 	// check assumption
       
   214 	assert( aMethod == CSTR_CREATEAGENT );
       
   215 
       
   216 	// return error code
       
   217 	result = (TResult*)aArgs;
       
   218 	return result->iServiceResult;
       
   219 }
       
   220 
       
   221 
       
   222 /****************************************************************************************
       
   223  * 
       
   224  * PUBLIC: StartRPCService
       
   225  * 
       
   226  ***************************************************************************************/
       
   227 int CSvcMncontroller::StartRPCService( CComponentManager<CSMncontroller> *aComponentManager, void *aArg )
       
   228 {
       
   229 	assert( iComponentManager == NULL );
       
   230 	iComponentManager = aComponentManager;
       
   231 	return ERR_NONE;
       
   232 }
       
   233 
       
   234 
       
   235 /****************************************************************************************
       
   236  * 
       
   237  * PUBLIC: StopRPCService
       
   238  * 
       
   239  ***************************************************************************************/
       
   240 int CSvcMncontroller::StopRPCService()
       
   241 {
       
   242 	iComponentManager = NULL;
       
   243 	return ERR_NONE;
       
   244 }