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