|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef SYMBIAN_SS_CONNECTIONSESSION_H |
|
22 #define SYMBIAN_SS_CONNECTIONSESSION_H |
|
23 |
|
24 #include <comms-infras/ss_metaconnprov.h> |
|
25 #include <comms-infras/ss_connselect.h> |
|
26 #include <comms-infras/ss_common.h> |
|
27 #include <elements/sd_std.h> |
|
28 #include <comms-infras/es_availability.h> |
|
29 #include <es_prot.h> |
|
30 #include <comms-infras/es_connectionservparameterbundle.h> |
|
31 |
|
32 namespace ESock |
|
33 { |
|
34 |
|
35 const TUint KMaxNotificationQueueLength = 8; // seems to be a popular value round these parts |
|
36 |
|
37 |
|
38 const TUint ETierStatusActivity = 1; |
|
39 const TUint ETierNotificationActivity = 2; |
|
40 |
|
41 |
|
42 /** |
|
43 Server side representation of RConnectionServ. |
|
44 @class CConnectionSession |
|
45 @internalTechnology |
|
46 */ |
|
47 NONSHARABLE_CLASS(CConnectionSession) : public Den::CWorkerSession, public MProvdSecurityChecker, public Messages::ASimpleNodeIdBase |
|
48 { |
|
49 public: |
|
50 static CConnectionSession* NewL(TProcessId aProcessId, TUidType aUid, Den::TSessionUniqueId aSessionUniqueId); |
|
51 virtual ~CConnectionSession(); |
|
52 |
|
53 protected: |
|
54 CConnectionSession(TUidType aUid, Den::TSessionUniqueId aSessionUniqueId); |
|
55 |
|
56 protected: |
|
57 void CompleteMessage(const RMessage2& aMessage, TInt aResult); |
|
58 |
|
59 protected: |
|
60 void Error(TInt aError); |
|
61 |
|
62 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
63 |
|
64 void ProviderUp(const Messages::TNodeId& aProvider); |
|
65 |
|
66 private: |
|
67 // Client message implementations |
|
68 void StartAttachToTierManager(const RMessage2& aMessage); |
|
69 |
|
70 void EnumerateConnectionsL(); |
|
71 void GetConnectionInfoL(); |
|
72 |
|
73 // Availability |
|
74 void RegisterForAvailabilityL(); |
|
75 void CancelAvailability(TInt aReason = KErrCancel); |
|
76 void ProcessAvailabilityL(Messages::TSignatureBase& aCFMessage); |
|
77 void ProcessError(TUint16 aActId, Messages::TSignatureBase& aCFMessage); |
|
78 void ProcessError(TUint16 aActId, TInt aErrCode); |
|
79 |
|
80 // Availability helpers |
|
81 void PopAvailabilityQueue(); |
|
82 |
|
83 const Messages::TNodeId& ServiceProvider() const |
|
84 { |
|
85 return iTierManager; |
|
86 } |
|
87 |
|
88 inline const Messages::TNodeId& ServiceProviderL() const |
|
89 { |
|
90 const Messages::TNodeId& sp = ServiceProvider(); |
|
91 if(sp.IsNull()) |
|
92 { |
|
93 // must be attached to something! |
|
94 // log something here |
|
95 User::Leave(KErrNotReady); |
|
96 } |
|
97 return sp; |
|
98 } |
|
99 |
|
100 |
|
101 void LeaveServiceProvider(); |
|
102 void HandleTierStatus(const Messages::TSignatureBase& aCFMessage); |
|
103 void HandleTierNotification(const Messages::TSignatureBase& aCFMessage); |
|
104 void AttachToTierManager(const Messages::TNodeId& aTierManager); |
|
105 |
|
106 virtual void CommsApiExtBindIfaceL(const RMessage2& aMessage); |
|
107 virtual void CommsApiExtIfaceSendReceiveL(const RMessage2& aMessage); |
|
108 virtual void CloseExtensionInterface(const RMessage2& aMessage); |
|
109 virtual void CancelAndCloseAllClientExtIfaces(); |
|
110 |
|
111 void PanicClient(TESockPanic aPanic); |
|
112 static void PanicClient(const RMessage2& aMessage,TESockPanic aPanic); |
|
113 |
|
114 virtual void ServiceL(const RMessage2& aMessage); |
|
115 |
|
116 public: |
|
117 // Methods implementing MProvdSecurityChecker methods |
|
118 virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy, const char *aDiagnostic); |
|
119 |
|
120 private: |
|
121 TUint iTierId; |
|
122 Messages::TNodeId iTierManager; // associated tier manager (if any) |
|
123 |
|
124 RMessage2 iAttachMessage; |
|
125 RMessage2 iStatusMessage; |
|
126 CRefCountOwnedParameterBundle* iStatusBundle; |
|
127 |
|
128 TBool iNotificationActive; |
|
129 RMessage2 iNotificationMessage; |
|
130 RPointerArray<CRefCountOwnedParameterBundle> iNotificationQueue; // queue of availability events received |
|
131 }; |
|
132 |
|
133 } // namespace ESock |
|
134 |
|
135 #endif |
|
136 //SYMBIAN_SS_CONNECTIONSESSION_H |
|
137 |