0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* System Includes
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#include <assert.h>
|
|
23 |
#include <time.h>
|
|
24 |
|
|
25 |
|
|
26 |
/*******************************************************************************
|
|
27 |
*
|
|
28 |
* Local Includes
|
|
29 |
*
|
|
30 |
******************************************************************************/
|
|
31 |
#include "strncpynt.h"
|
|
32 |
#include "CForeignAgentServiceStub.h"
|
|
33 |
#include "CCFacontroller.h"
|
|
34 |
#include "../../Core/UCCS_ServiceValues.h"
|
|
35 |
#include "../../Core/UCCS_ErrorCodes.h"
|
|
36 |
|
|
37 |
|
|
38 |
/*******************************************************************************
|
|
39 |
*
|
|
40 |
* Definitions
|
|
41 |
*
|
|
42 |
******************************************************************************/
|
|
43 |
#define MAXBUFFERSIZE 2048
|
|
44 |
|
|
45 |
|
|
46 |
/*******************************************************************************
|
|
47 |
*
|
|
48 |
* Macro Functions
|
|
49 |
*
|
|
50 |
******************************************************************************/
|
|
51 |
|
|
52 |
|
|
53 |
/*******************************************************************************
|
|
54 |
*
|
|
55 |
* Constructor / Destructor
|
|
56 |
*
|
|
57 |
******************************************************************************/
|
|
58 |
CForeignAgentServiceStub::CForeignAgentServiceStub()
|
|
59 |
{
|
|
60 |
iClientForeignAgent = new CCFacontroller();
|
|
61 |
assert( iClientForeignAgent != NULL );
|
|
62 |
}
|
|
63 |
|
|
64 |
|
|
65 |
CForeignAgentServiceStub::~CForeignAgentServiceStub()
|
|
66 |
{
|
|
67 |
delete iClientForeignAgent;
|
|
68 |
}
|
|
69 |
|
|
70 |
|
|
71 |
/*******************************************************************************
|
|
72 |
*
|
|
73 |
* Startup / Shutdown
|
|
74 |
*
|
|
75 |
******************************************************************************/
|
|
76 |
int CForeignAgentServiceStub::StartUccsService( char *aHostName, int *aErrorCode, int *aUnused )
|
|
77 |
{
|
|
78 |
int client_stub_error;
|
|
79 |
|
|
80 |
// check params
|
|
81 |
assert( aHostName != NULL );
|
|
82 |
assert( aErrorCode != NULL );
|
|
83 |
*aErrorCode = 0;
|
|
84 |
|
|
85 |
//copy to class variable so that startRPCservice can use it later on
|
|
86 |
iHostName = aHostName;
|
|
87 |
|
|
88 |
// connect to the remote service
|
|
89 |
client_stub_error = iClientForeignAgent->Connect( iHostName );
|
|
90 |
|
|
91 |
// return the result
|
|
92 |
return client_stub_error;
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
int CForeignAgentServiceStub::StopUccsService( int *aErrorCode, int *aUnused )
|
|
97 |
{
|
|
98 |
int client_stub_error;
|
|
99 |
|
|
100 |
// check params
|
|
101 |
assert( aErrorCode != NULL );
|
|
102 |
*aErrorCode = 0;
|
|
103 |
|
|
104 |
// shutdown the stub -- force it to close
|
|
105 |
client_stub_error = iClientForeignAgent->Disconnect();
|
|
106 |
|
|
107 |
// done
|
|
108 |
return client_stub_error;
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
/*******************************************************************************
|
|
113 |
*
|
|
114 |
* IssueCommand
|
|
115 |
*
|
|
116 |
******************************************************************************/
|
|
117 |
CDataRecord* CForeignAgentServiceStub::IssueCommand( CDataRecord* aRequest )
|
|
118 |
{
|
|
119 |
int i, err, client_stub_error, method_id = -1;
|
|
120 |
CDataRecord *request_reply;
|
|
121 |
char *tmp_string;
|
|
122 |
|
|
123 |
int rv_integer, sarg_integer;
|
|
124 |
TComponentList rv_component_list;
|
|
125 |
TOptionDesc sarg_option;
|
|
126 |
TResult rv_result;
|
|
127 |
TStartupInfo sarg_startup_info;
|
|
128 |
TFaStatusInfo rv_fastatus;
|
|
129 |
TFaTunnelID sarg_tunnel_id;
|
|
130 |
TFaTunnelList rv_tunnel_list;
|
|
131 |
TTimeoutRequest sarg_timeout;
|
|
132 |
TStartAgentRequest sarg_start_agent_request;
|
|
133 |
TFaTunnelID *tmp_tunnel_id;
|
|
134 |
TGetTunnelRequest sarg_get_tunnel;
|
|
135 |
TFaTunnelInfo rv_tunnel_info;
|
|
136 |
|
|
137 |
// check params
|
|
138 |
assert( aRequest != NULL );
|
|
139 |
|
|
140 |
// create a standard reply
|
|
141 |
request_reply = CreateBaseReply( aRequest );
|
|
142 |
assert( request_reply != NULL );
|
|
143 |
|
|
144 |
// get and check the method_id
|
|
145 |
err = request_reply->GetFieldAsInt( "METHODID", &method_id );
|
|
146 |
if( method_id == -1 ) {
|
|
147 |
UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
|
|
148 |
return request_reply;
|
|
149 |
}
|
|
150 |
|
|
151 |
// now dispatch and call the appropriate method
|
|
152 |
switch( method_id ) {
|
|
153 |
|
|
154 |
// ss_startuprpcservice
|
|
155 |
case 1:
|
|
156 |
|
|
157 |
// extract the parameters
|
|
158 |
GETINTEGERARGUMENT( "BASEINTERFACEINDEX", &(sarg_startup_info.iBaseInterfaceIndex), 1, 0, aRequest, request_reply );
|
|
159 |
GETINTEGERARGUMENT( "NETMASK", &(sarg_startup_info.iNetworkMask), 2, 0, aRequest, request_reply );
|
|
160 |
GETINTEGERARGUMENT( "STARTHOSTADDRESSRANGE", &(sarg_startup_info.iStartHostAddressRange), 3, 0, aRequest, request_reply );
|
|
161 |
GETINTEGERARGUMENT( "STOPHOSTADDRESSRANGE", &(sarg_startup_info.iStopHostAddressRange), 4, 0, aRequest, request_reply );
|
|
162 |
|
|
163 |
// make the call and update the return value
|
|
164 |
client_stub_error = iClientForeignAgent->ss_startuprpcservice( sarg_startup_info, &rv_integer );
|
|
165 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
166 |
if( client_stub_error != ERR_NONE ) {
|
|
167 |
break;
|
|
168 |
}
|
|
169 |
|
|
170 |
// set the return values
|
|
171 |
request_reply->NewField( "RESULT", rv_integer );
|
|
172 |
break;
|
|
173 |
|
|
174 |
// sc_shutdownrpcservice
|
|
175 |
case 2:
|
|
176 |
|
|
177 |
// extract the parameters
|
|
178 |
GETINTEGERARGUMENT( "FORCE", &sarg_integer, 1, 1, aRequest, request_reply );
|
|
179 |
|
|
180 |
// make the call and update the return value
|
|
181 |
client_stub_error = iClientForeignAgent->sc_shutdownrpcservice( sarg_integer, &rv_integer );
|
|
182 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
183 |
if( client_stub_error != ERR_NONE ) {
|
|
184 |
break;
|
|
185 |
}
|
|
186 |
|
|
187 |
// set the return values
|
|
188 |
request_reply->NewField( "RESULT", rv_integer );
|
|
189 |
break;
|
|
190 |
|
|
191 |
// list_devices
|
|
192 |
case 30:
|
|
193 |
|
|
194 |
// make the call and update the return value
|
|
195 |
client_stub_error = iClientForeignAgent->list_devices( &rv_component_list );
|
|
196 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
197 |
if( client_stub_error != ERR_NONE ) {
|
|
198 |
break;
|
|
199 |
}
|
|
200 |
|
|
201 |
// set the return values
|
|
202 |
request_reply->NewField( "AGENTCOUNT", rv_component_list.TComponentList_len );
|
|
203 |
for( i = 0; i < rv_component_list.TComponentList_len; i++ ) {
|
|
204 |
AddIteratedIntegerFieldName( "AGENTID", i, (rv_component_list.TComponentList_val)[i], request_reply );
|
|
205 |
}
|
|
206 |
break;
|
|
207 |
|
|
208 |
// cstr_createagent
|
|
209 |
case 31:
|
|
210 |
|
|
211 |
//make the call and update the return value
|
|
212 |
client_stub_error = iClientForeignAgent->cstr_createagent( &rv_result );
|
|
213 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
214 |
if( client_stub_error != ERR_NONE ) {
|
|
215 |
break;
|
|
216 |
}
|
|
217 |
|
|
218 |
// set the return values
|
|
219 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
220 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
221 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
222 |
break;
|
|
223 |
|
|
224 |
// dstr_removeagent
|
|
225 |
case 32:
|
|
226 |
|
|
227 |
// extract the parameters
|
|
228 |
GETINTEGERARGUMENT( "AGENTID", &sarg_integer, 1, 0, aRequest, request_reply );
|
|
229 |
|
|
230 |
//make the call and update the return value
|
|
231 |
client_stub_error = iClientForeignAgent->dstr_removeagent( sarg_integer, &rv_integer );
|
|
232 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
233 |
if( client_stub_error != ERR_NONE ) {
|
|
234 |
break;
|
|
235 |
}
|
|
236 |
|
|
237 |
// set the return values
|
|
238 |
request_reply->NewField( "RESULT", rv_integer );
|
|
239 |
break;
|
|
240 |
|
|
241 |
// startmobileagent
|
|
242 |
case 3:
|
|
243 |
|
|
244 |
// extract the parameters
|
|
245 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_start_agent_request.iAgentID), 1, 0, aRequest, request_reply );
|
|
246 |
GETSTRINGARGUMENT( "INTERFACE", &tmp_string, 2, 0, aRequest, request_reply );
|
|
247 |
STRNCPY_NULL_TERMINATE( sarg_start_agent_request.iLowerInterface, tmp_string, X_MAXINTERFACENAMESIZE );
|
|
248 |
GETINTEGERARGUMENT( "SOLICITATIONMODE", (int*)&(sarg_start_agent_request.iSolicitationMode), 3, 0, aRequest, request_reply );
|
|
249 |
GETINTEGERARGUMENT( "INTERVAL", &(sarg_start_agent_request.iSolicitationInterval), 4, 1, aRequest, request_reply );
|
|
250 |
|
|
251 |
//make the call and update the return value
|
|
252 |
client_stub_error = iClientForeignAgent->startmobileagent( sarg_start_agent_request, &rv_result );
|
|
253 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
254 |
if( client_stub_error != ERR_NONE ) {
|
|
255 |
break;
|
|
256 |
}
|
|
257 |
|
|
258 |
// set the return values
|
|
259 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
260 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
261 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
262 |
break;
|
|
263 |
|
|
264 |
// stopmobileagent
|
|
265 |
case 4:
|
|
266 |
|
|
267 |
// extract the parameters
|
|
268 |
GETINTEGERARGUMENT( "AGENTID", &sarg_integer, 1, 0, aRequest, request_reply );
|
|
269 |
|
|
270 |
//make the call and update the return value
|
|
271 |
client_stub_error = iClientForeignAgent->stopmobileagent( sarg_integer, &rv_result );
|
|
272 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
273 |
if( client_stub_error != ERR_NONE ) {
|
|
274 |
break;
|
|
275 |
}
|
|
276 |
|
|
277 |
// set the return values
|
|
278 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
279 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
280 |
break;
|
|
281 |
|
|
282 |
// getmobileagentstatus
|
|
283 |
case 5:
|
|
284 |
|
|
285 |
// extract the parameters
|
|
286 |
GETINTEGERARGUMENT( "AGENTID", &sarg_integer, 1, 0, aRequest, request_reply );
|
|
287 |
|
|
288 |
// make the call and update the return value
|
|
289 |
client_stub_error = iClientForeignAgent->getmobileagentstatus( sarg_integer, &rv_result );
|
|
290 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
291 |
if( client_stub_error != ERR_NONE ) {
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
|
|
295 |
// set the return values
|
|
296 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
297 |
request_reply->NewField( "FOREIGN_AGENT_PROCESS_STATUS", rv_result.iData0 );
|
|
298 |
break;
|
|
299 |
|
|
300 |
// setsingleoption
|
|
301 |
case 6:
|
|
302 |
|
|
303 |
// extract the parameters
|
|
304 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_option.iAgentID), 1, 0, aRequest, request_reply );
|
|
305 |
GETSTRINGARGUMENT( "TOKEN", &tmp_string, 2, 0, aRequest, request_reply );
|
|
306 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionToken, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
307 |
GETSTRINGARGUMENT( "VALUE", &tmp_string, 3, 0, aRequest, request_reply );
|
|
308 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionValue, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
309 |
sarg_option.iOptionBlockStart[0] = sarg_option.iOptionBlockEnd[0] = 0;
|
|
310 |
|
|
311 |
// make the call and update the return value
|
|
312 |
client_stub_error = iClientForeignAgent->setsingleoption( sarg_option, &rv_result );
|
|
313 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
314 |
if( client_stub_error != ERR_NONE ) {
|
|
315 |
break;
|
|
316 |
}
|
|
317 |
|
|
318 |
// set the return values
|
|
319 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
320 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
321 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
322 |
break;
|
|
323 |
|
|
324 |
// removesingleoption
|
|
325 |
case 33:
|
|
326 |
|
|
327 |
// extract the parameters
|
|
328 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_option.iAgentID), 1, 0, aRequest, request_reply );
|
|
329 |
GETSTRINGARGUMENT( "TOKEN", &tmp_string, 2, 0, aRequest, request_reply );
|
|
330 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionToken, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
331 |
sarg_option.iOptionValue[0] = sarg_option.iOptionBlockStart[0] = sarg_option.iOptionBlockEnd[0] = 0;
|
|
332 |
|
|
333 |
// make the call and update the return value
|
|
334 |
client_stub_error = iClientForeignAgent->removesingleoption( sarg_option, &rv_result );
|
|
335 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
336 |
if( client_stub_error != ERR_NONE ) {
|
|
337 |
break;
|
|
338 |
}
|
|
339 |
|
|
340 |
// set the return values
|
|
341 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
342 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
343 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
344 |
break;
|
|
345 |
|
|
346 |
// addlistoption
|
|
347 |
case 7:
|
|
348 |
|
|
349 |
// extract the parameters
|
|
350 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_option.iAgentID), 1, 0, aRequest, request_reply );
|
|
351 |
GETSTRINGARGUMENT( "VALUE", &tmp_string, 2, 0, aRequest, request_reply );
|
|
352 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionValue, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
353 |
GETSTRINGARGUMENT( "BLOCKSTART", &tmp_string, 2, 0, aRequest, request_reply );
|
|
354 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionBlockStart, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
355 |
GETSTRINGARGUMENT( "BLOCKEND", &tmp_string, 2, 0, aRequest, request_reply );
|
|
356 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionBlockEnd, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
357 |
sarg_option.iOptionToken[0] = 0;
|
|
358 |
|
|
359 |
// make the call and update the return value
|
|
360 |
client_stub_error = iClientForeignAgent->addlistoption( sarg_option, &rv_result );
|
|
361 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
362 |
if( client_stub_error != ERR_NONE ) {
|
|
363 |
break;
|
|
364 |
}
|
|
365 |
|
|
366 |
// set the return values
|
|
367 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
368 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
369 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
370 |
break;
|
|
371 |
|
|
372 |
// removelistoption
|
|
373 |
case 8:
|
|
374 |
|
|
375 |
// extract the parameters
|
|
376 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_option.iAgentID), 1, 0, aRequest, request_reply );
|
|
377 |
GETSTRINGARGUMENT( "TOKEN", &tmp_string, 2, 0, aRequest, request_reply );
|
|
378 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionToken, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
379 |
GETSTRINGARGUMENT( "BLOCKSTART", &tmp_string, 2, 0, aRequest, request_reply );
|
|
380 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionBlockStart, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
381 |
GETSTRINGARGUMENT( "BLOCKEND", &tmp_string, 2, 0, aRequest, request_reply );
|
|
382 |
STRNCPY_NULL_TERMINATE( sarg_option.iOptionBlockEnd, tmp_string, X_MAXOPTIONTOKENSIZE );
|
|
383 |
sarg_option.iOptionValue[0] = 0;
|
|
384 |
|
|
385 |
// make the call and update the return value
|
|
386 |
client_stub_error = iClientForeignAgent->removelistoption( sarg_option, &rv_result );
|
|
387 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
388 |
if( client_stub_error != ERR_NONE ) {
|
|
389 |
break;
|
|
390 |
}
|
|
391 |
|
|
392 |
// set the return values
|
|
393 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
394 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
395 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
396 |
break;
|
|
397 |
|
|
398 |
// getstatus
|
|
399 |
case 9:
|
|
400 |
|
|
401 |
// extract the parameters
|
|
402 |
GETINTEGERARGUMENT( "AGENTID", &sarg_integer, 1, 0, aRequest, request_reply );
|
|
403 |
|
|
404 |
// make the call and update the return value
|
|
405 |
client_stub_error = iClientForeignAgent->getstatus( sarg_integer, &rv_fastatus );
|
|
406 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
407 |
if( client_stub_error != ERR_NONE ) {
|
|
408 |
break;
|
|
409 |
}
|
|
410 |
|
|
411 |
// set the return values
|
|
412 |
request_reply->NewField( "RESULT", rv_fastatus.iCallResult.iServiceResult );
|
|
413 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_fastatus.iCallResult.iSubComponentResult );
|
|
414 |
request_reply->NewField( "RESULT_DATA0", rv_fastatus.iCallResult.iData0 );
|
|
415 |
request_reply->NewField( "RESULT_DATA1", rv_fastatus.iCallResult.iData1 );
|
|
416 |
request_reply->NewField( "STATUS_ADVERTISEMENTS_SENT", rv_fastatus.iAdvertisementsSent );
|
|
417 |
request_reply->NewField( "STATUS_DISCARDED_MALFORMED", rv_fastatus.iDiscardedMalformed );
|
|
418 |
request_reply->NewField( "STATUS_DISCARDED_UNKNOWN_EXTENSION", rv_fastatus.iDiscardedUnknownExtension );
|
|
419 |
request_reply->NewField( "STATUS_DISCARDED_VENDOR", rv_fastatus.iDiscardedVendor );
|
|
420 |
request_reply->NewField( "STATUS_PENDING_REGISTRATION_REQUESTS", rv_fastatus.iPendingRegistrationRequests );
|
|
421 |
request_reply->NewField( "STATUS_REPLYS_ACCEPTED", rv_fastatus.iReplysAccepted );
|
|
422 |
request_reply->NewField( "STATUS_REPLYS_REJECTED", rv_fastatus.iReplysRejected );
|
|
423 |
request_reply->NewField( "STATUS_REQUESTS_ACCEPTED", rv_fastatus.iRequestsAccepted );
|
|
424 |
request_reply->NewField( "STATUS_REQUESTS_REJECTED", rv_fastatus.iRequestsRejected );
|
|
425 |
request_reply->NewField( "STATUS_TUNNEL_COUNT", rv_fastatus.iTunnelCount );
|
|
426 |
break;
|
|
427 |
|
|
428 |
|
|
429 |
// destroytunnelid
|
|
430 |
case 11:
|
|
431 |
|
|
432 |
// extract the parameters
|
|
433 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_tunnel_id.iAgentID), 1, 0, aRequest, request_reply );
|
|
434 |
GETSTRINGARGUMENT( "MNADDR", &tmp_string, 2, 0, aRequest, request_reply );
|
|
435 |
sarg_tunnel_id.iMobileNodeAddress = AddressToInt( tmp_string );
|
|
436 |
|
|
437 |
// make the call
|
|
438 |
client_stub_error = iClientForeignAgent->destroytunnelid( sarg_tunnel_id, &rv_result );
|
|
439 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
440 |
if( client_stub_error != ERR_NONE ) {
|
|
441 |
break;
|
|
442 |
}
|
|
443 |
|
|
444 |
// set the return values
|
|
445 |
request_reply->NewField( "RESULT", rv_result.iServiceResult );
|
|
446 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_result.iSubComponentResult );
|
|
447 |
request_reply->NewField( "RESULT_DATA0", rv_result.iData0 );
|
|
448 |
request_reply->NewField( "RESULT_DATA1", rv_result.iData1 );
|
|
449 |
break;
|
|
450 |
|
|
451 |
|
|
452 |
// listtunnels
|
|
453 |
case 12:
|
|
454 |
|
|
455 |
// extract the parameters
|
|
456 |
GETINTEGERARGUMENT( "AGENTID", &sarg_integer, 1, 0, aRequest, request_reply );
|
|
457 |
|
|
458 |
//make the call and update the return value
|
|
459 |
client_stub_error = iClientForeignAgent->listtunnels( sarg_integer, &rv_tunnel_list );
|
|
460 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
461 |
if( client_stub_error != ERR_NONE ) {
|
|
462 |
break;
|
|
463 |
}
|
|
464 |
|
|
465 |
// set the return values
|
|
466 |
request_reply->NewField( "TUNNEL_COUNT", rv_tunnel_list.TFaTunnelList_len );
|
|
467 |
for( i = 0; i < (signed)(rv_tunnel_list.TFaTunnelList_len); i++ ) {
|
|
468 |
tmp_tunnel_id = &((rv_tunnel_list.TFaTunnelList_val)[i]);
|
|
469 |
AddIteratedIntegerFieldName( "TUNNEL_ID", i, tmp_tunnel_id->iID, request_reply );
|
|
470 |
AddIteratedStringFieldName( "TUNNEL_MOBILE_NODE_HOME_ADDRESS", i, IntToAddress(tmp_tunnel_id->iMobileNodeAddress), request_reply );
|
|
471 |
AddIteratedStringFieldName( "TUNNEL_HOME_AGENT_ADDRESS", i, IntToAddress(tmp_tunnel_id->iHomeAgentAddress), request_reply );
|
|
472 |
}
|
|
473 |
|
|
474 |
// free the memory (if any was allocated)
|
|
475 |
if( rv_tunnel_list.TFaTunnelList_len > 0 ) {
|
|
476 |
XdrFree( (char**)&(rv_tunnel_list.TFaTunnelList_val), (int*)&(rv_tunnel_list.TFaTunnelList_len) );
|
|
477 |
}
|
|
478 |
break;
|
|
479 |
|
|
480 |
// settimeout
|
|
481 |
case 13:
|
|
482 |
|
|
483 |
// extract the parameters
|
|
484 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_timeout.iAgentID), 1, 0, aRequest, request_reply );
|
|
485 |
GETINTEGERARGUMENT( "TIMEOUT", &(sarg_timeout.iTimeout), 2, 0, aRequest, request_reply );
|
|
486 |
|
|
487 |
//make the call and update the return value
|
|
488 |
client_stub_error = iClientForeignAgent->settimeout( sarg_timeout );
|
|
489 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
490 |
if( client_stub_error != ERR_NONE ) {
|
|
491 |
break;
|
|
492 |
}
|
|
493 |
break;
|
|
494 |
|
|
495 |
// gettunnelinfo
|
|
496 |
case 15:
|
|
497 |
|
|
498 |
// extract the parameters
|
|
499 |
GETINTEGERARGUMENT( "AGENTID", &(sarg_get_tunnel.iAgentID), 1, 0, aRequest, request_reply );
|
|
500 |
GETSTRINGARGUMENT( "MOBILE_NODE_HOME_ADDRESS", &tmp_string, 2, 0, aRequest, request_reply );
|
|
501 |
sarg_get_tunnel.iMobileNodeAddress = AddressToInt( tmp_string );
|
|
502 |
|
|
503 |
//make the call and update the return value
|
|
504 |
client_stub_error = iClientForeignAgent->gettunnelinfo( sarg_get_tunnel, &rv_tunnel_info );
|
|
505 |
UpdateCompletionCode( request_reply, client_stub_error );
|
|
506 |
if( client_stub_error != ERR_NONE ) {
|
|
507 |
break;
|
|
508 |
}
|
|
509 |
|
|
510 |
// set the result
|
|
511 |
request_reply->NewField( "RESULT", rv_tunnel_info.iCallResult.iServiceResult );
|
|
512 |
request_reply->NewField( "RESULT_SUB_COMPONENT", rv_tunnel_info.iCallResult.iSubComponentResult );
|
|
513 |
request_reply->NewField( "RESULT_DATA0", rv_tunnel_info.iCallResult.iData0 );
|
|
514 |
request_reply->NewField( "RESULT_DATA1", rv_tunnel_info.iCallResult.iData1 );
|
|
515 |
request_reply->NewField( "MOBILE_NODE_ADDRESS", IntToAddress(rv_tunnel_info.iMobileNodeAddress) );
|
|
516 |
request_reply->NewField( "CAREOF_ADDRESS", IntToAddress(rv_tunnel_info.iCareofAddress) );
|
|
517 |
request_reply->NewField( "HOME_AGENT_ADDRESS", IntToAddress(rv_tunnel_info.iHomeAgentAddress) );
|
|
518 |
request_reply->NewField( "CREATION_TIME", ctime((time_t*)&(rv_tunnel_info.iCreationTime)) );
|
|
519 |
request_reply->NewField( "EXPIRATION_TIME", ctime((time_t*)&(rv_tunnel_info.iExpirationTime)) );
|
|
520 |
request_reply->NewField( "REFRESH_TIME", ctime((time_t*)&(rv_tunnel_info.iRefreshTime)) );
|
|
521 |
request_reply->NewField( "LAST_TIMESTAMP", ctime((time_t*)&(rv_tunnel_info.iLastTimestamp)) );
|
|
522 |
request_reply->NewField( "HOME_AGENT_ID", rv_tunnel_info.iPrivateHomeAgentID );
|
|
523 |
request_reply->NewField( "SPI", rv_tunnel_info.iSPI );
|
|
524 |
request_reply->NewField( "TIMEOUT", rv_tunnel_info.iTimeout );
|
|
525 |
break;
|
|
526 |
|
|
527 |
// Any other method id results in an invalid method id result
|
|
528 |
default:
|
|
529 |
UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
|
|
530 |
break;
|
|
531 |
}
|
|
532 |
|
|
533 |
// everything should be handled above
|
|
534 |
return request_reply;
|
|
535 |
}
|
|
536 |
|
|
537 |
|
|
538 |
/*******************************************************************************
|
|
539 |
*
|
|
540 |
* GetLastRPCError()
|
|
541 |
*
|
|
542 |
******************************************************************************/
|
|
543 |
char *CForeignAgentServiceStub::GetLastRPCError( int *aIntError )
|
|
544 |
{
|
|
545 |
return iClientForeignAgent->GetLastRPCError( aIntError );
|
|
546 |
}
|
|
547 |
|
|
548 |
|
|
549 |
/*******************************************************************************
|
|
550 |
*
|
|
551 |
* GetStatus()
|
|
552 |
*
|
|
553 |
******************************************************************************/
|
|
554 |
int CForeignAgentServiceStub::GetStatus()
|
|
555 |
{
|
|
556 |
assert( !"GetStatus() - is not implemented" );
|
|
557 |
return -1;
|
|
558 |
}
|