|
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 // IPProto Connection Provider class definition. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef SYMBIAN_IPPROTOCPR_H |
|
24 #define SYMBIAN_IPPROTOCPR_H |
|
25 |
|
26 #include <comms-infras/corecpr.h> |
|
27 #include <comms-infras/ss_nodemessages_legacy.h> |
|
28 #include <comms-infras/ss_datamonitoringprovider.h> |
|
29 |
|
30 #include "idletimer.h" |
|
31 |
|
32 #if defined __CFLOG_ACTIVE || defined SYMBIAN_TRACE_ENABLE |
|
33 #define KIPProtoCprTag KESockConnectionTag |
|
34 _LIT8(KIPProtoCprSubTag, "ipprotocpr"); |
|
35 #endif |
|
36 |
|
37 namespace IpProtoCpr |
|
38 { |
|
39 class TStoreProvision; |
|
40 class TSendStarted; |
|
41 class TDoOpenCloseRoute; |
|
42 class TProcessDataClientStatusChange; |
|
43 class TAwaitingStart; |
|
44 class TCleanupStart; |
|
45 class TCheckIfLastControlClientLeaving; |
|
46 class TAwaitingGoneDown; |
|
47 class TLinkDown; |
|
48 class TLinkUp; |
|
49 class TStoreAndForwardStateChange; |
|
50 |
|
51 } |
|
52 |
|
53 namespace ESock |
|
54 { |
|
55 class MPlatsecApiExt; |
|
56 class MLegacyControlApiExt; |
|
57 class ADataMonitoringProvider; |
|
58 class ADataMonitoringProtocolReq; |
|
59 class TDataMonitoringConnProvisioningInfo; |
|
60 } |
|
61 |
|
62 NONSHARABLE_CLASS(CIPProtoConnectionProvider) : public CCoreConnectionProvider, |
|
63 public ESock::ADataMonitoringProvider, |
|
64 public ESock::MLegacyControlApiExt, |
|
65 public ESock::ALegacySubConnectionActiveApiExt, |
|
66 public ESock::ALegacyEnumerateSubConnectionsApiExt, |
|
67 public ITFHIERARCHY_LINK_5(CIPProtoConnectionProvider, |
|
68 CCoreConnectionProvider, |
|
69 ESock::ADataMonitoringProtocolReq, |
|
70 ESock::MLinkCprApiExt, |
|
71 ESock::MLegacyControlApiExt, |
|
72 ESock::ALegacySubConnectionActiveApiExt, |
|
73 ESock::ALegacyEnumerateSubConnectionsApiExt) |
|
74 /** |
|
75 IPProto connection provider |
|
76 |
|
77 @internalTechnology |
|
78 @released Since 9.4 |
|
79 */ |
|
80 { |
|
81 friend class CIPProtoConnectionProviderFactory; |
|
82 friend class IpProtoCpr::TStoreProvision; |
|
83 friend class IpProtoCpr::TDoOpenCloseRoute; |
|
84 friend class TEnumerateConnectionsQuery; |
|
85 friend class IpProtoCpr::TProcessDataClientStatusChange; |
|
86 friend class IpProtoCpr::TSendStarted; |
|
87 friend class IpProtoCpr::TAwaitingStart; |
|
88 friend class IpProtoCpr::TAwaitingGoneDown; |
|
89 friend class IpProtoCpr::TCleanupStart; |
|
90 friend class IpProtoCpr::TCheckIfLastControlClientLeaving; |
|
91 friend class IpProtoCpr::TLinkDown; |
|
92 friend class IpProtoCpr::TLinkUp; |
|
93 friend class IpProtoCpr::TStoreAndForwardStateChange; |
|
94 friend class CLinkCprExtensionApi; |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 public: |
|
100 typedef ITFHIERARCHY_LINK_5(CIPProtoConnectionProvider, |
|
101 CCoreConnectionProvider, |
|
102 ESock::ADataMonitoringProtocolReq, |
|
103 ESock::MLinkCprApiExt, |
|
104 ESock::MLegacyControlApiExt, |
|
105 ALegacySubConnectionActiveApiExt, |
|
106 ESock::ALegacyEnumerateSubConnectionsApiExt) TIfStaticFetcherNearestInHierarchy; |
|
107 |
|
108 public: |
|
109 static CIPProtoConnectionProvider* NewL(ESock::CConnectionProviderFactoryBase& aFactory); |
|
110 virtual ~CIPProtoConnectionProvider(); |
|
111 |
|
112 public: |
|
113 void ReturnInterfacePtrL(ADataMonitoringProtocolReq*& aInterface); |
|
114 void ReturnInterfacePtrL(ESock::MLinkCprApiExt*& aInterface); |
|
115 void ReturnInterfacePtrL(ESock::MLegacyControlApiExt*& aInterface); |
|
116 void ReturnInterfacePtrL(ESock::ALegacySubConnectionActiveApiExt*& aInterface); |
|
117 void ReturnInterfacePtrL(ESock::ALegacyEnumerateSubConnectionsApiExt*& aInterface); |
|
118 |
|
119 // From MLegacyControlApiExt |
|
120 virtual TInt ControlL(TUint aOptionLevel, TUint aOptionName, TDes8& aOption, ESock::MPlatsecApiExt* aPlatsecItf); |
|
121 |
|
122 void DataClientIdle(); |
|
123 |
|
124 // From ALegacyEnumerateSubConnectionsApiExt |
|
125 virtual void EnumerateSubConnections(ESock::CLegacyEnumerateSubConnectionsResponder*& aResponder); |
|
126 virtual void GetSubConnectionInfo(TSubConnectionInfo &aInfo); |
|
127 |
|
128 protected: |
|
129 enum TTimerType { ETimerUnknown, ETimerShort, ETimerMedium, ETimerLong, ETimerImmediate, ETimerMax }; |
|
130 |
|
131 protected: |
|
132 CIPProtoConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap); |
|
133 void ConstructL(); |
|
134 |
|
135 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
136 virtual void Received(MeshMachine::TNodeContextBase& aContext); |
|
137 |
|
138 private: |
|
139 class COneShotTimer : public CTimer |
|
140 { |
|
141 public: |
|
142 static COneShotTimer* NewL(TInt aPriority, CIPProtoConnectionProvider* aOwner); |
|
143 |
|
144 protected: |
|
145 COneShotTimer(TInt aPriority, CIPProtoConnectionProvider* aOwner); |
|
146 void ConstructL(); |
|
147 |
|
148 protected: |
|
149 virtual void RunL(); |
|
150 |
|
151 private: |
|
152 CIPProtoConnectionProvider* iOwner; |
|
153 }; |
|
154 |
|
155 private: |
|
156 void SetUsageProfile(TInt aProfile); |
|
157 void TimerExpired(); |
|
158 void TimerComplete(TInt aError); |
|
159 void SetTimerMode(TTimerType aTimerMode); |
|
160 void TimerAfter(TInt aInterval); |
|
161 TTimerType DecideTimerMode(TInt aRouteCount); |
|
162 void StartNextTick(); |
|
163 void LinkUp(); |
|
164 void LinkDown(); |
|
165 TInt ControlClientsCount(); |
|
166 void SetTimers(TUint32 aShortTimer, TUint32 aMediumTimer, TUint32 aLongTimer); |
|
167 void OpenRoute(); |
|
168 void CloseRoute(); |
|
169 void CancelTimer(); |
|
170 void ResetTimer(); |
|
171 void DisableTimers(); |
|
172 void EnableTimers(); |
|
173 void StopConnection(); |
|
174 void ForceCheckShortTimerMode(); |
|
175 |
|
176 private: |
|
177 COneShotTimer* iTimer; |
|
178 TInt iTimerMode; |
|
179 TInt iTickThreshold[ETimerMax]; |
|
180 TInt iExpiredTicks; |
|
181 TInt iTotalTimerDrift; |
|
182 TTime iDriftCheckTime; |
|
183 ESock::TDataMonitoringConnProvisioningInfo iDataMonitoringConnProvisioningInfo; |
|
184 TInt iLastControlClientsCount; |
|
185 TInt iRouteCount; |
|
186 TBool iRouteCountStretchOne; |
|
187 TBool iPeriodActivity; |
|
188 TInt iTimerDisableCount; |
|
189 TTime iStartTime; |
|
190 TBool iLinkUp:1; |
|
191 TBool iConnectionControlActivity:1; |
|
192 TBool iTimerExpired:1; |
|
193 TBool iTimerRunning:1; |
|
194 TBool iSubConnEventDataSent:1; // Hack to cope with multiple DataClientStatusChange notifications for 'stopped' |
|
195 TBool iNodeLocalExtensionsCreated; |
|
196 ESock::RMetaExtensionContainer iNodeLocalExtensions; |
|
197 }; |
|
198 |
|
199 |
|
200 #endif //SYMBIAN_IPPROTOCPR_H |
|
201 |