1 // Copyright (c) 1997-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #ifndef __SS_CONNLEGACY_H__
22 #define __SS_CONNLEGACY_H__
25 #include <elements/factorynotify.h>
26 #include <es_sock.h> //TNifProgressBuf & co
27 #include <es_prot.h> //TConnStartType &co
29 #include <comms-infras/ss_nodemessages_legacy.h>
30 #include <comms-infras/ss_nodemessages_legacy_internal.h>
31 #include <comms-infras/ss_legacyinterfaces.h>
36 const TInt KNifEMCompatibilityLayerEntireSubConnectionUid = 0;
37 const TInt KNifEMCompatibilityLayerFakeSubConnectionId = 1;
41 class TProcessEnumResponse;
42 class TNoTagOrCancelAllInterfaceWorker;
43 class TCancelAllInterfaceNotificationWorker;
46 namespace AllInterfaceNotificationActivity
48 class TEnqueueNotification;
49 class TSendErrorToConnection;
52 namespace EnumerateConnectionsActivity
54 class TQueryTierStatus;
55 class TCacheConnectionInfo;
56 class TCompleteClient;
61 class ADataMonitoringProvider;
64 class CConnectionProviderBase;
66 class TSelectionPrefs;
67 class TLegacyConnectionEnumRequest;
68 class CLegacySubConnectionActiveResponder;
71 Server side class representing an RConnection legacy API
74 NONSHARABLE_CLASS(AConnectionLegacy)
76 friend class CConnection;
77 friend class CSockSession;
78 friend class Factories::TFactoryNotify<AConnectionLegacy>;
79 friend class CActivityTimer;
80 friend class ConnStates::TProcessEnumResponse;
81 friend class TLegacyConnectionEnumRequest;
82 friend class EnumerateConnectionsActivity::TQueryTierStatus;
83 friend class EnumerateConnectionsActivity::TCacheConnectionInfo;
84 friend class EnumerateConnectionsActivity::TCompleteClient;
85 friend class AllInterfaceNotificationActivity::TEnqueueNotification;
86 friend class AllInterfaceNotificationActivity::TSendErrorToConnection;
87 friend class ConnStates::TNoTagOrCancelAllInterfaceWorker;
88 friend class ConnStates::TCancelAllInterfaceNotificationWorker;
90 public: //So that friends of CConnection (transitions) can access it
91 void CompleteAttachL(TSelectionPrefs& aPrefs);
92 void CancelServiceChangeNotification(const Den::RSafeMessage& aMessage);
93 void SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent);
96 AConnectionLegacy(CConnection& aConnection) :
97 iConnection(aConnection)
99 iServiceChangeNotificationPending = EFalse;
102 ~AConnectionLegacy();
103 TInt ProcessMessageL(const RMessage2& aMessage);
104 void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); //Only called from CConnection::ReceivedL
107 // Underlying implementations of individual RConnection methods
108 void StopL(const RMessage2& aMessage);
110 void GetIntSettingL(const Den::RSafeMessage& aMessage);
111 void GetBoolSettingL(const Den::RSafeMessage& aMessage);
112 void GetDes8SettingL(const Den::RSafeMessage& aMessage);
113 void GetDes16SettingL(const Den::RSafeMessage& aMessage);
114 void GetLongDesSettingL(const Den::RSafeMessage& aMessage);
115 void GetConnectionInfoL(const RMessage2& aMessage);
117 void AllInterfaceNotificationL(const RMessage2& aMessage);
118 void CompleteAllInterfaceNotificationL(TInt aError);
119 void CancelAllInterfaceNotification();
121 void DataTransferredL(const Den::RSafeMessage& aMessage);
122 void DataSentNotificationRequestL(const Den::RSafeMessage& aMessage);
123 void DataSentNotificationCancel(const Den::RSafeMessage& aMessage);
124 void DataReceivedNotificationRequestL(const Den::RSafeMessage& aMessage);
125 void DataReceivedNotificationCancel(const Den::RSafeMessage& aMessage);
126 void DataMonitoringNotificationRequestL(const Den::RSafeMessage& aMessage, TDataMonitoringDirection aDirection);
127 void DataMonitoringNotificationCancel(const Den::RSafeMessage& aMessage, TDataMonitoringDirection aDirection);
129 void IsSubConnectionActiveRequestL(const Den::RSafeMessage& aMessage);
130 void IsSubConnectionActiveCancel(const Den::RSafeMessage& aMessage);
132 void ExtractEnumInfoL(RBuf8& aBuffer, TUint aCount, TInt aSize, TUint aIndex, TDes8& aPckg);
133 void EnumerateConnectionClientsL();
134 void GetConnectionClientInfoL();
135 void RequestDataPlaneEnumerationL(TLegacyConnEnumClients aClientType);
136 void EnumerateConnectionSocketsL();
137 void CompleteDataPlaneEnumeration(const Messages::TNodeId& aPeer, TInt aCount, HBufC8* aInfo, TInt aError);
138 void GetConnectionSocketInfoL();
139 void ServiceChangeNotification(TUint32 aId, const TDesC& aType);
140 void FinalCompleteAllBlockedMessages(TInt aResult);
141 void CancelProviderRequests();
144 #ifndef AVAILABILITY_READY
145 void EnumerateConnectionsL(const RMessage2& aMessage);
148 // SubConnection-oriented RConnection method support
149 void EnumerateSubConnectionsL(const Den::RSafeMessage& aMessage);
150 void GetSubConnectionInfoL(const Den::RSafeMessage& aMessage);
152 static TBool DoesConnectionInfoExist(const TDesC8& aInfoBuf, const TConnectionClientInfo& aInfo);
154 ADataMonitoringProvider* FetchConnDataMonitoringProvider() const;
155 ADataMonitoringProvider* FetchSubConnDataMonitoringProvider() const;
157 //global notifications
158 void InterfaceStateChangeNotification(TDesC8& aInfo);
159 void RequestServiceChangeNotificationL(const Den::RSafeMessage& aMessage);
160 void ControlL(TUint aOptionName, TUint aMessageId);
162 // Underlying implementations of individual RConnection methods relating to subconnections
163 void AllSubConnectionNotificationL();
164 void CancelAllSubConnectionNotification();
167 RMessage2 iAllSubConnectionNotificationMessage;
169 TInterfaceChangeQueue iInterfaceChangeQueue; // queue of interface notifications received
171 TUint iConnectionInfoCount;
172 TUint iConnectionClientCount;
173 RBuf8 iConnectionClientBuf;
174 TUint iConnectionSocketCount;
175 RBuf8 iConnectionSocketBuf;
176 Den::RSafeMessage iEnumConnMsg; //< During a Data plane enum holds blocked client msg
177 TUint* iDPEnumCount; //< During a Data plane enum points to count recipient
178 RBuf8* iDPEnumBuf; //< During a Data plane enum points to data buf
179 RArray<Messages::TNodeId> iEnumConnSockCandidateSCPRs; //< During a Data plane enum is list of SCPRs for connection
181 RMessage2* iMessage; //current message valid only within ProcessMessageL call
182 CConnection& iConnection;
184 RPointerArray<CSubConnection> iSubConnections; //client classes servicing sub-connection
185 //related functionality requested via legacy RConnection API. sub-connections
186 //objects are owned by AConnectionLegacy instance and don't have RSubConnection
188 CConnManager* iConnManager; //client class servicing connection manager
189 //related functionality requested via legacy RConnection API. CConnManager
190 //object is owned by AConnectionLegacy instance and does't have RConnManager
192 // Flags for pending RConnection requests
193 TBool iServiceChangeNotificationPending;
195 // IsSubConnectionActive support
196 ADataMonitoringProvider* iConnActivityDataMonProv;
197 ESock::CActivityTimer* iActivityTimer;
198 TBool iClientsSubConnectionActiveState;
199 TUint iInitialSentDataVolume;
200 TUint iInitialReceivedDataVolume;
201 TUint iRequestedClientActivityTimerPeriod;
202 TBool iOutstandingIsSubConnectionActiveRequest;
203 RMessage2 iOutstandingIsSubConnectionActiveMessage;
205 TBool iDeferredSubConnectionNotificationEnable;
206 TSubConnectionEventQueue iSubConnectionEventQueue; // queue of subconnection events received
208 // EnumerateConnection and GetConnectionInfo use this.
209 RPointerArray<TSourcedConnectionInfo> iConnectionInfoPtrArray;
211 // AllInterfaceNotification support
212 RMessage2 iAllInterfaceNotificationMessage;
213 TInterfaceChangeQueue iNotificationQueue;
214 Messages::TNodeId iAllInterfaceNotificationWorker;
217 static const TAnyFn iInterfaceVTableF[];
224 // __SS_CONNLEGACY_H__