|
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 IS AUTOGENERATED. Do not modify the contents of this file directly |
|
16 * as changes will be lost |
|
17 * Fri Nov 07 13:08:01 2003 |
|
18 * System Includes |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #include <assert.h> |
|
27 |
|
28 |
|
29 /**************************************************************************************** |
|
30 * |
|
31 * Local Includes |
|
32 * |
|
33 ***************************************************************************************/ |
|
34 #include "CSvcFacontroller.h" |
|
35 #include "CSFacontroller.h" |
|
36 #include "CComponentManager.h" |
|
37 |
|
38 |
|
39 /**************************************************************************************** |
|
40 * |
|
41 * Static Variables |
|
42 * |
|
43 ***************************************************************************************/ |
|
44 static CComponentManager<CSFacontroller> *iComponentManager; |
|
45 |
|
46 |
|
47 /**************************************************************************************** |
|
48 * |
|
49 * PUBLIC FUNCTION: ss_startuprpcservice |
|
50 * |
|
51 ***************************************************************************************/ |
|
52 int *ss_startuprpcservice_7( TStartupInfo *aArgs, CLIENT *aDutout ) |
|
53 { |
|
54 static int rv; |
|
55 |
|
56 // if the service is already started then return an error |
|
57 if( iComponentManager != NULL ) { |
|
58 rv = ERR_SERVICE_ALREADY_STARTED; |
|
59 return &rv; |
|
60 } |
|
61 |
|
62 // create the component manager |
|
63 iComponentManager = new CComponentManager<CSFacontroller>( INFO_MAXIMUM_OBJECTS ); |
|
64 if( iComponentManager == NULL ) { |
|
65 rv = ERR_FAILED_TO_CREATE_COMPONENT_MANAGER; |
|
66 return &rv; |
|
67 } |
|
68 |
|
69 // call the custom service manager |
|
70 rv = CSvcFacontroller::StartRPCService( iComponentManager, aArgs ); |
|
71 if( rv != ERR_NONE ) { |
|
72 delete iComponentManager; |
|
73 iComponentManager = NULL; |
|
74 return &rv; |
|
75 } |
|
76 |
|
77 // success |
|
78 rv = ERR_NONE; |
|
79 return &rv; |
|
80 } |
|
81 |
|
82 |
|
83 /**************************************************************************************** |
|
84 * |
|
85 * PUBLIC FUNCTION: sc_shutdownrpcservice |
|
86 * |
|
87 ***************************************************************************************/ |
|
88 int *sc_shutdownrpcservice_7( int *aArgs, CLIENT *aDutout ) |
|
89 { |
|
90 static int rv; |
|
91 int instance_count; |
|
92 int err; |
|
93 |
|
94 // check that the service is started |
|
95 if( iComponentManager == NULL ) { |
|
96 rv = ERR_SERVICE_NOT_RUNNING; |
|
97 return &rv; |
|
98 } |
|
99 |
|
100 // if there are active sessions and the force flag isn't set then return an error |
|
101 instance_count = iComponentManager->GetInstanceCount(); |
|
102 if( (instance_count > 0) && (*aArgs == 0) ) { |
|
103 rv = ERR_ACTIVE_USER_SESSIONS; |
|
104 return &rv; |
|
105 }; |
|
106 |
|
107 // if the force flag IS set then reset all active connections |
|
108 instance_count = iComponentManager->GetInstanceCount(); |
|
109 if( instance_count > 0 ) { |
|
110 err = iComponentManager->DeleteAllInstances(); |
|
111 if( err != 0 ) { |
|
112 rv = ERR_FAILED_TO_REMOVE_ACTIVE_SESSIONS; |
|
113 return &rv; |
|
114 } |
|
115 } |
|
116 |
|
117 // call the custom service manager |
|
118 rv = CSvcFacontroller::StopRPCService(); |
|
119 if( rv != ERR_NONE ) { |
|
120 return &rv; |
|
121 } |
|
122 |
|
123 // delete the component manager |
|
124 delete iComponentManager; |
|
125 iComponentManager = NULL; |
|
126 |
|
127 // success |
|
128 rv = ERR_NONE; |
|
129 return &rv; |
|
130 } |
|
131 |
|
132 |
|
133 /**************************************************************************************** |
|
134 * |
|
135 * PUBLIC FUNCTION: list_devices |
|
136 * |
|
137 ***************************************************************************************/ |
|
138 TComponentList *list_devices_7( void *aArgs, CLIENT *aDutout ) |
|
139 { |
|
140 static TComponentList rv; |
|
141 int i, valid_count, component_instance_count; |
|
142 |
|
143 //free any allocated memory |
|
144 if( rv.TComponentList_val != NULL ) { |
|
145 free( rv.TComponentList_val ); |
|
146 rv.TComponentList_val = NULL; |
|
147 rv.TComponentList_len = 0; |
|
148 } |
|
149 |
|
150 // check that the service is started |
|
151 if( iComponentManager == NULL ) { |
|
152 CSvcFacontroller::SetError( LIST_DEVICES, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
153 return &rv; |
|
154 } |
|
155 |
|
156 // set the return value to generic error |
|
157 CSvcFacontroller::SetError( LIST_DEVICES, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
158 |
|
159 // get the number of active component instances |
|
160 component_instance_count = iComponentManager->GetInstanceCount(); |
|
161 |
|
162 // if there are one or more instances then allocate the memory |
|
163 if( component_instance_count > 0 ) { |
|
164 rv.TComponentList_val = (int*)malloc( sizeof(int) * component_instance_count ); |
|
165 assert( rv.TComponentList_val != NULL ); |
|
166 rv.TComponentList_len = component_instance_count; |
|
167 } |
|
168 |
|
169 // store all the currently active IDs in the list |
|
170 for( i = 0, valid_count = 0; i < INFO_MAXIMUM_OBJECTS; i++ ) { |
|
171 if( iComponentManager->IsValidKey(i) != 0 ) { |
|
172 assert( valid_count < component_instance_count ); |
|
173 (rv.TComponentList_val)[valid_count++] = i; |
|
174 } |
|
175 } |
|
176 |
|
177 // ok return everything |
|
178 return &rv; |
|
179 } |
|
180 |
|
181 |
|
182 /**************************************************************************************** |
|
183 * |
|
184 * PUBLIC FUNCTION: cstr_createagent |
|
185 * |
|
186 ***************************************************************************************/ |
|
187 TResult *cstr_createagent_7( void *aArgs, CLIENT *aDutout ) |
|
188 { |
|
189 static TResult rv; |
|
190 int result; |
|
191 int internal_err; |
|
192 int instance_key; |
|
193 CSFacontroller *session; |
|
194 |
|
195 // check that the service is started |
|
196 if( iComponentManager == NULL ) { |
|
197 CSvcFacontroller::SetError( CSTR_CREATEAGENT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
198 return &rv; |
|
199 } |
|
200 |
|
201 // create a new component instance |
|
202 instance_key = iComponentManager->CreateInstance(); |
|
203 if( instance_key < 0 ) { |
|
204 CSvcFacontroller::SetError( CSTR_CREATEAGENT, (void*)&rv, instance_key ); |
|
205 return &rv; |
|
206 } |
|
207 |
|
208 // get the instance |
|
209 session = iComponentManager->GetInstance( instance_key ); |
|
210 assert( session != NULL ); |
|
211 |
|
212 // call the corresponding method on the instance |
|
213 rv = session->cstr_createagent(); |
|
214 result = CSvcFacontroller::GetError( CSTR_CREATEAGENT, (void*)&rv ); |
|
215 |
|
216 // if the method fails then we cleanup the instance -- otherwise we set the instance key |
|
217 // as the return value |
|
218 if( result != ERR_NONE ) { |
|
219 internal_err = iComponentManager->DeleteInstance( instance_key ); |
|
220 assert( internal_err == 0 ); |
|
221 } else { |
|
222 CSvcFacontroller::SetError( CSTR_CREATEAGENT, (void*)&rv, instance_key ); |
|
223 } |
|
224 |
|
225 // done |
|
226 return &rv; |
|
227 } |
|
228 |
|
229 |
|
230 /**************************************************************************************** |
|
231 * |
|
232 * PUBLIC FUNCTION: dstr_removeagent |
|
233 * |
|
234 ***************************************************************************************/ |
|
235 int *dstr_removeagent_7( int *aArgs, CLIENT *aDutout ) |
|
236 { |
|
237 static int rv; |
|
238 int result; |
|
239 int internal_err; |
|
240 int instance_key; |
|
241 int should_delete = 1; |
|
242 CSFacontroller *session; |
|
243 |
|
244 // check that the service is started |
|
245 if( iComponentManager == NULL ) { |
|
246 rv = ERR_SERVICE_NOT_RUNNING; |
|
247 return &rv; |
|
248 } |
|
249 |
|
250 // get the key for the instance from the args |
|
251 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( DSTR_REMOVEAGENT, (void*)aArgs ); |
|
252 if( instance_key < 0 ) { |
|
253 rv = instance_key; |
|
254 return &rv; |
|
255 } |
|
256 // make sure the key is valid |
|
257 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
258 rv = ERR_INSTANCE_DOES_NOT_EXIST; |
|
259 return &rv; |
|
260 } |
|
261 |
|
262 // get the instance |
|
263 session = iComponentManager->GetInstance( instance_key ); |
|
264 assert( session != NULL ); |
|
265 |
|
266 // call the corresponding method on the instance |
|
267 rv = session->dstr_removeagent( *aArgs, &should_delete ); |
|
268 |
|
269 result = rv; |
|
270 |
|
271 // it is illegal for the method to succeed but not delete the instance |
|
272 assert( (result != ERR_NONE) || (should_delete == 1) ); |
|
273 |
|
274 // delete the instance if requested |
|
275 if( should_delete != 0 ) { |
|
276 internal_err = iComponentManager->DeleteInstance( instance_key ); |
|
277 assert( internal_err == ERR_NONE ); |
|
278 } |
|
279 |
|
280 // done |
|
281 return &rv; |
|
282 } |
|
283 |
|
284 |
|
285 /**************************************************************************************** |
|
286 * |
|
287 * PUBLIC FUNCTION: startmobileagent |
|
288 * |
|
289 ***************************************************************************************/ |
|
290 TResult *startmobileagent_7( TStartAgentRequest *aArgs, CLIENT *aDutout ) |
|
291 { |
|
292 static TResult rv; |
|
293 int instance_key; |
|
294 CSFacontroller *session; |
|
295 |
|
296 // check that the service is started |
|
297 if( iComponentManager == NULL ) { |
|
298 CSvcFacontroller::SetError( STARTMOBILEAGENT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
299 return &rv; |
|
300 } |
|
301 |
|
302 // set the return value to generic error |
|
303 CSvcFacontroller::SetError( STARTMOBILEAGENT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
304 |
|
305 // get the key for the instance from the args |
|
306 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( STARTMOBILEAGENT, (void*)aArgs ); |
|
307 if( instance_key < 0 ) { |
|
308 return &rv; |
|
309 } |
|
310 |
|
311 // make sure the key is valid |
|
312 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
313 CSvcFacontroller::SetError( STARTMOBILEAGENT, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
314 return &rv; |
|
315 } |
|
316 |
|
317 // get the instance |
|
318 session = iComponentManager->GetInstance( instance_key ); |
|
319 assert( session != NULL ); |
|
320 |
|
321 // call the corresponding method on the instance |
|
322 rv = session->startmobileagent( *aArgs ); |
|
323 return &rv; |
|
324 } |
|
325 |
|
326 |
|
327 /**************************************************************************************** |
|
328 * |
|
329 * PUBLIC FUNCTION: stopmobileagent |
|
330 * |
|
331 ***************************************************************************************/ |
|
332 TResult *stopmobileagent_7( int *aArgs, CLIENT *aDutout ) |
|
333 { |
|
334 static TResult rv; |
|
335 int instance_key; |
|
336 CSFacontroller *session; |
|
337 |
|
338 // check that the service is started |
|
339 if( iComponentManager == NULL ) { |
|
340 CSvcFacontroller::SetError( STOPMOBILEAGENT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
341 return &rv; |
|
342 } |
|
343 |
|
344 // set the return value to generic error |
|
345 CSvcFacontroller::SetError( STOPMOBILEAGENT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
346 |
|
347 // get the key for the instance from the args |
|
348 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( STOPMOBILEAGENT, (void*)aArgs ); |
|
349 if( instance_key < 0 ) { |
|
350 return &rv; |
|
351 } |
|
352 |
|
353 // make sure the key is valid |
|
354 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
355 CSvcFacontroller::SetError( STOPMOBILEAGENT, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
356 return &rv; |
|
357 } |
|
358 |
|
359 // get the instance |
|
360 session = iComponentManager->GetInstance( instance_key ); |
|
361 assert( session != NULL ); |
|
362 |
|
363 // call the corresponding method on the instance |
|
364 rv = session->stopmobileagent( *aArgs ); |
|
365 return &rv; |
|
366 } |
|
367 |
|
368 |
|
369 /**************************************************************************************** |
|
370 * |
|
371 * PUBLIC FUNCTION: getmobileagentstatus |
|
372 * |
|
373 ***************************************************************************************/ |
|
374 TResult *getmobileagentstatus_7( int *aArgs, CLIENT *aDutout ) |
|
375 { |
|
376 static TResult rv; |
|
377 int instance_key; |
|
378 CSFacontroller *session; |
|
379 |
|
380 // check that the service is started |
|
381 if( iComponentManager == NULL ) { |
|
382 CSvcFacontroller::SetError( GETMOBILEAGENTSTATUS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
383 return &rv; |
|
384 } |
|
385 |
|
386 // set the return value to generic error |
|
387 CSvcFacontroller::SetError( GETMOBILEAGENTSTATUS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
388 |
|
389 // get the key for the instance from the args |
|
390 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( GETMOBILEAGENTSTATUS, (void*)aArgs ); |
|
391 if( instance_key < 0 ) { |
|
392 return &rv; |
|
393 } |
|
394 |
|
395 // make sure the key is valid |
|
396 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
397 CSvcFacontroller::SetError( GETMOBILEAGENTSTATUS, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
398 return &rv; |
|
399 } |
|
400 |
|
401 // get the instance |
|
402 session = iComponentManager->GetInstance( instance_key ); |
|
403 assert( session != NULL ); |
|
404 |
|
405 // call the corresponding method on the instance |
|
406 rv = session->getmobileagentstatus( *aArgs ); |
|
407 return &rv; |
|
408 } |
|
409 |
|
410 |
|
411 /**************************************************************************************** |
|
412 * |
|
413 * PUBLIC FUNCTION: setsingleoption |
|
414 * |
|
415 ***************************************************************************************/ |
|
416 TResult *setsingleoption_7( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
417 { |
|
418 static TResult rv; |
|
419 int instance_key; |
|
420 CSFacontroller *session; |
|
421 |
|
422 // check that the service is started |
|
423 if( iComponentManager == NULL ) { |
|
424 CSvcFacontroller::SetError( SETSINGLEOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
425 return &rv; |
|
426 } |
|
427 |
|
428 // set the return value to generic error |
|
429 CSvcFacontroller::SetError( SETSINGLEOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
430 |
|
431 // get the key for the instance from the args |
|
432 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( SETSINGLEOPTION, (void*)aArgs ); |
|
433 if( instance_key < 0 ) { |
|
434 return &rv; |
|
435 } |
|
436 |
|
437 // make sure the key is valid |
|
438 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
439 CSvcFacontroller::SetError( SETSINGLEOPTION, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
440 return &rv; |
|
441 } |
|
442 |
|
443 // get the instance |
|
444 session = iComponentManager->GetInstance( instance_key ); |
|
445 assert( session != NULL ); |
|
446 |
|
447 // call the corresponding method on the instance |
|
448 rv = session->setsingleoption( *aArgs ); |
|
449 return &rv; |
|
450 } |
|
451 |
|
452 |
|
453 /**************************************************************************************** |
|
454 * |
|
455 * PUBLIC FUNCTION: removesingleoption |
|
456 * |
|
457 ***************************************************************************************/ |
|
458 TResult *removesingleoption_7( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
459 { |
|
460 static TResult rv; |
|
461 int instance_key; |
|
462 CSFacontroller *session; |
|
463 |
|
464 // check that the service is started |
|
465 if( iComponentManager == NULL ) { |
|
466 CSvcFacontroller::SetError( REMOVESINGLEOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
467 return &rv; |
|
468 } |
|
469 |
|
470 // set the return value to generic error |
|
471 CSvcFacontroller::SetError( REMOVESINGLEOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
472 |
|
473 // get the key for the instance from the args |
|
474 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( REMOVESINGLEOPTION, (void*)aArgs ); |
|
475 if( instance_key < 0 ) { |
|
476 return &rv; |
|
477 } |
|
478 |
|
479 // make sure the key is valid |
|
480 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
481 CSvcFacontroller::SetError( REMOVESINGLEOPTION, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
482 return &rv; |
|
483 } |
|
484 |
|
485 // get the instance |
|
486 session = iComponentManager->GetInstance( instance_key ); |
|
487 assert( session != NULL ); |
|
488 |
|
489 // call the corresponding method on the instance |
|
490 rv = session->removesingleoption( *aArgs ); |
|
491 return &rv; |
|
492 } |
|
493 |
|
494 |
|
495 /**************************************************************************************** |
|
496 * |
|
497 * PUBLIC FUNCTION: addlistoption |
|
498 * |
|
499 ***************************************************************************************/ |
|
500 TResult *addlistoption_7( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
501 { |
|
502 static TResult rv; |
|
503 int instance_key; |
|
504 CSFacontroller *session; |
|
505 |
|
506 // check that the service is started |
|
507 if( iComponentManager == NULL ) { |
|
508 CSvcFacontroller::SetError( ADDLISTOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
509 return &rv; |
|
510 } |
|
511 |
|
512 // set the return value to generic error |
|
513 CSvcFacontroller::SetError( ADDLISTOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
514 |
|
515 // get the key for the instance from the args |
|
516 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( ADDLISTOPTION, (void*)aArgs ); |
|
517 if( instance_key < 0 ) { |
|
518 return &rv; |
|
519 } |
|
520 |
|
521 // make sure the key is valid |
|
522 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
523 CSvcFacontroller::SetError( ADDLISTOPTION, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
524 return &rv; |
|
525 } |
|
526 |
|
527 // get the instance |
|
528 session = iComponentManager->GetInstance( instance_key ); |
|
529 assert( session != NULL ); |
|
530 |
|
531 // call the corresponding method on the instance |
|
532 rv = session->addlistoption( *aArgs ); |
|
533 return &rv; |
|
534 } |
|
535 |
|
536 |
|
537 /**************************************************************************************** |
|
538 * |
|
539 * PUBLIC FUNCTION: removelistoption |
|
540 * |
|
541 ***************************************************************************************/ |
|
542 TResult *removelistoption_7( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
543 { |
|
544 static TResult rv; |
|
545 int instance_key; |
|
546 CSFacontroller *session; |
|
547 |
|
548 // check that the service is started |
|
549 if( iComponentManager == NULL ) { |
|
550 CSvcFacontroller::SetError( REMOVELISTOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
551 return &rv; |
|
552 } |
|
553 |
|
554 // set the return value to generic error |
|
555 CSvcFacontroller::SetError( REMOVELISTOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
556 |
|
557 // get the key for the instance from the args |
|
558 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( REMOVELISTOPTION, (void*)aArgs ); |
|
559 if( instance_key < 0 ) { |
|
560 return &rv; |
|
561 } |
|
562 |
|
563 // make sure the key is valid |
|
564 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
565 CSvcFacontroller::SetError( REMOVELISTOPTION, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
566 return &rv; |
|
567 } |
|
568 |
|
569 // get the instance |
|
570 session = iComponentManager->GetInstance( instance_key ); |
|
571 assert( session != NULL ); |
|
572 |
|
573 // call the corresponding method on the instance |
|
574 rv = session->removelistoption( *aArgs ); |
|
575 return &rv; |
|
576 } |
|
577 |
|
578 |
|
579 /**************************************************************************************** |
|
580 * |
|
581 * PUBLIC FUNCTION: getstatus |
|
582 * |
|
583 ***************************************************************************************/ |
|
584 TFaStatusInfo *getstatus_7( int *aArgs, CLIENT *aDutout ) |
|
585 { |
|
586 static TFaStatusInfo rv; |
|
587 int instance_key; |
|
588 CSFacontroller *session; |
|
589 |
|
590 // check that the service is started |
|
591 if( iComponentManager == NULL ) { |
|
592 CSvcFacontroller::SetError( GETSTATUS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
593 return &rv; |
|
594 } |
|
595 |
|
596 // set the return value to generic error |
|
597 CSvcFacontroller::SetError( GETSTATUS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
598 |
|
599 // get the key for the instance from the args |
|
600 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( GETSTATUS, (void*)aArgs ); |
|
601 if( instance_key < 0 ) { |
|
602 return &rv; |
|
603 } |
|
604 |
|
605 // make sure the key is valid |
|
606 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
607 CSvcFacontroller::SetError( GETSTATUS, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
608 return &rv; |
|
609 } |
|
610 |
|
611 // get the instance |
|
612 session = iComponentManager->GetInstance( instance_key ); |
|
613 assert( session != NULL ); |
|
614 |
|
615 // call the corresponding method on the instance |
|
616 rv = session->getstatus( *aArgs ); |
|
617 return &rv; |
|
618 } |
|
619 |
|
620 |
|
621 /**************************************************************************************** |
|
622 * |
|
623 * PUBLIC FUNCTION: destroytunnelid |
|
624 * |
|
625 ***************************************************************************************/ |
|
626 TResult *destroytunnelid_7( TFaTunnelID *aArgs, CLIENT *aDutout ) |
|
627 { |
|
628 static TResult rv; |
|
629 int instance_key; |
|
630 CSFacontroller *session; |
|
631 |
|
632 // check that the service is started |
|
633 if( iComponentManager == NULL ) { |
|
634 CSvcFacontroller::SetError( DESTROYTUNNELID, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
635 return &rv; |
|
636 } |
|
637 |
|
638 // set the return value to generic error |
|
639 CSvcFacontroller::SetError( DESTROYTUNNELID, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
640 |
|
641 // get the key for the instance from the args |
|
642 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( DESTROYTUNNELID, (void*)aArgs ); |
|
643 if( instance_key < 0 ) { |
|
644 return &rv; |
|
645 } |
|
646 |
|
647 // make sure the key is valid |
|
648 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
649 CSvcFacontroller::SetError( DESTROYTUNNELID, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
650 return &rv; |
|
651 } |
|
652 |
|
653 // get the instance |
|
654 session = iComponentManager->GetInstance( instance_key ); |
|
655 assert( session != NULL ); |
|
656 |
|
657 // call the corresponding method on the instance |
|
658 rv = session->destroytunnelid( *aArgs ); |
|
659 return &rv; |
|
660 } |
|
661 |
|
662 |
|
663 /**************************************************************************************** |
|
664 * |
|
665 * PUBLIC FUNCTION: listtunnels |
|
666 * |
|
667 ***************************************************************************************/ |
|
668 TFaTunnelList *listtunnels_7( int *aArgs, CLIENT *aDutout ) |
|
669 { |
|
670 static TFaTunnelList rv; |
|
671 int instance_key; |
|
672 CSFacontroller *session; |
|
673 |
|
674 // check that the service is started |
|
675 if( iComponentManager == NULL ) { |
|
676 CSvcFacontroller::SetError( LISTTUNNELS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
677 return &rv; |
|
678 } |
|
679 |
|
680 // set the return value to generic error |
|
681 CSvcFacontroller::SetError( LISTTUNNELS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
682 |
|
683 // get the key for the instance from the args |
|
684 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( LISTTUNNELS, (void*)aArgs ); |
|
685 if( instance_key < 0 ) { |
|
686 return &rv; |
|
687 } |
|
688 |
|
689 // make sure the key is valid |
|
690 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
691 CSvcFacontroller::SetError( LISTTUNNELS, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
692 return &rv; |
|
693 } |
|
694 |
|
695 // get the instance |
|
696 session = iComponentManager->GetInstance( instance_key ); |
|
697 assert( session != NULL ); |
|
698 |
|
699 // call the corresponding method on the instance |
|
700 rv = session->listtunnels( *aArgs ); |
|
701 return &rv; |
|
702 } |
|
703 |
|
704 |
|
705 /**************************************************************************************** |
|
706 * |
|
707 * PUBLIC FUNCTION: gettunnelinfo |
|
708 * |
|
709 ***************************************************************************************/ |
|
710 TFaTunnelInfo *gettunnelinfo_7( TGetTunnelRequest *aArgs, CLIENT *aDutout ) |
|
711 { |
|
712 static TFaTunnelInfo rv; |
|
713 int instance_key; |
|
714 CSFacontroller *session; |
|
715 |
|
716 // check that the service is started |
|
717 if( iComponentManager == NULL ) { |
|
718 CSvcFacontroller::SetError( GETTUNNELINFO, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
719 return &rv; |
|
720 } |
|
721 |
|
722 // set the return value to generic error |
|
723 CSvcFacontroller::SetError( GETTUNNELINFO, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
724 |
|
725 // get the key for the instance from the args |
|
726 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( GETTUNNELINFO, (void*)aArgs ); |
|
727 if( instance_key < 0 ) { |
|
728 return &rv; |
|
729 } |
|
730 |
|
731 // make sure the key is valid |
|
732 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
733 CSvcFacontroller::SetError( GETTUNNELINFO, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
734 return &rv; |
|
735 } |
|
736 |
|
737 // get the instance |
|
738 session = iComponentManager->GetInstance( instance_key ); |
|
739 assert( session != NULL ); |
|
740 |
|
741 // call the corresponding method on the instance |
|
742 rv = session->gettunnelinfo( *aArgs ); |
|
743 return &rv; |
|
744 } |
|
745 |
|
746 |
|
747 /**************************************************************************************** |
|
748 * |
|
749 * PUBLIC FUNCTION: settimeout |
|
750 * |
|
751 ***************************************************************************************/ |
|
752 void *settimeout_7( TTimeoutRequest *aArgs, CLIENT *aDutout ) |
|
753 { |
|
754 static int rv; |
|
755 int instance_key; |
|
756 CSFacontroller *session; |
|
757 |
|
758 // check that the service is started |
|
759 if( iComponentManager == NULL ) { |
|
760 rv = ERR_SERVICE_NOT_RUNNING; |
|
761 return &rv; |
|
762 } |
|
763 |
|
764 // set the return value to generic error |
|
765 rv = ERR_FAILED_TO_RETRIEVE_KEY; |
|
766 |
|
767 // get the key for the instance from the args |
|
768 instance_key = CSvcFacontroller::GetInstanceKeyFromArgs( SETTIMEOUT, (void*)aArgs ); |
|
769 if( instance_key < 0 ) { |
|
770 return &rv; |
|
771 } |
|
772 |
|
773 // make sure the key is valid |
|
774 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
775 rv = ERR_INSTANCE_DOES_NOT_EXIST; |
|
776 return &rv; |
|
777 } |
|
778 |
|
779 // get the instance |
|
780 session = iComponentManager->GetInstance( instance_key ); |
|
781 assert( session != NULL ); |
|
782 |
|
783 // call the corresponding method on the instance |
|
784 rv = ERR_NONE; |
|
785 session->settimeout( *aArgs ); |
|
786 return &rv; |
|
787 } |