1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
1093 friend class CObjectCon; |
1093 friend class CObjectCon; |
1094 friend class CObjectIx; |
1094 friend class CObjectIx; |
1095 __DECLARE_TEST; |
1095 __DECLARE_TEST; |
1096 }; |
1096 }; |
1097 |
1097 |
1098 |
1098 //Forward declaration of SObjectIxRec |
1099 |
1099 struct SObjectIxRec; |
1100 |
1100 |
1101 /** |
|
1102 @internalComponent |
|
1103 */ |
|
1104 struct TObjectDataStr //In use if this slot contains pointer to object. |
|
1105 { |
|
1106 TInt16 instance; |
|
1107 TUint16 uniqueID; |
|
1108 }; |
|
1109 /** |
|
1110 @internalComponent |
|
1111 */ |
|
1112 struct SObjectIxRec |
|
1113 { |
|
1114 union |
|
1115 { |
|
1116 TObjectDataStr str; //This is in use if the slot contains pointer to CObject. |
|
1117 TInt nextEmpty; //This is in use if the slot is empty. Points to the next empty slot ... |
|
1118 //... in the list. 16 bits would be enough but ARM prefers 32 bytes. |
|
1119 }; |
|
1120 CObject* obj; |
|
1121 }; |
|
1122 |
|
1123 |
|
1124 |
|
1125 class CObjectIx : public CBase |
1101 class CObjectIx : public CBase |
1126 /** |
1102 /** |
1127 @publishedAll |
1103 @publishedAll |
1128 @released |
1104 @released |
1129 |
1105 |
1293 CObjectCon** iContainers; |
1272 CObjectCon** iContainers; |
1294 TAny* iSpare1; |
1273 TAny* iSpare1; |
1295 TAny* iSpare2; |
1274 TAny* iSpare2; |
1296 }; |
1275 }; |
1297 |
1276 |
1298 |
|
1299 /** |
|
1300 @internalTechnology |
|
1301 @deprecated |
|
1302 */ |
|
1303 class CBitMapAllocator : public CBase |
|
1304 { |
|
1305 public: |
|
1306 IMPORT_C static CBitMapAllocator* New(TInt aSize); |
|
1307 IMPORT_C static CBitMapAllocator* NewL(TInt aSize); |
|
1308 IMPORT_C ~CBitMapAllocator(); |
|
1309 IMPORT_C TInt Alloc(); |
|
1310 IMPORT_C TInt AllocFrom(TInt aPos); |
|
1311 IMPORT_C TInt Alloc(TInt aCount, TInt& aConsecutive); |
|
1312 IMPORT_C TInt AllocAligned(TInt anAlignment); |
|
1313 IMPORT_C TInt AllocAlignedBlock(TInt anAlignment); |
|
1314 IMPORT_C TInt AllocFromTop(); |
|
1315 IMPORT_C TInt AllocFromTopFrom(TInt aPos); |
|
1316 IMPORT_C void AllocAt(TInt aPos); |
|
1317 IMPORT_C void AllocAt(TInt aPos, TInt aCount); |
|
1318 IMPORT_C TBool IsFree(TInt aPos); |
|
1319 IMPORT_C TBool IsFree(TInt aPos, TInt aCount); |
|
1320 IMPORT_C void Free(TInt aPos); |
|
1321 IMPORT_C void Free(TInt aPos, TInt aCount); |
|
1322 IMPORT_C TInt Avail(); |
|
1323 IMPORT_C TInt Size(); |
|
1324 IMPORT_C TInt ExtractRamPages(TInt aConsecutive,TInt& aPageNo); |
|
1325 protected: |
|
1326 IMPORT_C CBitMapAllocator(TInt aSize,TInt aLength); |
|
1327 protected: |
|
1328 TInt iAvail; |
|
1329 TInt iSize; |
|
1330 TInt iLength; |
|
1331 TUint iMap[1]; |
|
1332 }; |
|
1333 // Forward Declaration of TCleanupStackItem |
1277 // Forward Declaration of TCleanupStackItem |
1334 class TCleanupStackItem; |
1278 class TCleanupStackItem; |
1335 |
1279 |
1336 |
1280 |
1337 |
1281 |
1851 @see CDeltaTimer |
1795 @see CDeltaTimer |
1852 */ |
1796 */ |
1853 { |
1797 { |
1854 friend class CDeltaTimer; |
1798 friend class CDeltaTimer; |
1855 public: |
1799 public: |
1856 inline TDeltaTimerEntry(TCallBack& aCallback); |
1800 inline TDeltaTimerEntry(const TCallBack& aCallback); |
1857 inline TDeltaTimerEntry(); |
1801 inline TDeltaTimerEntry(); |
1858 inline void Set(TCallBack& aCallback); |
1802 inline void Set(TCallBack& aCallback); |
1859 private: |
1803 private: |
1860 TCallBack iCallBack; |
1804 TCallBack iCallBack; |
1861 TTickCountQueLink iLink; |
1805 TTickCountQueLink iLink; |
2209 protected: |
2153 protected: |
2210 IMPORT_C CSession2(); |
2154 IMPORT_C CSession2(); |
2211 IMPORT_C virtual void Disconnect(const RMessage2& aMessage); |
2155 IMPORT_C virtual void Disconnect(const RMessage2& aMessage); |
2212 IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2156 IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); |
2213 public: |
2157 public: |
|
2158 IMPORT_C void SetServer(const CServer2* aServer); |
2214 /** |
2159 /** |
2215 @internalComponent |
2160 @internalComponent |
2216 */ |
2161 */ |
2217 enum TPanicNo {ESesCountResourcesNotImplemented=1,ESesFoundResCountHeaven}; |
2162 enum TPanicNo {ESesCountResourcesNotImplemented=1,ESesFoundResCountHeaven}; |
|
2163 |
2218 private: |
2164 private: |
2219 TInt iResourceCountMark; |
2165 TInt iResourceCountMark; |
2220 TDblQueLink iLink; |
2166 TDblQueLink iLink; |
2221 const CServer2* iServer; |
2167 const CServer2* iServer; |
2222 TAny* iSpare; |
2168 TAny* iSpare; |
2237 (Note that this class should be used instead of CServer) |
2183 (Note that this class should be used instead of CServer) |
2238 */ |
2184 */ |
2239 class CServer2 : public CActive |
2185 class CServer2 : public CActive |
2240 { |
2186 { |
2241 public: |
2187 public: |
2242 /** |
2188 |
2243 Defines the set of session types that the server can create. |
2189 /** |
2244 |
2190 This enumeration defines the maximum sharability of sessions opened |
2245 A specific session type is specified when the CServer2 object is created. |
2191 with this server; for backwards compatibilty, these should be have |
2246 */ |
2192 the same values as the corresponding EIpcSessionType enumeration |
|
2193 */ |
2247 enum TServerType |
2194 enum TServerType |
2248 { |
2195 { |
2249 /** |
2196 EUnsharableSessions = EIpcSession_Unsharable, |
2250 The session is not sharable with other threads. |
2197 ESharableSessions = EIpcSession_Sharable, |
2251 */ |
2198 EGlobalSharableSessions = EIpcSession_GlobalSharable, |
2252 EUnsharableSessions = EIpcSession_Unsharable, |
|
2253 |
|
2254 /** |
|
2255 The session is sharable with other threads in the same process. |
|
2256 */ |
|
2257 ESharableSessions = EIpcSession_Sharable, |
|
2258 |
|
2259 /** |
|
2260 The session is sharable with all other threads in the system. |
|
2261 */ |
|
2262 EGlobalSharableSessions = EIpcSession_GlobalSharable, |
|
2263 }; |
2199 }; |
|
2200 |
2264 public: |
2201 public: |
2265 IMPORT_C virtual ~CServer2() =0; |
2202 IMPORT_C virtual ~CServer2() =0; |
2266 IMPORT_C TInt Start(const TDesC& aName); |
2203 IMPORT_C TInt Start(const TDesC& aName); |
2267 IMPORT_C void StartL(const TDesC& aName); |
2204 IMPORT_C void StartL(const TDesC& aName); |
2268 IMPORT_C void ReStart(); |
2205 IMPORT_C void ReStart(); |
|
2206 IMPORT_C void SetPinClientDescriptors(TBool aPin); |
2269 |
2207 |
2270 /** |
2208 /** |
2271 Gets a handle to the server. |
2209 Gets a handle to the server. |
2272 |
2210 |
2273 Note that the RServer2 object is classified as Symbian internal, and its |
2211 Note that the RServer2 object is classified as Symbian internal, and its |
2312 */ |
2250 */ |
2313 IMPORT_C virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const =0; |
2251 IMPORT_C virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const =0; |
2314 void Connect(const RMessage2& aMessage); |
2252 void Connect(const RMessage2& aMessage); |
2315 void DoConnectL(const RMessage2& aMessage,CSession2* volatile& aSession); |
2253 void DoConnectL(const RMessage2& aMessage,CSession2* volatile& aSession); |
2316 public: |
2254 public: |
2317 |
2255 IMPORT_C void SetMaster(const CServer2* aServer); |
|
2256 |
2318 /** |
2257 /** |
2319 @internalComponent |
2258 @internalComponent |
2320 */ |
2259 */ |
2321 enum TPanic |
2260 enum TPanic |
2322 { |
2261 { |
2323 EBadMessageNumber, |
2262 EBadMessageNumber, |
2324 ESessionNotConnected, |
2263 ESessionNotConnected, |
2325 ESessionAlreadyConnected, |
2264 ESessionAlreadyConnected, |
2326 EClientDoesntHaveRequiredCaps, |
2265 EClientDoesntHaveRequiredCaps, |
2327 }; |
2266 }; |
2328 private: |
2267 |
2329 TInt iSessionType; |
2268 private: |
|
2269 TUint8 iSessionType; |
|
2270 TUint8 iServerRole; |
|
2271 TUint16 iServerOpts; |
2330 RServer2 iServer; |
2272 RServer2 iServer; |
2331 RMessage2 iMessage; |
2273 RMessage2 iMessage; |
2332 TAny* iSpare; |
2274 TAny* iSpare; |
2333 TDblQue<CSession2> iSessionQ; |
2275 TDblQue<CSession2> iSessionQ; |
|
2276 |
2334 protected: |
2277 protected: |
2335 TDblQueIter<CSession2> iSessionIter; |
2278 TDblQueIter<CSession2> iSessionIter; |
2336 private: |
2279 private: |
2337 void Disconnect(const RMessage2& aMessage); |
2280 void Disconnect(const RMessage2& aMessage); |
2338 static void BadMessage(const RMessage2& aMessage); |
2281 static void BadMessage(const RMessage2& aMessage); |