|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // RawIPMCPR.CPP |
|
15 // RawIP MCPR |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #include <comms-infras/nifprvar.h> // for TAgentToFlowEventType |
|
25 #include <comms-infras/linkprovision.h> |
|
26 #include "RawIpAgentHandler.h" |
|
27 |
|
28 using namespace ESock; |
|
29 |
|
30 void CRawIpAgentHandler::ConnectCompleteL() |
|
31 /** |
|
32 RawIp handler called on Agent ConnectComplete(). |
|
33 |
|
34 Allocate and populate the provisioning structure. |
|
35 */ |
|
36 { |
|
37 // If not already poresent, allocate and append the provisioning structure. Assumed to be |
|
38 // cleaned up by CAccessPointConfig. |
|
39 |
|
40 if (iProvision == NULL) |
|
41 { |
|
42 CRawIpAgentConfig* provision = new (ELeave) CRawIpAgentConfig(); |
|
43 CleanupStack::PushL(provision); |
|
44 AppendExtensionL(provision); |
|
45 CleanupStack::Pop(provision); // ownership given to CAccessPointConfig |
|
46 |
|
47 iProvision = provision; // cache pointer to provisioning structure (no ownership) |
|
48 } |
|
49 |
|
50 // The following calls towards the Agent will trigger Notification() calls from Agent back |
|
51 // towards us (in the same stack frame). These will be processed in NotificationFromAgent(). |
|
52 NotificationToAgent(EFlowToAgentEventTsyConfig, NULL); |
|
53 NotificationToAgent(EFlowToAgentEventTsyConnectionSpeed, NULL); |
|
54 } |
|
55 |
|
56 TInt CRawIpAgentHandler::NotificationFromAgent(TAgentToFlowEventType aEvent, TAny* aInfo) |
|
57 /** |
|
58 RawIp handler called on Agent Notification() calls towards CFProtocol. |
|
59 |
|
60 @param aEvent event type |
|
61 @param aInfo free form data associated with event |
|
62 */ |
|
63 { |
|
64 switch (aEvent) |
|
65 { |
|
66 case EAgentToFlowEventTsyConfig: |
|
67 // NOTE: |
|
68 // We are presuming that the object pointed to by "aInfo" is on the heap of the Agent and |
|
69 // not on the stack. This sounds risky, but we are following the same conditions as |
|
70 // with old Nifs and Agents - the Notification() method was used to communicate a pointer |
|
71 // from Agent to Nif of a structure whose lifetime was guaranteed longer than that of the |
|
72 // Nif. This hasn't changed with the introduction of CFProtocols. Alternatively, we would |
|
73 // have allocate space for and copy the (very large - several K) TContextConfigGPRS. |
|
74 iProvision->iGprsConfig = reinterpret_cast<const TPacketDataConfigBase*>(aInfo); |
|
75 break; |
|
76 |
|
77 case EAgentToFlowEventTsyConnectionSpeed: |
|
78 if (aInfo != NULL) |
|
79 iProvision->iConnectionSpeed = *reinterpret_cast<TUint*>(aInfo); |
|
80 break; |
|
81 |
|
82 default: |
|
83 // Default handling |
|
84 return CAgentNotificationHandler::NotificationFromAgent(aEvent, aInfo); |
|
85 } |
|
86 |
|
87 return KErrNone; |
|
88 } |