0
|
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 |
* Mon Oct 06 12:02:04 2003
|
|
18 |
* System Includes
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
#include <stdio.h>
|
|
27 |
|
|
28 |
|
|
29 |
/****************************************************************************************
|
|
30 |
*
|
|
31 |
* Local Includes
|
|
32 |
*
|
|
33 |
***************************************************************************************/
|
|
34 |
#include "CSvcFacontroller.h"
|
|
35 |
#include "facontroller.h"
|
|
36 |
#include "standard_service_manager.h"
|
|
37 |
|
|
38 |
|
|
39 |
/****************************************************************************************
|
|
40 |
*
|
|
41 |
* File-scope variables
|
|
42 |
*
|
|
43 |
***************************************************************************************/
|
|
44 |
static TStartupInfo iStartupInfo;
|
|
45 |
static CIntegerAllocator *iIntegerAllocator;
|
|
46 |
static CComponentManager<CSFacontroller> *iComponentManager;
|
|
47 |
|
|
48 |
|
|
49 |
/****************************************************************************************
|
|
50 |
*
|
|
51 |
* Implementation
|
|
52 |
*
|
|
53 |
***************************************************************************************/
|
|
54 |
|
|
55 |
|
|
56 |
/****************************************************************************************
|
|
57 |
*
|
|
58 |
* PUBLIC: GetInstanceKeyFromArgs
|
|
59 |
*
|
|
60 |
***************************************************************************************/
|
|
61 |
int CSvcFacontroller::GetInstanceKeyFromArgs( int aMethod, void *aArgs )
|
|
62 |
{
|
|
63 |
int rv;
|
|
64 |
int *integer_ik;
|
|
65 |
TFaTunnelID *tunnel_ik;
|
|
66 |
TOptionDesc *option_ik;
|
|
67 |
TTimeoutRequest *timeout_ik;
|
|
68 |
TStartAgentRequest *startup_ik;
|
|
69 |
TGetTunnelRequest *get_tunnel_req_ik;
|
|
70 |
|
|
71 |
switch( aMethod ) {
|
|
72 |
|
|
73 |
// Methods with a single integer argument that is the key
|
|
74 |
case DSTR_REMOVEAGENT:
|
|
75 |
case STOPMOBILEAGENT:
|
|
76 |
case GETMOBILEAGENTSTATUS:
|
|
77 |
case GETSTATUS:
|
|
78 |
case LISTTUNNELS:
|
|
79 |
integer_ik = (int*)aArgs;
|
|
80 |
rv = *integer_ik;
|
|
81 |
break;
|
|
82 |
|
|
83 |
// Methods with TOptionDesc
|
|
84 |
case SETSINGLEOPTION:
|
|
85 |
case REMOVESINGLEOPTION:
|
|
86 |
case ADDLISTOPTION:
|
|
87 |
case REMOVELISTOPTION:
|
|
88 |
option_ik = (TOptionDesc*)aArgs;
|
|
89 |
rv = option_ik->iAgentID;
|
|
90 |
break;
|
|
91 |
|
|
92 |
// TStartAgentRequest
|
|
93 |
case STARTMOBILEAGENT:
|
|
94 |
startup_ik = (TStartAgentRequest*)aArgs;
|
|
95 |
rv = startup_ik->iAgentID;
|
|
96 |
break;
|
|
97 |
|
|
98 |
// Tunnel ID
|
|
99 |
case DESTROYTUNNELID:
|
|
100 |
tunnel_ik = (TFaTunnelID*)aArgs;
|
|
101 |
rv = tunnel_ik->iAgentID;
|
|
102 |
break;
|
|
103 |
|
|
104 |
// Timeout
|
|
105 |
case SETTIMEOUT:
|
|
106 |
timeout_ik = (TTimeoutRequest*)aArgs;
|
|
107 |
rv = timeout_ik->iAgentID;
|
|
108 |
break;
|
|
109 |
|
|
110 |
// TGetTunnelRequest
|
|
111 |
case GETTUNNELINFO:
|
|
112 |
get_tunnel_req_ik = (TGetTunnelRequest*)aArgs;
|
|
113 |
rv = get_tunnel_req_ik->iAgentID;
|
|
114 |
break;
|
|
115 |
|
|
116 |
// error
|
|
117 |
default:
|
|
118 |
rv = ERR_INVALID_METHOD;
|
|
119 |
break;
|
|
120 |
}
|
|
121 |
return rv;
|
|
122 |
}
|
|
123 |
|
|
124 |
|
|
125 |
/****************************************************************************************
|
|
126 |
*
|
|
127 |
* PUBLIC: SetError
|
|
128 |
*
|
|
129 |
***************************************************************************************/
|
|
130 |
int CSvcFacontroller::SetError( int aMethod, void *aArgs, int aError )
|
|
131 |
{
|
|
132 |
int rv = ERR_NONE;
|
|
133 |
TResult *result_rv;
|
|
134 |
TComponentList *result_cl;
|
|
135 |
TFaStatusInfo *result_fs;
|
|
136 |
TFaTunnelList *result_tl;
|
|
137 |
TFaTunnelInfo *result_ti;
|
|
138 |
|
|
139 |
switch( aMethod ) {
|
|
140 |
|
|
141 |
// TResult
|
|
142 |
case CSTR_CREATEAGENT:
|
|
143 |
case STARTMOBILEAGENT:
|
|
144 |
case STOPMOBILEAGENT:
|
|
145 |
case SETSINGLEOPTION:
|
|
146 |
case REMOVESINGLEOPTION:
|
|
147 |
case ADDLISTOPTION:
|
|
148 |
case REMOVELISTOPTION:
|
|
149 |
case DESTROYTUNNELID:
|
|
150 |
SET_ERROR_CODE( TResult, iServiceResult, result_rv );
|
|
151 |
break;
|
|
152 |
|
|
153 |
// TComponent
|
|
154 |
case LIST_DEVICES:
|
|
155 |
SET_LIST_ERROR_CODE( TComponentList, result_cl );
|
|
156 |
break;
|
|
157 |
|
|
158 |
// TFaStatusInfo
|
|
159 |
case GETSTATUS:
|
|
160 |
SET_ERROR_CODE( TFaStatusInfo, iCallResult.iServiceResult, result_fs );
|
|
161 |
break;
|
|
162 |
|
|
163 |
// TFaTunnelList
|
|
164 |
case LISTTUNNELS:
|
|
165 |
SET_LIST_ERROR_CODE( TFaTunnelList, result_tl );
|
|
166 |
break;
|
|
167 |
|
|
168 |
// TFaTunnelInfo
|
|
169 |
case GETTUNNELINFO:
|
|
170 |
SET_ERROR_CODE( TFaTunnelInfo, iCallResult.iServiceResult, result_ti );
|
|
171 |
break;
|
|
172 |
|
|
173 |
// error
|
|
174 |
default:
|
|
175 |
rv = ERR_INVALID_METHOD;
|
|
176 |
break;
|
|
177 |
}
|
|
178 |
|
|
179 |
// done
|
|
180 |
return rv;
|
|
181 |
}
|
|
182 |
|
|
183 |
|
|
184 |
/****************************************************************************************
|
|
185 |
*
|
|
186 |
* PUBLIC: GetError - Currently this methods will only ever be caleld for CSTR_CREATEAGENT
|
|
187 |
*
|
|
188 |
***************************************************************************************/
|
|
189 |
int CSvcFacontroller::GetError( int aMethod, void *aArgs )
|
|
190 |
{
|
|
191 |
TResult *result;
|
|
192 |
|
|
193 |
// check assumption
|
|
194 |
assert( aMethod == CSTR_CREATEAGENT );
|
|
195 |
|
|
196 |
// return error code
|
|
197 |
result = (TResult*)aArgs;
|
|
198 |
return result->iServiceResult;
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
/****************************************************************************************
|
|
203 |
*
|
|
204 |
* PUBLIC: StartRPCService
|
|
205 |
*
|
|
206 |
***************************************************************************************/
|
|
207 |
int CSvcFacontroller::StartRPCService( CComponentManager<CSFacontroller> *aComponentManager, void *aArg )
|
|
208 |
{
|
|
209 |
int err;
|
|
210 |
|
|
211 |
// save the passed args
|
|
212 |
iStartupInfo = *((TStartupInfo*)aArg);
|
|
213 |
|
|
214 |
// create the component manager
|
|
215 |
assert( iComponentManager == NULL );
|
|
216 |
iComponentManager = aComponentManager;
|
|
217 |
|
|
218 |
// setup the integer allocator
|
|
219 |
iIntegerAllocator = new CIntegerAllocator();
|
|
220 |
assert( iIntegerAllocator != NULL );
|
|
221 |
err = iIntegerAllocator->AddToIntegerPool( iStartupInfo.iStartHostAddressRange, iStartupInfo.iStopHostAddressRange );
|
|
222 |
if( err == -1 ) {
|
|
223 |
delete iIntegerAllocator;
|
|
224 |
iIntegerAllocator = NULL;
|
|
225 |
return ERR_INTEGER_ALLOCATOR_SETUP_ERROR;
|
|
226 |
}
|
|
227 |
return ERR_NONE;
|
|
228 |
}
|
|
229 |
|
|
230 |
|
|
231 |
/****************************************************************************************
|
|
232 |
*
|
|
233 |
* PUBLIC: StopRPCService
|
|
234 |
*
|
|
235 |
***************************************************************************************/
|
|
236 |
int CSvcFacontroller::StopRPCService()
|
|
237 |
{
|
|
238 |
// cleanup the integer allocator
|
|
239 |
delete iIntegerAllocator;
|
|
240 |
iIntegerAllocator = NULL;
|
|
241 |
|
|
242 |
// cleanup the component manager (stubs do the deletion)
|
|
243 |
iComponentManager = NULL;
|
|
244 |
return ERR_NONE;
|
|
245 |
}
|
|
246 |
|
|
247 |
|
|
248 |
/****************************************************************************************
|
|
249 |
*
|
|
250 |
* PUBLIC: GetStartupInfo
|
|
251 |
*
|
|
252 |
***************************************************************************************/
|
|
253 |
TStartupInfo CSvcFacontroller::GetStartupInfo()
|
|
254 |
{
|
|
255 |
return iStartupInfo;
|
|
256 |
}
|
|
257 |
|
|
258 |
|
|
259 |
/****************************************************************************************
|
|
260 |
*
|
|
261 |
* PUBLIC: GetIntegerAllocator
|
|
262 |
*
|
|
263 |
***************************************************************************************/
|
|
264 |
CIntegerAllocator *CSvcFacontroller::GetIntegerAllocator()
|
|
265 |
{
|
|
266 |
return iIntegerAllocator;
|
|
267 |
}
|