|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Main server class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CSuplServer_H__ |
|
22 #define __CSuplServer_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <connect/sbdefs.h> |
|
27 |
|
28 #include "epos_mnetinitiatedobserver.h" |
|
29 #include "epos_mconnectobserver.h" |
|
30 #include "epos_msuplecomeventobserver.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSession2; |
|
34 class CSuplServerDelayedShutdown; |
|
35 class CSuplSessionManager; |
|
36 class CSuplNetInitiatedSession; |
|
37 class CSuplNetInitiatedRegistry; |
|
38 class CSuplServerStartupRequest; |
|
39 class CSuplServerDeInitRequest; |
|
40 |
|
41 // CONSTANTS |
|
42 const TUint KSuplServerShutdownTimer = 2000000; |
|
43 const TUid KProtocolHandlerInterfaceUid = {0x102073CB}; // ECom interface UID |
|
44 const TInt KMaxClients = 10; |
|
45 |
|
46 // DATA TYPES |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * The main server side class. |
|
52 */ |
|
53 class CSuplServer : public CPolicyServer,public MNetInitiatedObserver,public MConnectObserver,public MSuplEcomEventObserver |
|
54 { |
|
55 private: |
|
56 /** |
|
57 * C++ constructor. |
|
58 * |
|
59 * @param aPriority Priority at which to run the server active object. |
|
60 * @param aPolicy Reference to a policy object describing the security |
|
61 * checks required for each message type. |
|
62 * @param aServerType Sharable or non-sharable sessions. |
|
63 */ |
|
64 CSuplServer( |
|
65 /* IN */ TInt aPriority, |
|
66 /* IN */ const TPolicy &aPolicy, |
|
67 /* IN */ TServerType aServerType = ESharableSessions |
|
68 ); |
|
69 |
|
70 /** |
|
71 * EPOC default constructor. |
|
72 */ |
|
73 void ConstructL(); |
|
74 |
|
75 // By default, prohibit copy constructor |
|
76 CSuplServer( const CSuplServer& ); |
|
77 // Prohibit assigment operator |
|
78 CSuplServer& operator= ( const CSuplServer& ); |
|
79 |
|
80 /** |
|
81 * From CServer2 |
|
82 */ |
|
83 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
84 |
|
85 public: // Constructors and destructor |
|
86 |
|
87 /** |
|
88 * Two-phased constructor. |
|
89 */ |
|
90 static CSuplServer* NewL(); |
|
91 |
|
92 /** |
|
93 * Destructor. |
|
94 */ |
|
95 ~CSuplServer(); |
|
96 |
|
97 public: // New functions |
|
98 /** |
|
99 * This magic number has its origin in Symbian development. |
|
100 * It is they have some explaining to do, not us. |
|
101 */ |
|
102 enum |
|
103 { |
|
104 EPriority=950 |
|
105 }; |
|
106 |
|
107 public: // Functions from base classes |
|
108 /** |
|
109 * From CActive |
|
110 * |
|
111 * @param aError the error code of the server leave |
|
112 * @return always KErrNone |
|
113 */ |
|
114 TInt RunError( |
|
115 /* IN */ TInt aError |
|
116 ); |
|
117 |
|
118 public: // New functions |
|
119 /** |
|
120 * Increment number of sessions |
|
121 */ |
|
122 void IncrementSessions(); |
|
123 |
|
124 /** |
|
125 * Decrement number of sessions |
|
126 */ |
|
127 void DecrementSessions(); |
|
128 |
|
129 void HandleNewNetSessionL(CSuplSessionManager& aSessionManager,const RMessage2& aMessage); |
|
130 void CompleteForwardMessageL(TInt aHandle); |
|
131 void CompleteConnect(TInt aHandle); |
|
132 TBool GetConnectFlag(); |
|
133 /** |
|
134 * MSuplEcomEventObserver Observer method |
|
135 */ |
|
136 void PlugInUninstalled(); |
|
137 void DeInitialize(); |
|
138 private: |
|
139 void SetErrorCode(TInt aErrCode); |
|
140 TInt GetErrorCode(); |
|
141 void IncreamentIpcSessionCount(); |
|
142 |
|
143 protected: |
|
144 /** |
|
145 * From CPolicyServer |
|
146 */ |
|
147 CPolicyServer::TCustomResult CustomSecurityCheckL( |
|
148 /* IN */ const RMessage2& aMsg, |
|
149 /* IN */ TInt& aAction, |
|
150 /* IN */ TSecurityInfo& aMissing |
|
151 ); |
|
152 |
|
153 private: // Data |
|
154 CSuplServerDelayedShutdown* iShutdown; |
|
155 CSuplSessionManager* iSessionManager; |
|
156 TInt iNumSessions; |
|
157 TTimeIntervalMicroSeconds32 iServerShutdownDelay; |
|
158 TInt iConnectFail; |
|
159 CSuplNetInitiatedRegistry* iSuplNetInitRegistry; |
|
160 TInt iNumNetMessages; |
|
161 |
|
162 CSuplServerStartupRequest* iServerStartup; |
|
163 CSuplServerDeInitRequest* iDeInitRequest; |
|
164 TBool iConnectFlag; |
|
165 TInt iErrorCode; |
|
166 TInt iIpcSessionCount; |
|
167 |
|
168 |
|
169 }; |
|
170 |
|
171 #endif // __CSuplServer_H__ |
|
172 |
|
173 // End of File |
|
174 |