|
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 * System Includes |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <stdio.h> |
|
23 #include <assert.h> |
|
24 #include <rpc/types.h> |
|
25 |
|
26 |
|
27 /**************************************************************************************** |
|
28 * |
|
29 * Local Includes |
|
30 * |
|
31 ***************************************************************************************/ |
|
32 #include "CCMncontroller.h" |
|
33 |
|
34 |
|
35 /**************************************************************************************** |
|
36 * |
|
37 * Implementation |
|
38 * |
|
39 ***************************************************************************************/ |
|
40 CCMncontroller::CCMncontroller() |
|
41 { |
|
42 cl = NULL; |
|
43 iLastRPCError.re_status = RPC_SUCCESS; |
|
44 } |
|
45 |
|
46 CCMncontroller::~CCMncontroller() |
|
47 { |
|
48 assert( cl == NULL ); |
|
49 } |
|
50 |
|
51 char *CCMncontroller::GetLastRPCError( int *aIntErr ) |
|
52 { |
|
53 struct rpc_err rpcerr; |
|
54 |
|
55 // check that the handle is valid |
|
56 if( cl == NULL ) { |
|
57 return NULL; |
|
58 } |
|
59 |
|
60 // pass the aIntErr |
|
61 if( aIntErr != NULL ) { |
|
62 clnt_geterr( cl, &rpcerr ); |
|
63 *aIntErr = rpcerr.re_status; |
|
64 } |
|
65 |
|
66 // return the errorstring |
|
67 return clnt_sperror( cl, NULL ); |
|
68 } |
|
69 |
|
70 int CCMncontroller::Connect( string aRemoteHost ) |
|
71 { |
|
72 // check that we are not already connected |
|
73 if( cl != NULL ) { |
|
74 return ERR_STUB_ALREADY_CONNECTED; |
|
75 } |
|
76 |
|
77 // start the rpc library |
|
78 rpc_nt_init(); |
|
79 |
|
80 // connect to the service |
|
81 cl = clnt_create( aRemoteHost.c_str(), MNCONTROLLER, MNCONTROLLER_VERSION, "tcp" ); |
|
82 if( cl == NULL ) { |
|
83 rpc_nt_exit(); |
|
84 return ERR_FAILED_TO_CONNECT; |
|
85 } |
|
86 |
|
87 // done |
|
88 return ERR_NONE; |
|
89 } |
|
90 |
|
91 int CCMncontroller::Disconnect( ) |
|
92 { |
|
93 // check that we are connected |
|
94 if( cl == NULL ) { |
|
95 return ERR_STUB_NOT_CONNECTED; |
|
96 } |
|
97 |
|
98 // cleanup the client handle |
|
99 clnt_destroy( cl ); |
|
100 cl = NULL; |
|
101 rpc_nt_exit(); |
|
102 |
|
103 // done |
|
104 return ERR_NONE; |
|
105 } |
|
106 |
|
107 |
|
108 /**************************************************************************************** |
|
109 * |
|
110 * PUBLIC FUNCTION: ss_startuprpcservice |
|
111 * |
|
112 ***************************************************************************************/ |
|
113 int CCMncontroller::ss_startuprpcservice( int *rv ) |
|
114 { |
|
115 struct rpc_err rerr; |
|
116 int aArgs = 0; |
|
117 |
|
118 // check the rv pointer |
|
119 if( rv == NULL ) { |
|
120 return ERR_INVALID_RV_POINTER; |
|
121 } |
|
122 |
|
123 // check that we have a connection |
|
124 if( cl == NULL ) { |
|
125 return ERR_STUB_NOT_CONNECTED; |
|
126 } |
|
127 |
|
128 // do the call |
|
129 *rv = *ss_startuprpcservice_5( &aArgs, cl ); |
|
130 |
|
131 // check for rpc errors and return the result |
|
132 clnt_geterr( cl, &rerr ); |
|
133 if( rerr.re_status != RPC_SUCCESS ) { |
|
134 iLastRPCError = rerr; |
|
135 return ERR_RPC_ERROR; |
|
136 } |
|
137 return ERR_NONE; |
|
138 } |
|
139 |
|
140 |
|
141 /**************************************************************************************** |
|
142 * |
|
143 * PUBLIC FUNCTION: sc_shutdownrpcservice |
|
144 * |
|
145 ***************************************************************************************/ |
|
146 int CCMncontroller::sc_shutdownrpcservice( int aArgs, int *rv ) |
|
147 { |
|
148 struct rpc_err rerr; |
|
149 |
|
150 // check the rv pointer |
|
151 if( rv == NULL ) { |
|
152 return ERR_INVALID_RV_POINTER; |
|
153 } |
|
154 |
|
155 // check that we have a connection |
|
156 if( cl == NULL ) { |
|
157 return ERR_STUB_NOT_CONNECTED; |
|
158 } |
|
159 |
|
160 // do the call |
|
161 *rv = *sc_shutdownrpcservice_5( &aArgs, cl ); |
|
162 |
|
163 // check for rpc errors and return the result |
|
164 clnt_geterr( cl, &rerr ); |
|
165 if( rerr.re_status != RPC_SUCCESS ) { |
|
166 iLastRPCError = rerr; |
|
167 return ERR_RPC_ERROR; |
|
168 } |
|
169 return ERR_NONE; |
|
170 } |
|
171 |
|
172 |
|
173 /**************************************************************************************** |
|
174 * |
|
175 * PUBLIC FUNCTION: list_devices |
|
176 * |
|
177 ***************************************************************************************/ |
|
178 int CCMncontroller::list_devices( TComponentList *rv ) |
|
179 { |
|
180 struct rpc_err rerr; |
|
181 int aArgs = 0; |
|
182 |
|
183 // check the rv pointer |
|
184 if( rv == NULL ) { |
|
185 return ERR_INVALID_RV_POINTER; |
|
186 } |
|
187 |
|
188 // check that we have a connection |
|
189 if( cl == NULL ) { |
|
190 return ERR_STUB_NOT_CONNECTED; |
|
191 } |
|
192 |
|
193 // do the call |
|
194 *rv = *list_devices_5( &aArgs, cl ); |
|
195 |
|
196 // check for rpc errors and return the result |
|
197 clnt_geterr( cl, &rerr ); |
|
198 if( rerr.re_status != RPC_SUCCESS ) { |
|
199 iLastRPCError = rerr; |
|
200 return ERR_RPC_ERROR; |
|
201 } |
|
202 return ERR_NONE; |
|
203 } |
|
204 |
|
205 |
|
206 /**************************************************************************************** |
|
207 * |
|
208 * PUBLIC FUNCTION: cstr_createagent |
|
209 * |
|
210 ***************************************************************************************/ |
|
211 int CCMncontroller::cstr_createagent( TResult *rv ) |
|
212 { |
|
213 struct rpc_err rerr; |
|
214 int aArgs = 0; |
|
215 |
|
216 // check the rv pointer |
|
217 if( rv == NULL ) { |
|
218 return ERR_INVALID_RV_POINTER; |
|
219 } |
|
220 |
|
221 // check that we have a connection |
|
222 if( cl == NULL ) { |
|
223 return ERR_STUB_NOT_CONNECTED; |
|
224 } |
|
225 |
|
226 // do the call |
|
227 *rv = *cstr_createagent_5( &aArgs, cl ); |
|
228 |
|
229 // check for rpc errors and return the result |
|
230 clnt_geterr( cl, &rerr ); |
|
231 if( rerr.re_status != RPC_SUCCESS ) { |
|
232 iLastRPCError = rerr; |
|
233 return ERR_RPC_ERROR; |
|
234 } |
|
235 return ERR_NONE; |
|
236 } |
|
237 |
|
238 |
|
239 /**************************************************************************************** |
|
240 * |
|
241 * PUBLIC FUNCTION: dstr_removeagent |
|
242 * |
|
243 ***************************************************************************************/ |
|
244 int CCMncontroller::dstr_removeagent( int aArgs, int *rv ) |
|
245 { |
|
246 struct rpc_err rerr; |
|
247 |
|
248 // check the rv pointer |
|
249 if( rv == NULL ) { |
|
250 return ERR_INVALID_RV_POINTER; |
|
251 } |
|
252 |
|
253 // check that we have a connection |
|
254 if( cl == NULL ) { |
|
255 return ERR_STUB_NOT_CONNECTED; |
|
256 } |
|
257 |
|
258 // do the call |
|
259 *rv = *dstr_removeagent_5( &aArgs, cl ); |
|
260 |
|
261 // check for rpc errors and return the result |
|
262 clnt_geterr( cl, &rerr ); |
|
263 if( rerr.re_status != RPC_SUCCESS ) { |
|
264 iLastRPCError = rerr; |
|
265 return ERR_RPC_ERROR; |
|
266 } |
|
267 return ERR_NONE; |
|
268 } |
|
269 |
|
270 |
|
271 /**************************************************************************************** |
|
272 * |
|
273 * PUBLIC FUNCTION: startmobileagent |
|
274 * |
|
275 ***************************************************************************************/ |
|
276 int CCMncontroller::startmobileagent( int aArgs, TResult *rv ) |
|
277 { |
|
278 struct rpc_err rerr; |
|
279 |
|
280 // check the rv pointer |
|
281 if( rv == NULL ) { |
|
282 return ERR_INVALID_RV_POINTER; |
|
283 } |
|
284 |
|
285 // check that we have a connection |
|
286 if( cl == NULL ) { |
|
287 return ERR_STUB_NOT_CONNECTED; |
|
288 } |
|
289 |
|
290 // do the call |
|
291 *rv = *startmobileagent_5( &aArgs, cl ); |
|
292 |
|
293 // check for rpc errors and return the result |
|
294 clnt_geterr( cl, &rerr ); |
|
295 if( rerr.re_status != RPC_SUCCESS ) { |
|
296 iLastRPCError = rerr; |
|
297 return ERR_RPC_ERROR; |
|
298 } |
|
299 return ERR_NONE; |
|
300 } |
|
301 |
|
302 |
|
303 /**************************************************************************************** |
|
304 * |
|
305 * PUBLIC FUNCTION: stopmobileagent |
|
306 * |
|
307 ***************************************************************************************/ |
|
308 int CCMncontroller::stopmobileagent( int aArgs, TResult *rv ) |
|
309 { |
|
310 struct rpc_err rerr; |
|
311 |
|
312 // check the rv pointer |
|
313 if( rv == NULL ) { |
|
314 return ERR_INVALID_RV_POINTER; |
|
315 } |
|
316 |
|
317 // check that we have a connection |
|
318 if( cl == NULL ) { |
|
319 return ERR_STUB_NOT_CONNECTED; |
|
320 } |
|
321 |
|
322 // do the call |
|
323 *rv = *stopmobileagent_5( &aArgs, cl ); |
|
324 |
|
325 // check for rpc errors and return the result |
|
326 clnt_geterr( cl, &rerr ); |
|
327 if( rerr.re_status != RPC_SUCCESS ) { |
|
328 iLastRPCError = rerr; |
|
329 return ERR_RPC_ERROR; |
|
330 } |
|
331 return ERR_NONE; |
|
332 } |
|
333 |
|
334 |
|
335 /**************************************************************************************** |
|
336 * |
|
337 * PUBLIC FUNCTION: getmobileagentstatus |
|
338 * |
|
339 ***************************************************************************************/ |
|
340 int CCMncontroller::getmobileagentstatus( int aArgs, TResult *rv ) |
|
341 { |
|
342 struct rpc_err rerr; |
|
343 |
|
344 // check the rv pointer |
|
345 if( rv == NULL ) { |
|
346 return ERR_INVALID_RV_POINTER; |
|
347 } |
|
348 |
|
349 // check that we have a connection |
|
350 if( cl == NULL ) { |
|
351 return ERR_STUB_NOT_CONNECTED; |
|
352 } |
|
353 |
|
354 // do the call |
|
355 *rv = *getmobileagentstatus_5( &aArgs, cl ); |
|
356 |
|
357 // check for rpc errors and return the result |
|
358 clnt_geterr( cl, &rerr ); |
|
359 if( rerr.re_status != RPC_SUCCESS ) { |
|
360 iLastRPCError = rerr; |
|
361 return ERR_RPC_ERROR; |
|
362 } |
|
363 return ERR_NONE; |
|
364 } |
|
365 |
|
366 |
|
367 /**************************************************************************************** |
|
368 * |
|
369 * PUBLIC FUNCTION: setsingleoption |
|
370 * |
|
371 ***************************************************************************************/ |
|
372 int CCMncontroller::setsingleoption( TOptionDesc aArgs, TResult *rv ) |
|
373 { |
|
374 struct rpc_err rerr; |
|
375 |
|
376 // check the rv pointer |
|
377 if( rv == NULL ) { |
|
378 return ERR_INVALID_RV_POINTER; |
|
379 } |
|
380 |
|
381 // check that we have a connection |
|
382 if( cl == NULL ) { |
|
383 return ERR_STUB_NOT_CONNECTED; |
|
384 } |
|
385 |
|
386 // do the call |
|
387 *rv = *setsingleoption_5( &aArgs, cl ); |
|
388 |
|
389 // check for rpc errors and return the result |
|
390 clnt_geterr( cl, &rerr ); |
|
391 if( rerr.re_status != RPC_SUCCESS ) { |
|
392 iLastRPCError = rerr; |
|
393 return ERR_RPC_ERROR; |
|
394 } |
|
395 return ERR_NONE; |
|
396 } |
|
397 |
|
398 |
|
399 /**************************************************************************************** |
|
400 * |
|
401 * PUBLIC FUNCTION: removesingleoption |
|
402 * |
|
403 ***************************************************************************************/ |
|
404 int CCMncontroller::removesingleoption( TOptionDesc aArgs, TResult *rv ) |
|
405 { |
|
406 struct rpc_err rerr; |
|
407 |
|
408 // check the rv pointer |
|
409 if( rv == NULL ) { |
|
410 return ERR_INVALID_RV_POINTER; |
|
411 } |
|
412 |
|
413 // check that we have a connection |
|
414 if( cl == NULL ) { |
|
415 return ERR_STUB_NOT_CONNECTED; |
|
416 } |
|
417 |
|
418 // do the call |
|
419 *rv = *removesingleoption_5( &aArgs, cl ); |
|
420 |
|
421 // check for rpc errors and return the result |
|
422 clnt_geterr( cl, &rerr ); |
|
423 if( rerr.re_status != RPC_SUCCESS ) { |
|
424 iLastRPCError = rerr; |
|
425 return ERR_RPC_ERROR; |
|
426 } |
|
427 return ERR_NONE; |
|
428 } |
|
429 |
|
430 |
|
431 /**************************************************************************************** |
|
432 * |
|
433 * PUBLIC FUNCTION: addlistoption |
|
434 * |
|
435 ***************************************************************************************/ |
|
436 int CCMncontroller::addlistoption( TOptionDesc aArgs, TResult *rv ) |
|
437 { |
|
438 struct rpc_err rerr; |
|
439 |
|
440 // check the rv pointer |
|
441 if( rv == NULL ) { |
|
442 return ERR_INVALID_RV_POINTER; |
|
443 } |
|
444 |
|
445 // check that we have a connection |
|
446 if( cl == NULL ) { |
|
447 return ERR_STUB_NOT_CONNECTED; |
|
448 } |
|
449 |
|
450 // do the call |
|
451 *rv = *addlistoption_5( &aArgs, cl ); |
|
452 |
|
453 // check for rpc errors and return the result |
|
454 clnt_geterr( cl, &rerr ); |
|
455 if( rerr.re_status != RPC_SUCCESS ) { |
|
456 iLastRPCError = rerr; |
|
457 return ERR_RPC_ERROR; |
|
458 } |
|
459 return ERR_NONE; |
|
460 } |
|
461 |
|
462 |
|
463 /**************************************************************************************** |
|
464 * |
|
465 * PUBLIC FUNCTION: removelistoption |
|
466 * |
|
467 ***************************************************************************************/ |
|
468 int CCMncontroller::removelistoption( TOptionDesc aArgs, TResult *rv ) |
|
469 { |
|
470 struct rpc_err rerr; |
|
471 |
|
472 // check the rv pointer |
|
473 if( rv == NULL ) { |
|
474 return ERR_INVALID_RV_POINTER; |
|
475 } |
|
476 |
|
477 // check that we have a connection |
|
478 if( cl == NULL ) { |
|
479 return ERR_STUB_NOT_CONNECTED; |
|
480 } |
|
481 |
|
482 // do the call |
|
483 *rv = *removelistoption_5( &aArgs, cl ); |
|
484 |
|
485 // check for rpc errors and return the result |
|
486 clnt_geterr( cl, &rerr ); |
|
487 if( rerr.re_status != RPC_SUCCESS ) { |
|
488 iLastRPCError = rerr; |
|
489 return ERR_RPC_ERROR; |
|
490 } |
|
491 return ERR_NONE; |
|
492 } |
|
493 |
|
494 |
|
495 /**************************************************************************************** |
|
496 * |
|
497 * PUBLIC FUNCTION: sethomeaddress |
|
498 * |
|
499 ***************************************************************************************/ |
|
500 int CCMncontroller::sethomeaddress( THomeAddressDesc aArgs, TResult *rv ) |
|
501 { |
|
502 struct rpc_err rerr; |
|
503 |
|
504 // check the rv pointer |
|
505 if( rv == NULL ) { |
|
506 return ERR_INVALID_RV_POINTER; |
|
507 } |
|
508 |
|
509 // check that we have a connection |
|
510 if( cl == NULL ) { |
|
511 return ERR_STUB_NOT_CONNECTED; |
|
512 } |
|
513 |
|
514 // do the call |
|
515 *rv = *sethomeaddress_5( &aArgs, cl ); |
|
516 |
|
517 // check for rpc errors and return the result |
|
518 clnt_geterr( cl, &rerr ); |
|
519 if( rerr.re_status != RPC_SUCCESS ) { |
|
520 iLastRPCError = rerr; |
|
521 return ERR_RPC_ERROR; |
|
522 } |
|
523 return ERR_NONE; |
|
524 } |
|
525 |
|
526 |
|
527 /**************************************************************************************** |
|
528 * |
|
529 * PUBLIC FUNCTION: getcareofaddress |
|
530 * |
|
531 ***************************************************************************************/ |
|
532 int CCMncontroller::getcareofaddress( int aArgs, TResult *rv ) |
|
533 { |
|
534 struct rpc_err rerr; |
|
535 |
|
536 // check the rv pointer |
|
537 if( rv == NULL ) { |
|
538 return ERR_INVALID_RV_POINTER; |
|
539 } |
|
540 |
|
541 // check that we have a connection |
|
542 if( cl == NULL ) { |
|
543 return ERR_STUB_NOT_CONNECTED; |
|
544 } |
|
545 |
|
546 // do the call |
|
547 *rv = *getcareofaddress_5( &aArgs, cl ); |
|
548 |
|
549 // check for rpc errors and return the result |
|
550 clnt_geterr( cl, &rerr ); |
|
551 if( rerr.re_status != RPC_SUCCESS ) { |
|
552 iLastRPCError = rerr; |
|
553 return ERR_RPC_ERROR; |
|
554 } |
|
555 return ERR_NONE; |
|
556 } |
|
557 |
|
558 |
|
559 /**************************************************************************************** |
|
560 * |
|
561 * PUBLIC FUNCTION: connect |
|
562 * |
|
563 ***************************************************************************************/ |
|
564 int CCMncontroller::connect( TTunnelingModeDesc aArgs, TResult *rv ) |
|
565 { |
|
566 struct rpc_err rerr; |
|
567 |
|
568 // check the rv pointer |
|
569 if( rv == NULL ) { |
|
570 return ERR_INVALID_RV_POINTER; |
|
571 } |
|
572 |
|
573 // check that we have a connection |
|
574 if( cl == NULL ) { |
|
575 return ERR_STUB_NOT_CONNECTED; |
|
576 } |
|
577 |
|
578 // do the call |
|
579 *rv = *connect_5( &aArgs, cl ); |
|
580 |
|
581 // check for rpc errors and return the result |
|
582 clnt_geterr( cl, &rerr ); |
|
583 if( rerr.re_status != RPC_SUCCESS ) { |
|
584 iLastRPCError = rerr; |
|
585 return ERR_RPC_ERROR; |
|
586 } |
|
587 return ERR_NONE; |
|
588 } |
|
589 |
|
590 |
|
591 /**************************************************************************************** |
|
592 * |
|
593 * PUBLIC FUNCTION: disconnect |
|
594 * |
|
595 ***************************************************************************************/ |
|
596 int CCMncontroller::disconnect( int aArgs, TResult *rv ) |
|
597 { |
|
598 struct rpc_err rerr; |
|
599 |
|
600 // check the rv pointer |
|
601 if( rv == NULL ) { |
|
602 return ERR_INVALID_RV_POINTER; |
|
603 } |
|
604 |
|
605 // check that we have a connection |
|
606 if( cl == NULL ) { |
|
607 return ERR_STUB_NOT_CONNECTED; |
|
608 } |
|
609 |
|
610 // do the call |
|
611 *rv = *disconnect_5( &aArgs, cl ); |
|
612 |
|
613 // check for rpc errors and return the result |
|
614 clnt_geterr( cl, &rerr ); |
|
615 if( rerr.re_status != RPC_SUCCESS ) { |
|
616 iLastRPCError = rerr; |
|
617 return ERR_RPC_ERROR; |
|
618 } |
|
619 return ERR_NONE; |
|
620 } |
|
621 |
|
622 |
|
623 /**************************************************************************************** |
|
624 * |
|
625 * PUBLIC FUNCTION: confirm |
|
626 * |
|
627 ***************************************************************************************/ |
|
628 int CCMncontroller::confirm( int aArgs, TResult *rv ) |
|
629 { |
|
630 struct rpc_err rerr; |
|
631 |
|
632 // check the rv pointer |
|
633 if( rv == NULL ) { |
|
634 return ERR_INVALID_RV_POINTER; |
|
635 } |
|
636 |
|
637 // check that we have a connection |
|
638 if( cl == NULL ) { |
|
639 return ERR_STUB_NOT_CONNECTED; |
|
640 } |
|
641 |
|
642 // do the call |
|
643 *rv = *confirm_5( &aArgs, cl ); |
|
644 |
|
645 // check for rpc errors and return the result |
|
646 clnt_geterr( cl, &rerr ); |
|
647 if( rerr.re_status != RPC_SUCCESS ) { |
|
648 iLastRPCError = rerr; |
|
649 return ERR_RPC_ERROR; |
|
650 } |
|
651 return ERR_NONE; |
|
652 } |
|
653 |
|
654 |
|
655 /**************************************************************************************** |
|
656 * |
|
657 * PUBLIC FUNCTION: rescaninterfaces |
|
658 * |
|
659 ***************************************************************************************/ |
|
660 int CCMncontroller::rescaninterfaces( int aArgs, TResult *rv ) |
|
661 { |
|
662 struct rpc_err rerr; |
|
663 |
|
664 // check the rv pointer |
|
665 if( rv == NULL ) { |
|
666 return ERR_INVALID_RV_POINTER; |
|
667 } |
|
668 |
|
669 // check that we have a connection |
|
670 if( cl == NULL ) { |
|
671 return ERR_STUB_NOT_CONNECTED; |
|
672 } |
|
673 |
|
674 // do the call |
|
675 *rv = *rescaninterfaces_5( &aArgs, cl ); |
|
676 |
|
677 // check for rpc errors and return the result |
|
678 clnt_geterr( cl, &rerr ); |
|
679 if( rerr.re_status != RPC_SUCCESS ) { |
|
680 iLastRPCError = rerr; |
|
681 return ERR_RPC_ERROR; |
|
682 } |
|
683 return ERR_NONE; |
|
684 } |
|
685 |
|
686 |
|
687 /**************************************************************************************** |
|
688 * |
|
689 * PUBLIC FUNCTION: setfapolicy |
|
690 * |
|
691 ***************************************************************************************/ |
|
692 int CCMncontroller::setfapolicy( TPolicyRequest aArgs, TResult *rv ) |
|
693 { |
|
694 struct rpc_err rerr; |
|
695 |
|
696 // check the rv pointer |
|
697 if( rv == NULL ) { |
|
698 return ERR_INVALID_RV_POINTER; |
|
699 } |
|
700 |
|
701 // check that we have a connection |
|
702 if( cl == NULL ) { |
|
703 return ERR_STUB_NOT_CONNECTED; |
|
704 } |
|
705 |
|
706 // do the call |
|
707 *rv = *setfapolicy_5( &aArgs, cl ); |
|
708 |
|
709 // check for rpc errors and return the result |
|
710 clnt_geterr( cl, &rerr ); |
|
711 if( rerr.re_status != RPC_SUCCESS ) { |
|
712 iLastRPCError = rerr; |
|
713 return ERR_RPC_ERROR; |
|
714 } |
|
715 return ERR_NONE; |
|
716 } |
|
717 |
|
718 |
|
719 /**************************************************************************************** |
|
720 * |
|
721 * PUBLIC FUNCTION: getfapolicy |
|
722 * |
|
723 ***************************************************************************************/ |
|
724 int CCMncontroller::getfapolicy( int aArgs, TResult *rv ) |
|
725 { |
|
726 struct rpc_err rerr; |
|
727 |
|
728 // check the rv pointer |
|
729 if( rv == NULL ) { |
|
730 return ERR_INVALID_RV_POINTER; |
|
731 } |
|
732 |
|
733 // check that we have a connection |
|
734 if( cl == NULL ) { |
|
735 return ERR_STUB_NOT_CONNECTED; |
|
736 } |
|
737 |
|
738 // do the call |
|
739 *rv = *getfapolicy_5( &aArgs, cl ); |
|
740 |
|
741 // check for rpc errors and return the result |
|
742 clnt_geterr( cl, &rerr ); |
|
743 if( rerr.re_status != RPC_SUCCESS ) { |
|
744 iLastRPCError = rerr; |
|
745 return ERR_RPC_ERROR; |
|
746 } |
|
747 return ERR_NONE; |
|
748 } |
|
749 |
|
750 |
|
751 /**************************************************************************************** |
|
752 * |
|
753 * PUBLIC FUNCTION: getstatus |
|
754 * |
|
755 ***************************************************************************************/ |
|
756 int CCMncontroller::getstatus( int aArgs, TMobileNodeStatus *rv ) |
|
757 { |
|
758 struct rpc_err rerr; |
|
759 |
|
760 // check the rv pointer |
|
761 if( rv == NULL ) { |
|
762 return ERR_INVALID_RV_POINTER; |
|
763 } |
|
764 |
|
765 // check that we have a connection |
|
766 if( cl == NULL ) { |
|
767 return ERR_STUB_NOT_CONNECTED; |
|
768 } |
|
769 |
|
770 // do the call |
|
771 *rv = *getstatus_5( &aArgs, cl ); |
|
772 |
|
773 // check for rpc errors and return the result |
|
774 clnt_geterr( cl, &rerr ); |
|
775 if( rerr.re_status != RPC_SUCCESS ) { |
|
776 iLastRPCError = rerr; |
|
777 return ERR_RPC_ERROR; |
|
778 } |
|
779 return ERR_NONE; |
|
780 } |
|
781 |
|
782 |
|
783 /**************************************************************************************** |
|
784 * |
|
785 * PUBLIC FUNCTION: listforeignagents |
|
786 * |
|
787 ***************************************************************************************/ |
|
788 int CCMncontroller::listforeignagents( int aArgs, TForeignAgentList *rv ) |
|
789 { |
|
790 struct rpc_err rerr; |
|
791 |
|
792 // check the rv pointer |
|
793 if( rv == NULL ) { |
|
794 return ERR_INVALID_RV_POINTER; |
|
795 } |
|
796 |
|
797 // check that we have a connection |
|
798 if( cl == NULL ) { |
|
799 return ERR_STUB_NOT_CONNECTED; |
|
800 } |
|
801 |
|
802 // do the call |
|
803 *rv = *listforeignagents_5( &aArgs, cl ); |
|
804 |
|
805 // check for rpc errors and return the result |
|
806 clnt_geterr( cl, &rerr ); |
|
807 if( rerr.re_status != RPC_SUCCESS ) { |
|
808 iLastRPCError = rerr; |
|
809 return ERR_RPC_ERROR; |
|
810 } |
|
811 return ERR_NONE; |
|
812 } |
|
813 |
|
814 |
|
815 /**************************************************************************************** |
|
816 * |
|
817 * PUBLIC FUNCTION: getforeignagentinfo |
|
818 * |
|
819 ***************************************************************************************/ |
|
820 int CCMncontroller::getforeignagentinfo( TForeignAgentInfoRequest aArgs, TForeignAgentInfo *rv ) |
|
821 { |
|
822 struct rpc_err rerr; |
|
823 |
|
824 // check the rv pointer |
|
825 if( rv == NULL ) { |
|
826 return ERR_INVALID_RV_POINTER; |
|
827 } |
|
828 |
|
829 // check that we have a connection |
|
830 if( cl == NULL ) { |
|
831 return ERR_STUB_NOT_CONNECTED; |
|
832 } |
|
833 |
|
834 // do the call |
|
835 *rv = *getforeignagentinfo_5( &aArgs, cl ); |
|
836 |
|
837 // check for rpc errors and return the result |
|
838 clnt_geterr( cl, &rerr ); |
|
839 if( rerr.re_status != RPC_SUCCESS ) { |
|
840 iLastRPCError = rerr; |
|
841 return ERR_RPC_ERROR; |
|
842 } |
|
843 return ERR_NONE; |
|
844 } |
|
845 |
|
846 |
|
847 /**************************************************************************************** |
|
848 * |
|
849 * PUBLIC FUNCTION: settimeout |
|
850 * |
|
851 ***************************************************************************************/ |
|
852 int CCMncontroller::settimeout( TTimeoutRequest aArgs ) |
|
853 { |
|
854 struct rpc_err rerr; |
|
855 |
|
856 // check that we have a connection |
|
857 if( cl == NULL ) { |
|
858 return ERR_STUB_NOT_CONNECTED; |
|
859 } |
|
860 |
|
861 // do the call |
|
862 settimeout_5( &aArgs, cl ); |
|
863 |
|
864 // check for rpc errors and return the result |
|
865 clnt_geterr( cl, &rerr ); |
|
866 if( rerr.re_status != RPC_SUCCESS ) { |
|
867 iLastRPCError = rerr; |
|
868 return ERR_RPC_ERROR; |
|
869 } |
|
870 return ERR_NONE; |
|
871 } |