|
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 #ifndef SS_SUBCONN_H |
|
17 #define SS_SUBCONN_H |
|
18 |
|
19 #include <ss_std.h> |
|
20 #include <comms-infras/ss_subconnprov.h> |
|
21 #include <comms-infras/ss_coreprstates.h> |
|
22 #include <comms-infras/ss_platsec_apiext.h> |
|
23 #include <comms-infras/ss_mmnode.h> |
|
24 #include <comms-infras/ss_mmnode_subsess.h> |
|
25 #include <cs_subconevents.h> |
|
26 |
|
27 using namespace CorePanics; |
|
28 |
|
29 const int KMaxUidFilterListLen = 10; |
|
30 |
|
31 namespace SubConnActivities |
|
32 { |
|
33 class CRejoin; |
|
34 class CBuildStack; |
|
35 class CSetParameters; |
|
36 } |
|
37 |
|
38 namespace SubConnStates |
|
39 { |
|
40 class TJoinCPR; |
|
41 class TRequestServiceProvider; |
|
42 class TJoinTheOtherOwner; |
|
43 class TLeaveCPR; |
|
44 class TSendParamsToServiceProvider; |
|
45 class TStoreParams; |
|
46 class TNoTagOrParamsPresent; |
|
47 class TSendParamRequest; |
|
48 class TWriteSubConnParamsLength; |
|
49 class TWriteSubConnParams; |
|
50 class TFillInEvent; |
|
51 class TNoTagOrWaitForIncoming; |
|
52 class TEnqueueEvent; |
|
53 class TNoTagOrActiveWhenEventEnqued; |
|
54 class TStoreNewParams; |
|
55 class TSendBuildStack; |
|
56 class TRequestServiceProviderFromCPR; |
|
57 class TNoTagOrAttachToDefaultOrWaitForIncoming; |
|
58 } |
|
59 |
|
60 namespace ESock |
|
61 { |
|
62 |
|
63 class ASubConnectionLegacy; |
|
64 |
|
65 NONSHARABLE_CLASS(CSubConnection) : public CMMSockSubSession, private ASubSessionPlatsecApiExt, |
|
66 public ITFHIERARCHY_LINK_1(CSubConnection, MeshMachine::AMMNodeBase, MPlatsecApiExt) |
|
67 |
|
68 /** |
|
69 Handle subconnection-related asynchronous client requests that may not complete immediately |
|
70 @internalComponent |
|
71 */ |
|
72 { |
|
73 friend class SubConnStates::TJoinCPR; |
|
74 friend class SubConnStates::TRequestServiceProvider; |
|
75 friend class SubConnStates::TJoinTheOtherOwner; |
|
76 friend class SubConnStates::TLeaveCPR; |
|
77 friend class SubConnStates::TSendParamsToServiceProvider; |
|
78 friend class SubConnStates::TStoreParams; |
|
79 friend class SubConnStates::TSendParamRequest; |
|
80 friend class SubConnStates::TNoTagOrParamsPresent; |
|
81 friend class SubConnStates::TWriteSubConnParamsLength; |
|
82 friend class SubConnStates::TWriteSubConnParams; |
|
83 friend class SubConnStates::TFillInEvent; |
|
84 friend class SubConnStates::TNoTagOrWaitForIncoming; |
|
85 friend class SubConnStates::TEnqueueEvent; |
|
86 friend class SubConnStates::TNoTagOrActiveWhenEventEnqued; |
|
87 friend class SubConnStates::TStoreNewParams; |
|
88 friend class SubConnStates::TSendBuildStack; |
|
89 friend class SubConnStates::TRequestServiceProviderFromCPR; |
|
90 friend class SubConnStates::TNoTagOrAttachToDefaultOrWaitForIncoming; |
|
91 friend class SubConnActivities::CRejoin; |
|
92 friend class SubConnActivities::CBuildStack; |
|
93 friend class SubConnActivities::CSetParameters; |
|
94 friend class AConnectionLegacy; |
|
95 #ifdef __X86GCC__ |
|
96 // gcc-mingw does not support template function instantiations as friends, only the |
|
97 // generic template. |
|
98 template<class NODE> |
|
99 friend NODE* mcfnode_cast(Messages::ANode* aNode); |
|
100 template<class NODE> |
|
101 friend NODE& mcfnode_cast(Messages::ANode& aNode); |
|
102 #elif !defined(__GCCXML__) |
|
103 friend CSubConnection* mcfnode_cast<CSubConnection>(Messages::ANode* aNode); |
|
104 friend CSubConnection& mcfnode_cast<CSubConnection>(Messages::ANode& aNode); |
|
105 #endif |
|
106 |
|
107 static const TInt KMaxEventQueueLength = 8; |
|
108 |
|
109 public: |
|
110 typedef ITFHIERARCHY_LINK_1(CSubConnection, MeshMachine::AMMNodeBase, MPlatsecApiExt) TIfStaticFetcherNearestInHierarchy; |
|
111 |
|
112 public: |
|
113 static CSubConnection* NewL(CConnection& aConnection, CPlayer* aPlayer, const TSubSessionUniqueId aSubSessionUniqueId); |
|
114 virtual ~CSubConnection(); |
|
115 |
|
116 //----------------------------------- |
|
117 //from TInterfaceControl |
|
118 //----------------------------------- |
|
119 void ReturnInterfacePtrL(MPlatsecApiExt*& aInterface) |
|
120 { |
|
121 aInterface = this; |
|
122 } |
|
123 |
|
124 protected: |
|
125 CSubConnection(CPlayer* aPlayer, const TSubSessionUniqueId aSubSessionUniqueId); |
|
126 void ConstructL(CConnection& aConnection); |
|
127 CConnection& ControlProvider(); |
|
128 |
|
129 //----------------------------------- |
|
130 //from CMMSockSubSession |
|
131 //----------------------------------- |
|
132 void Received(MeshMachine::TNodeContextBase& aContext); |
|
133 void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
134 |
|
135 |
|
136 //----------------------------------- |
|
137 //from CSockSubSession |
|
138 //----------------------------------- |
|
139 protected: |
|
140 void ProcessMessageL(); |
|
141 virtual void FinalCompleteAllBlockedMessages(TInt aResult); |
|
142 |
|
143 public: |
|
144 virtual Den::TSubSessInfo Type() const |
|
145 { |
|
146 return TCFSubSessInfo(TCFSubSessInfo::ESubConnection); |
|
147 } |
|
148 |
|
149 inline RSubConnection::TSubConnType SubConnType() const |
|
150 { |
|
151 return iSubConnType; |
|
152 } |
|
153 |
|
154 public: |
|
155 IMPORT_C RCFParameterFamilyBundleC& GetOrCreateParameterBundleL(); |
|
156 IMPORT_C RCFParameterFamilyBundleC& CreateParameterBundleL(); |
|
157 |
|
158 private: |
|
159 RCFParameterFamilyBundleC iParameterBundle; |
|
160 RSubConnection::TSubConnType iSubConnType; |
|
161 TNotificationQueue<CRefCountOwnedSubConNotification*, KMaxEventQueueLength> iEventQueue; |
|
162 }; |
|
163 |
|
164 } // namespace Esock |
|
165 |
|
166 #endif |
|
167 // SS_SUBCONN_H |
|
168 |