datacommsserver/esockserver/inc/ss_connLegacy.h
changeset 0 dfb7c4ff071f
child 1 21d2ab05f085
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #ifndef __SS_CONNLEGACY_H__
       
    22 #define __SS_CONNLEGACY_H__
       
    23 
       
    24 #include <e32def.h>
       
    25 #include <elements/factorynotify.h>
       
    26 #include <es_sock.h> //TNifProgressBuf & co
       
    27 #include <es_prot.h> //TConnStartType &co
       
    28 #include <ss_std.h>
       
    29 #include <comms-infras/ss_nodemessages_legacy.h>
       
    30 #include <comms-infras/ss_nodemessages_legacy_internal.h>
       
    31 #include <comms-infras/ss_legacyinterfaces.h>
       
    32 
       
    33 class TSockOpt;
       
    34 class CActivityTimer;
       
    35 
       
    36 const TInt KNifEMCompatibilityLayerEntireSubConnectionUid = 0;
       
    37 const TInt KNifEMCompatibilityLayerFakeSubConnectionId = 1;
       
    38 
       
    39 namespace ConnStates
       
    40 {
       
    41 class TProcessEnumResponse;
       
    42 class TNoTagOrCancelAllInterfaceWorker;
       
    43 class TCancelAllInterfaceNotificationWorker;
       
    44 }
       
    45 
       
    46 namespace AllInterfaceNotificationActivity
       
    47 {
       
    48 class TEnqueueNotification;
       
    49 }
       
    50 
       
    51 namespace EnumerateConnectionsActivity
       
    52 {
       
    53 class TQueryTierStatus;
       
    54 class TCacheConnectionInfo;
       
    55 class TCompleteClient;
       
    56 }
       
    57 
       
    58 namespace ESock
       
    59 {
       
    60 class ADataMonitoringProvider;
       
    61 class CSubConnection;
       
    62 class CConnManager;
       
    63 class CConnectionProviderBase;
       
    64 class CActivityTimer;
       
    65 class TSelectionPrefs;
       
    66 class TLegacyConnectionEnumRequest;
       
    67 class CLegacySubConnectionActiveResponder;
       
    68 
       
    69 /**
       
    70 Server side class representing an RConnection legacy API
       
    71 @internalComponent
       
    72 */
       
    73 NONSHARABLE_CLASS(AConnectionLegacy)
       
    74 	{
       
    75 	friend class CConnection;
       
    76 	friend class CSockSession;
       
    77 	friend class Factories::TFactoryNotify<AConnectionLegacy>;
       
    78 	friend class CActivityTimer;
       
    79 	friend class ConnStates::TProcessEnumResponse;
       
    80 	friend class TLegacyConnectionEnumRequest;
       
    81 	friend class EnumerateConnectionsActivity::TQueryTierStatus;
       
    82 	friend class EnumerateConnectionsActivity::TCacheConnectionInfo;
       
    83 	friend class EnumerateConnectionsActivity::TCompleteClient;
       
    84 	friend class AllInterfaceNotificationActivity::TEnqueueNotification;
       
    85 	friend class ConnStates::TNoTagOrCancelAllInterfaceWorker;
       
    86 	friend class ConnStates::TCancelAllInterfaceNotificationWorker;
       
    87 
       
    88 public: //So that friends of CConnection (transitions) can access it
       
    89 	void CompleteAttachL(TSelectionPrefs& aPrefs);
       
    90 	void CancelServiceChangeNotification(const Den::RSafeMessage& aMessage);
       
    91     void SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent);
       
    92 
       
    93 protected:
       
    94     AConnectionLegacy(CConnection& aConnection) :
       
    95         iConnection(aConnection)
       
    96             {
       
    97             iServiceChangeNotificationPending = EFalse;
       
    98             }
       
    99 
       
   100     ~AConnectionLegacy();
       
   101 	TInt ProcessMessageL(const RMessage2& aMessage);
       
   102 	void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); //Only called from CConnection::ReceivedL
       
   103 
       
   104 private:
       
   105 	// Underlying implementations of individual RConnection methods
       
   106 	void StopL(const RMessage2& aMessage);
       
   107 
       
   108 	void GetIntSettingL(const Den::RSafeMessage& aMessage);
       
   109 	void GetBoolSettingL(const Den::RSafeMessage& aMessage);
       
   110 	void GetDes8SettingL(const Den::RSafeMessage& aMessage);
       
   111 	void GetDes16SettingL(const Den::RSafeMessage& aMessage);
       
   112 	void GetLongDesSettingL(const Den::RSafeMessage& aMessage);
       
   113 	void GetConnectionInfoL(const RMessage2& aMessage);
       
   114 
       
   115 	void AllInterfaceNotificationL(const RMessage2& aMessage);
       
   116 	void CompleteAllInterfaceNotificationL(TInt aError);
       
   117 	void CancelAllInterfaceNotification();
       
   118 
       
   119 	void DataTransferredL(const Den::RSafeMessage& aMessage);
       
   120 	void DataSentNotificationRequestL(const Den::RSafeMessage& aMessage);
       
   121 	void DataSentNotificationCancel(const Den::RSafeMessage& aMessage);
       
   122 	void DataReceivedNotificationRequestL(const Den::RSafeMessage& aMessage);
       
   123 	void DataReceivedNotificationCancel(const Den::RSafeMessage& aMessage);
       
   124 	void DataMonitoringNotificationRequestL(const Den::RSafeMessage& aMessage, TDataMonitoringDirection aDirection);
       
   125 	void DataMonitoringNotificationCancel(const Den::RSafeMessage& aMessage, TDataMonitoringDirection aDirection);
       
   126 
       
   127 	void IsSubConnectionActiveRequestL(const Den::RSafeMessage& aMessage);
       
   128 	void IsSubConnectionActiveCancel(const Den::RSafeMessage& aMessage);
       
   129 
       
   130 	void ExtractEnumInfoL(RBuf8& aBuffer, TUint aCount, TInt aSize, TUint aIndex, TDes8& aPckg);
       
   131 	void EnumerateConnectionClientsL();
       
   132 	void GetConnectionClientInfoL();
       
   133 	void RequestDataPlaneEnumerationL(TLegacyConnEnumClients aClientType);
       
   134 	void EnumerateConnectionSocketsL();
       
   135 	void CompleteDataPlaneEnumeration(const Messages::TNodeId& aPeer, TInt aCount, HBufC8* aInfo, TInt aError);
       
   136 	void GetConnectionSocketInfoL();
       
   137     void ServiceChangeNotification(TUint32 aId, const TDesC& aType);
       
   138 	void FinalCompleteAllBlockedMessages(TInt aResult);
       
   139 	void CancelProviderRequests();
       
   140 
       
   141 
       
   142 #ifndef AVAILABILITY_READY
       
   143 	void EnumerateConnectionsL(const RMessage2& aMessage);
       
   144 #endif
       
   145 
       
   146 	// SubConnection-oriented RConnection method support
       
   147 	void EnumerateSubConnectionsL(const Den::RSafeMessage& aMessage);
       
   148 	void GetSubConnectionInfoL(const Den::RSafeMessage& aMessage);
       
   149 
       
   150 	static TBool DoesConnectionInfoExist(const TDesC8& aInfoBuf, const TConnectionClientInfo& aInfo);
       
   151 protected:
       
   152 	ADataMonitoringProvider* FetchConnDataMonitoringProvider() const;
       
   153 	ADataMonitoringProvider* FetchSubConnDataMonitoringProvider() const;
       
   154 
       
   155 	//global notifications
       
   156 	void InterfaceStateChangeNotification(TDesC8& aInfo);
       
   157 	void RequestServiceChangeNotificationL(const Den::RSafeMessage& aMessage);
       
   158     void ControlL(TUint aOptionName, TUint aMessageId);
       
   159 
       
   160 	// Underlying implementations of individual RConnection methods relating to subconnections
       
   161     void AllSubConnectionNotificationL();
       
   162     void CancelAllSubConnectionNotification();
       
   163 
       
   164 private:
       
   165 	RMessage2 iAllSubConnectionNotificationMessage;
       
   166 
       
   167 	TInterfaceChangeQueue iInterfaceChangeQueue;	// queue of interface notifications received
       
   168 
       
   169 	TUint iConnectionInfoCount;
       
   170 	TUint iConnectionClientCount;
       
   171 	RBuf8 iConnectionClientBuf;
       
   172 	TUint iConnectionSocketCount;
       
   173 	RBuf8 iConnectionSocketBuf;
       
   174 	Den::RSafeMessage iEnumConnMsg;	//< During a Data plane enum holds blocked client msg
       
   175 	TUint* iDPEnumCount;					//< During a Data plane enum points to count recipient
       
   176 	RBuf8* iDPEnumBuf;				//< During a Data plane enum points to data buf
       
   177 	RArray<Messages::TNodeId> iEnumConnSockCandidateSCPRs;	//< During a Data plane enum is list of SCPRs for connection
       
   178 
       
   179     RMessage2* iMessage; //current message valid only within ProcessMessageL call
       
   180     CConnection& iConnection;
       
   181 
       
   182 	RPointerArray<CSubConnection> iSubConnections; //client classes servicing sub-connection
       
   183 	                //related functionality requested via legacy RConnection API. sub-connections
       
   184 	                //objects are owned by AConnectionLegacy instance and don't have RSubConnection
       
   185 	                //client side.
       
   186 	CConnManager* iConnManager; //client class servicing connection manager
       
   187 	                //related functionality requested via legacy RConnection API. CConnManager
       
   188 	                //object is owned by AConnectionLegacy instance and does't have RConnManager
       
   189 	                //client side.
       
   190 	// Flags for pending RConnection requests
       
   191 	TBool iServiceChangeNotificationPending;
       
   192 
       
   193 	// IsSubConnectionActive support
       
   194 	ADataMonitoringProvider* iConnActivityDataMonProv;
       
   195 	ESock::CActivityTimer* iActivityTimer;
       
   196 	TBool iClientsSubConnectionActiveState;
       
   197 	TUint iInitialSentDataVolume;
       
   198 	TUint iInitialReceivedDataVolume;
       
   199 	TUint iRequestedClientActivityTimerPeriod;
       
   200 	TBool iOutstandingIsSubConnectionActiveRequest;
       
   201 	RMessage2 iOutstandingIsSubConnectionActiveMessage;
       
   202 
       
   203 	TBool iDeferredSubConnectionNotificationEnable;
       
   204 	TSubConnectionEventQueue iSubConnectionEventQueue; // queue of subconnection events received
       
   205 
       
   206 	// EnumerateConnection and GetConnectionInfo use this.
       
   207 	RPointerArray<TSourcedConnectionInfo> iConnectionInfoPtrArray;
       
   208 
       
   209 	// AllInterfaceNotification support
       
   210 	RMessage2 iAllInterfaceNotificationMessage;
       
   211 	TInterfaceChangeQueue iNotificationQueue;
       
   212   	Messages::TNodeId iAllInterfaceNotificationWorker;
       
   213   	
       
   214 protected:
       
   215 	static const TAnyFn iInterfaceVTableF[];
       
   216 	};
       
   217 
       
   218 
       
   219 } //namespace ESock
       
   220 
       
   221 #endif
       
   222 // __SS_CONNLEGACY_H__
       
   223