|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * Initial Contributors: |
|
9 * Nokia Corporation - initial contribution. |
|
10 * Contributors: |
|
11 * |
|
12 * Description: |
|
13 * MSRP Implementation |
|
14 * |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef CMSRPSERVER_H |
|
19 #define CMSRPSERVER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "MsrpCommon.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MMSRPConnectionManager; |
|
28 class CMSRPConnectionManager; |
|
29 class MMSRPConnection; |
|
30 class CStateFactory; |
|
31 |
|
32 #include "MMSRPConnectionManagerObserver.h" |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * Manages sessions |
|
37 */ |
|
38 class CMSRPServer : public CPolicyServer, MMSRPConnectionManagerObserver |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CMSRPServer* NewLC(); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CMSRPServer(); |
|
51 |
|
52 public: // New functions |
|
53 |
|
54 /** |
|
55 * Access an instance of connection manager |
|
56 */ |
|
57 MMSRPConnectionManager& ConnectionManager() const; |
|
58 CStateFactory& StateFactory() const; |
|
59 |
|
60 /** |
|
61 * Session informs server when created |
|
62 */ |
|
63 void SessionCreated(); |
|
64 |
|
65 void CreatingSubSessionL( const TUint aIapID ); |
|
66 |
|
67 /** |
|
68 * Session informs server when deleted. |
|
69 */ |
|
70 void SessionDeleted(); |
|
71 |
|
72 // From the MMSRPConnectionManagerObserver |
|
73 |
|
74 void HandleError(TInt aError, TInt aStatus, MMSRPConnection& aConnection); |
|
75 |
|
76 |
|
77 private: // Functions from base classes |
|
78 |
|
79 /** |
|
80 * From CServer2, creates a new server session. |
|
81 * @param aVersion Client interface version. |
|
82 * @param aMessage 'connect' message from the client. |
|
83 * @return Pointer to the created server session. |
|
84 */ |
|
85 CSession2* NewSessionL( |
|
86 const TVersion &aVersion, |
|
87 const RMessage2& aMessage ) const; |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * C++ default constructor. |
|
93 */ |
|
94 CMSRPServer(); |
|
95 |
|
96 /** |
|
97 * private 2nd phase constructor |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 private: // variables |
|
102 |
|
103 // pointer to connection manager instance, owned |
|
104 CMSRPConnectionManager* iConnectionManager; |
|
105 CStateFactory* iStateFactory; |
|
106 |
|
107 // Counter for session instance |
|
108 TInt iSessionCount; |
|
109 }; |
|
110 |
|
111 // ---------------------------------------------------------------------------------------- |
|
112 // Server policy |
|
113 // ---------------------------------------------------------------------------------------- |
|
114 |
|
115 // Total number of ranges |
|
116 const TUint KTotalNumberOfRanges = 2; |
|
117 |
|
118 // Definition of the ranges of IPC numbers |
|
119 const TInt MSRPServerRanges[ KTotalNumberOfRanges ] = |
|
120 { |
|
121 EMSRPCreateSubSession, |
|
122 EMSRPReserved, |
|
123 }; |
|
124 |
|
125 // Policy to implement for each of the above ranges |
|
126 const TUint8 MSRPServerElementsIndex[ KTotalNumberOfRanges ] = |
|
127 { |
|
128 CPolicyServer::EAlwaysPass, // 0 |
|
129 CPolicyServer::ENotSupported, // 1 |
|
130 }; |
|
131 |
|
132 // Specific capability checks |
|
133 // not used currently |
|
134 const CPolicyServer::TPolicyElement MSRPServerElements[] = |
|
135 { |
|
136 //lint -e{1924} |
|
137 {_INIT_SECURITY_POLICY_C1( ECapabilityReadDeviceData ), CPolicyServer::EFailClient} |
|
138 }; |
|
139 |
|
140 // Package all the above together into a policy |
|
141 const CPolicyServer::TPolicy MSRPServerPolicy = |
|
142 { |
|
143 CPolicyServer::EAlwaysPass, // all applications can access |
|
144 KTotalNumberOfRanges, // number of ranges |
|
145 MSRPServerRanges, // ranges array |
|
146 MSRPServerElementsIndex, // elements<->ranges index |
|
147 MSRPServerElements |
|
148 }; |
|
149 |
|
150 #endif // CMSRPSERVER_H |
|
151 |
|
152 // End of File |