|
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 * Tue Nov 11 18:52:30 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 "CSvcMncontroller.h" |
|
34 #include "CSMncontroller.h" |
|
35 #include "CComponentManager.h" |
|
36 |
|
37 |
|
38 /**************************************************************************************** |
|
39 * |
|
40 * Static Variables |
|
41 * |
|
42 ***************************************************************************************/ |
|
43 static CComponentManager<CSMncontroller> *iComponentManager; |
|
44 |
|
45 |
|
46 /**************************************************************************************** |
|
47 * |
|
48 * PUBLIC FUNCTION: ss_startuprpcservice |
|
49 * |
|
50 ***************************************************************************************/ |
|
51 int *ss_startuprpcservice_5( void *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<CSMncontroller>( 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 = CSvcMncontroller::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_5( 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 = CSvcMncontroller::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_5( 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 CSvcMncontroller::SetError( LIST_DEVICES, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
152 return &rv; |
|
153 } |
|
154 |
|
155 // set the return value to generic error |
|
156 CSvcMncontroller::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_5( void *aArgs, CLIENT *aDutout ) |
|
187 { |
|
188 static TResult rv; |
|
189 int result; |
|
190 int internal_err; |
|
191 int instance_key; |
|
192 CSMncontroller *session; |
|
193 |
|
194 // check that the service is started |
|
195 if( iComponentManager == NULL ) { |
|
196 CSvcMncontroller::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 CSvcMncontroller::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 = CSvcMncontroller::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 CSvcMncontroller::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 int *dstr_removeagent_5( int *aArgs, CLIENT *aDutout ) |
|
235 { |
|
236 static int rv; |
|
237 int result; |
|
238 int internal_err; |
|
239 int instance_key; |
|
240 int should_delete = 1; |
|
241 CSMncontroller *session; |
|
242 |
|
243 // check that the service is started |
|
244 if( iComponentManager == NULL ) { |
|
245 rv = ERR_SERVICE_NOT_RUNNING; |
|
246 return &rv; |
|
247 } |
|
248 |
|
249 // get the key for the instance from the args |
|
250 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( DSTR_REMOVEAGENT, (void*)aArgs ); |
|
251 if( instance_key < 0 ) { |
|
252 rv = instance_key; |
|
253 return &rv; |
|
254 } |
|
255 // make sure the key is valid |
|
256 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
257 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 = 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_5( int *aArgs, CLIENT *aDutout ) |
|
290 { |
|
291 static TResult rv; |
|
292 int instance_key; |
|
293 CSMncontroller *session; |
|
294 |
|
295 // check that the service is started |
|
296 if( iComponentManager == NULL ) { |
|
297 CSvcMncontroller::SetError( STARTMOBILEAGENT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
298 return &rv; |
|
299 } |
|
300 |
|
301 // set the return value to generic error |
|
302 CSvcMncontroller::SetError( STARTMOBILEAGENT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
303 |
|
304 // get the key for the instance from the args |
|
305 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( int *aArgs, CLIENT *aDutout ) |
|
332 { |
|
333 static TResult rv; |
|
334 int instance_key; |
|
335 CSMncontroller *session; |
|
336 |
|
337 // check that the service is started |
|
338 if( iComponentManager == NULL ) { |
|
339 CSvcMncontroller::SetError( STOPMOBILEAGENT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
340 return &rv; |
|
341 } |
|
342 |
|
343 // set the return value to generic error |
|
344 CSvcMncontroller::SetError( STOPMOBILEAGENT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
345 |
|
346 // get the key for the instance from the args |
|
347 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( int *aArgs, CLIENT *aDutout ) |
|
374 { |
|
375 static TResult rv; |
|
376 int instance_key; |
|
377 CSMncontroller *session; |
|
378 |
|
379 // check that the service is started |
|
380 if( iComponentManager == NULL ) { |
|
381 CSvcMncontroller::SetError( GETMOBILEAGENTSTATUS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
382 return &rv; |
|
383 } |
|
384 |
|
385 // set the return value to generic error |
|
386 CSvcMncontroller::SetError( GETMOBILEAGENTSTATUS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
387 |
|
388 // get the key for the instance from the args |
|
389 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
416 { |
|
417 static TResult rv; |
|
418 int instance_key; |
|
419 CSMncontroller *session; |
|
420 |
|
421 // check that the service is started |
|
422 if( iComponentManager == NULL ) { |
|
423 CSvcMncontroller::SetError( SETSINGLEOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
424 return &rv; |
|
425 } |
|
426 |
|
427 // set the return value to generic error |
|
428 CSvcMncontroller::SetError( SETSINGLEOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
429 |
|
430 // get the key for the instance from the args |
|
431 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
458 { |
|
459 static TResult rv; |
|
460 int instance_key; |
|
461 CSMncontroller *session; |
|
462 |
|
463 // check that the service is started |
|
464 if( iComponentManager == NULL ) { |
|
465 CSvcMncontroller::SetError( REMOVESINGLEOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
466 return &rv; |
|
467 } |
|
468 |
|
469 // set the return value to generic error |
|
470 CSvcMncontroller::SetError( REMOVESINGLEOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
471 |
|
472 // get the key for the instance from the args |
|
473 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
500 { |
|
501 static TResult rv; |
|
502 int instance_key; |
|
503 CSMncontroller *session; |
|
504 |
|
505 // check that the service is started |
|
506 if( iComponentManager == NULL ) { |
|
507 CSvcMncontroller::SetError( ADDLISTOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
508 return &rv; |
|
509 } |
|
510 |
|
511 // set the return value to generic error |
|
512 CSvcMncontroller::SetError( ADDLISTOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
513 |
|
514 // get the key for the instance from the args |
|
515 instance_key = CSvcMncontroller::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 CSvcMncontroller::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_5( TOptionDesc *aArgs, CLIENT *aDutout ) |
|
542 { |
|
543 static TResult rv; |
|
544 int instance_key; |
|
545 CSMncontroller *session; |
|
546 |
|
547 // check that the service is started |
|
548 if( iComponentManager == NULL ) { |
|
549 CSvcMncontroller::SetError( REMOVELISTOPTION, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
550 return &rv; |
|
551 } |
|
552 |
|
553 // set the return value to generic error |
|
554 CSvcMncontroller::SetError( REMOVELISTOPTION, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
555 |
|
556 // get the key for the instance from the args |
|
557 instance_key = CSvcMncontroller::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 CSvcMncontroller::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: sethomeaddress |
|
581 * |
|
582 ***************************************************************************************/ |
|
583 TResult *sethomeaddress_5( THomeAddressDesc *aArgs, CLIENT *aDutout ) |
|
584 { |
|
585 static TResult rv; |
|
586 int instance_key; |
|
587 CSMncontroller *session; |
|
588 |
|
589 // check that the service is started |
|
590 if( iComponentManager == NULL ) { |
|
591 CSvcMncontroller::SetError( SETHOMEADDRESS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
592 return &rv; |
|
593 } |
|
594 |
|
595 // set the return value to generic error |
|
596 CSvcMncontroller::SetError( SETHOMEADDRESS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
597 |
|
598 // get the key for the instance from the args |
|
599 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( SETHOMEADDRESS, (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 CSvcMncontroller::SetError( SETHOMEADDRESS, (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->sethomeaddress( *aArgs ); |
|
616 return &rv; |
|
617 } |
|
618 |
|
619 |
|
620 /**************************************************************************************** |
|
621 * |
|
622 * PUBLIC FUNCTION: getcareofaddress |
|
623 * |
|
624 ***************************************************************************************/ |
|
625 TResult *getcareofaddress_5( int *aArgs, CLIENT *aDutout ) |
|
626 { |
|
627 static TResult rv; |
|
628 int instance_key; |
|
629 CSMncontroller *session; |
|
630 |
|
631 // check that the service is started |
|
632 if( iComponentManager == NULL ) { |
|
633 CSvcMncontroller::SetError( GETCAREOFADDRESS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
634 return &rv; |
|
635 } |
|
636 |
|
637 // set the return value to generic error |
|
638 CSvcMncontroller::SetError( GETCAREOFADDRESS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
639 |
|
640 // get the key for the instance from the args |
|
641 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( GETCAREOFADDRESS, (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 CSvcMncontroller::SetError( GETCAREOFADDRESS, (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->getcareofaddress( *aArgs ); |
|
658 return &rv; |
|
659 } |
|
660 |
|
661 |
|
662 /**************************************************************************************** |
|
663 * |
|
664 * PUBLIC FUNCTION: connect |
|
665 * |
|
666 ***************************************************************************************/ |
|
667 TResult *connect_5( TTunnelingModeDesc *aArgs, CLIENT *aDutout ) |
|
668 { |
|
669 static TResult rv; |
|
670 int instance_key; |
|
671 CSMncontroller *session; |
|
672 |
|
673 // check that the service is started |
|
674 if( iComponentManager == NULL ) { |
|
675 CSvcMncontroller::SetError( CONNECT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
676 return &rv; |
|
677 } |
|
678 |
|
679 // set the return value to generic error |
|
680 CSvcMncontroller::SetError( CONNECT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
681 |
|
682 // get the key for the instance from the args |
|
683 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( CONNECT, (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 CSvcMncontroller::SetError( CONNECT, (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->connect( *aArgs ); |
|
700 return &rv; |
|
701 } |
|
702 |
|
703 |
|
704 /**************************************************************************************** |
|
705 * |
|
706 * PUBLIC FUNCTION: disconnect |
|
707 * |
|
708 ***************************************************************************************/ |
|
709 TResult *disconnect_5( int *aArgs, CLIENT *aDutout ) |
|
710 { |
|
711 static TResult rv; |
|
712 int instance_key; |
|
713 CSMncontroller *session; |
|
714 |
|
715 // check that the service is started |
|
716 if( iComponentManager == NULL ) { |
|
717 CSvcMncontroller::SetError( DISCONNECT, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
718 return &rv; |
|
719 } |
|
720 |
|
721 // set the return value to generic error |
|
722 CSvcMncontroller::SetError( DISCONNECT, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
723 |
|
724 // get the key for the instance from the args |
|
725 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( DISCONNECT, (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 CSvcMncontroller::SetError( DISCONNECT, (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->disconnect( *aArgs ); |
|
742 return &rv; |
|
743 } |
|
744 |
|
745 |
|
746 /**************************************************************************************** |
|
747 * |
|
748 * PUBLIC FUNCTION: confirm |
|
749 * |
|
750 ***************************************************************************************/ |
|
751 TResult *confirm_5( int *aArgs, CLIENT *aDutout ) |
|
752 { |
|
753 static TResult rv; |
|
754 int instance_key; |
|
755 CSMncontroller *session; |
|
756 |
|
757 // check that the service is started |
|
758 if( iComponentManager == NULL ) { |
|
759 CSvcMncontroller::SetError( CONFIRM, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
760 return &rv; |
|
761 } |
|
762 |
|
763 // set the return value to generic error |
|
764 CSvcMncontroller::SetError( CONFIRM, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
765 |
|
766 // get the key for the instance from the args |
|
767 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( CONFIRM, (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 CSvcMncontroller::SetError( CONFIRM, (void*)&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 = session->confirm( *aArgs ); |
|
784 return &rv; |
|
785 } |
|
786 |
|
787 |
|
788 /**************************************************************************************** |
|
789 * |
|
790 * PUBLIC FUNCTION: rescaninterfaces |
|
791 * |
|
792 ***************************************************************************************/ |
|
793 TResult *rescaninterfaces_5( int *aArgs, CLIENT *aDutout ) |
|
794 { |
|
795 static TResult rv; |
|
796 int instance_key; |
|
797 CSMncontroller *session; |
|
798 |
|
799 // check that the service is started |
|
800 if( iComponentManager == NULL ) { |
|
801 CSvcMncontroller::SetError( RESCANINTERFACES, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
802 return &rv; |
|
803 } |
|
804 |
|
805 // set the return value to generic error |
|
806 CSvcMncontroller::SetError( RESCANINTERFACES, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
807 |
|
808 // get the key for the instance from the args |
|
809 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( RESCANINTERFACES, (void*)aArgs ); |
|
810 if( instance_key < 0 ) { |
|
811 return &rv; |
|
812 } |
|
813 |
|
814 // make sure the key is valid |
|
815 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
816 CSvcMncontroller::SetError( RESCANINTERFACES, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
817 return &rv; |
|
818 } |
|
819 |
|
820 // get the instance |
|
821 session = iComponentManager->GetInstance( instance_key ); |
|
822 assert( session != NULL ); |
|
823 |
|
824 // call the corresponding method on the instance |
|
825 rv = session->rescaninterfaces( *aArgs ); |
|
826 return &rv; |
|
827 } |
|
828 |
|
829 |
|
830 /**************************************************************************************** |
|
831 * |
|
832 * PUBLIC FUNCTION: setfapolicy |
|
833 * |
|
834 ***************************************************************************************/ |
|
835 TResult *setfapolicy_5( TPolicyRequest *aArgs, CLIENT *aDutout ) |
|
836 { |
|
837 static TResult rv; |
|
838 int instance_key; |
|
839 CSMncontroller *session; |
|
840 |
|
841 // check that the service is started |
|
842 if( iComponentManager == NULL ) { |
|
843 CSvcMncontroller::SetError( SETFAPOLICY, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
844 return &rv; |
|
845 } |
|
846 |
|
847 // set the return value to generic error |
|
848 CSvcMncontroller::SetError( SETFAPOLICY, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
849 |
|
850 // get the key for the instance from the args |
|
851 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( SETFAPOLICY, (void*)aArgs ); |
|
852 if( instance_key < 0 ) { |
|
853 return &rv; |
|
854 } |
|
855 |
|
856 // make sure the key is valid |
|
857 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
858 CSvcMncontroller::SetError( SETFAPOLICY, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
859 return &rv; |
|
860 } |
|
861 |
|
862 // get the instance |
|
863 session = iComponentManager->GetInstance( instance_key ); |
|
864 assert( session != NULL ); |
|
865 |
|
866 // call the corresponding method on the instance |
|
867 rv = session->setfapolicy( *aArgs ); |
|
868 return &rv; |
|
869 } |
|
870 |
|
871 |
|
872 /**************************************************************************************** |
|
873 * |
|
874 * PUBLIC FUNCTION: getfapolicy |
|
875 * |
|
876 ***************************************************************************************/ |
|
877 TResult *getfapolicy_5( int *aArgs, CLIENT *aDutout ) |
|
878 { |
|
879 static TResult rv; |
|
880 int instance_key; |
|
881 CSMncontroller *session; |
|
882 |
|
883 // check that the service is started |
|
884 if( iComponentManager == NULL ) { |
|
885 CSvcMncontroller::SetError( GETFAPOLICY, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
886 return &rv; |
|
887 } |
|
888 |
|
889 // set the return value to generic error |
|
890 CSvcMncontroller::SetError( GETFAPOLICY, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
891 |
|
892 // get the key for the instance from the args |
|
893 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( GETFAPOLICY, (void*)aArgs ); |
|
894 if( instance_key < 0 ) { |
|
895 return &rv; |
|
896 } |
|
897 |
|
898 // make sure the key is valid |
|
899 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
900 CSvcMncontroller::SetError( GETFAPOLICY, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
901 return &rv; |
|
902 } |
|
903 |
|
904 // get the instance |
|
905 session = iComponentManager->GetInstance( instance_key ); |
|
906 assert( session != NULL ); |
|
907 |
|
908 // call the corresponding method on the instance |
|
909 rv = session->getfapolicy( *aArgs ); |
|
910 return &rv; |
|
911 } |
|
912 |
|
913 |
|
914 /**************************************************************************************** |
|
915 * |
|
916 * PUBLIC FUNCTION: getstatus |
|
917 * |
|
918 ***************************************************************************************/ |
|
919 TMobileNodeStatus *getstatus_5( int *aArgs, CLIENT *aDutout ) |
|
920 { |
|
921 static TMobileNodeStatus rv; |
|
922 int instance_key; |
|
923 CSMncontroller *session; |
|
924 |
|
925 // check that the service is started |
|
926 if( iComponentManager == NULL ) { |
|
927 CSvcMncontroller::SetError( GETSTATUS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
928 return &rv; |
|
929 } |
|
930 |
|
931 // set the return value to generic error |
|
932 CSvcMncontroller::SetError( GETSTATUS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
933 |
|
934 // get the key for the instance from the args |
|
935 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( GETSTATUS, (void*)aArgs ); |
|
936 if( instance_key < 0 ) { |
|
937 return &rv; |
|
938 } |
|
939 |
|
940 // make sure the key is valid |
|
941 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
942 CSvcMncontroller::SetError( GETSTATUS, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
943 return &rv; |
|
944 } |
|
945 |
|
946 // get the instance |
|
947 session = iComponentManager->GetInstance( instance_key ); |
|
948 assert( session != NULL ); |
|
949 |
|
950 // call the corresponding method on the instance |
|
951 rv = session->getstatus( *aArgs ); |
|
952 return &rv; |
|
953 } |
|
954 |
|
955 |
|
956 /**************************************************************************************** |
|
957 * |
|
958 * PUBLIC FUNCTION: listforeignagents |
|
959 * |
|
960 ***************************************************************************************/ |
|
961 TForeignAgentList *listforeignagents_5( int *aArgs, CLIENT *aDutout ) |
|
962 { |
|
963 static TForeignAgentList rv; |
|
964 int instance_key; |
|
965 CSMncontroller *session; |
|
966 |
|
967 // check that the service is started |
|
968 if( iComponentManager == NULL ) { |
|
969 CSvcMncontroller::SetError( LISTFOREIGNAGENTS, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
970 return &rv; |
|
971 } |
|
972 |
|
973 // set the return value to generic error |
|
974 CSvcMncontroller::SetError( LISTFOREIGNAGENTS, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
975 |
|
976 // get the key for the instance from the args |
|
977 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( LISTFOREIGNAGENTS, (void*)aArgs ); |
|
978 if( instance_key < 0 ) { |
|
979 return &rv; |
|
980 } |
|
981 |
|
982 // make sure the key is valid |
|
983 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
984 CSvcMncontroller::SetError( LISTFOREIGNAGENTS, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
985 return &rv; |
|
986 } |
|
987 |
|
988 // get the instance |
|
989 session = iComponentManager->GetInstance( instance_key ); |
|
990 assert( session != NULL ); |
|
991 |
|
992 // call the corresponding method on the instance |
|
993 rv = session->listforeignagents( *aArgs ); |
|
994 return &rv; |
|
995 } |
|
996 |
|
997 |
|
998 /**************************************************************************************** |
|
999 * |
|
1000 * PUBLIC FUNCTION: getforeignagentinfo |
|
1001 * |
|
1002 ***************************************************************************************/ |
|
1003 TForeignAgentInfo *getforeignagentinfo_5( TForeignAgentInfoRequest *aArgs, CLIENT *aDutout ) |
|
1004 { |
|
1005 static TForeignAgentInfo rv; |
|
1006 int instance_key; |
|
1007 CSMncontroller *session; |
|
1008 |
|
1009 // check that the service is started |
|
1010 if( iComponentManager == NULL ) { |
|
1011 CSvcMncontroller::SetError( GETFOREIGNAGENTINFO, (void*)&rv, ERR_SERVICE_NOT_RUNNING ); |
|
1012 return &rv; |
|
1013 } |
|
1014 |
|
1015 // set the return value to generic error |
|
1016 CSvcMncontroller::SetError( GETFOREIGNAGENTINFO, (void*)&rv, ERR_FAILED_TO_RETRIEVE_KEY ); |
|
1017 |
|
1018 // get the key for the instance from the args |
|
1019 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( GETFOREIGNAGENTINFO, (void*)aArgs ); |
|
1020 if( instance_key < 0 ) { |
|
1021 return &rv; |
|
1022 } |
|
1023 |
|
1024 // make sure the key is valid |
|
1025 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
1026 CSvcMncontroller::SetError( GETFOREIGNAGENTINFO, (void*)&rv, ERR_INSTANCE_DOES_NOT_EXIST ); |
|
1027 return &rv; |
|
1028 } |
|
1029 |
|
1030 // get the instance |
|
1031 session = iComponentManager->GetInstance( instance_key ); |
|
1032 assert( session != NULL ); |
|
1033 |
|
1034 // call the corresponding method on the instance |
|
1035 rv = session->getforeignagentinfo( *aArgs ); |
|
1036 return &rv; |
|
1037 } |
|
1038 |
|
1039 |
|
1040 /**************************************************************************************** |
|
1041 * |
|
1042 * PUBLIC FUNCTION: settimeout |
|
1043 * |
|
1044 ***************************************************************************************/ |
|
1045 void *settimeout_5( TTimeoutRequest *aArgs, CLIENT *aDutout ) |
|
1046 { |
|
1047 static int rv; |
|
1048 int instance_key; |
|
1049 CSMncontroller *session; |
|
1050 |
|
1051 // check that the service is started |
|
1052 if( iComponentManager == NULL ) { |
|
1053 rv = ERR_SERVICE_NOT_RUNNING; |
|
1054 return &rv; |
|
1055 } |
|
1056 |
|
1057 // set the return value to generic error |
|
1058 rv = ERR_FAILED_TO_RETRIEVE_KEY; |
|
1059 |
|
1060 // get the key for the instance from the args |
|
1061 instance_key = CSvcMncontroller::GetInstanceKeyFromArgs( SETTIMEOUT, (void*)aArgs ); |
|
1062 if( instance_key < 0 ) { |
|
1063 return &rv; |
|
1064 } |
|
1065 |
|
1066 // make sure the key is valid |
|
1067 if( iComponentManager->IsValidKey(instance_key) == 0 ) { |
|
1068 rv = ERR_INSTANCE_DOES_NOT_EXIST; |
|
1069 return &rv; |
|
1070 } |
|
1071 |
|
1072 // get the instance |
|
1073 session = iComponentManager->GetInstance( instance_key ); |
|
1074 assert( session != NULL ); |
|
1075 |
|
1076 // call the corresponding method on the instance |
|
1077 rv = ERR_NONE; |
|
1078 session->settimeout( *aArgs ); |
|
1079 return &rv; |
|
1080 } |