|
1 // Copyright (c) 2005-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 @publishedPartner |
|
19 @released since tb9.2 |
|
20 */ |
|
21 |
|
22 #ifndef SYMBIAN_NODEMESSAGES_LEGACY_H |
|
23 #define SYMBIAN_NODEMESSAGES_LEGACY_H |
|
24 |
|
25 |
|
26 #include <comms-infras/ss_nodeinterfaces.h> |
|
27 #include <comms-infras/ss_dispatchers.h> |
|
28 #include <elements/responsemsg.h> |
|
29 #include <es_enum.h> |
|
30 |
|
31 #include <comms-infras/api_ext_list.h> |
|
32 #include <comms-infras/ss_platsec_apiext.h> |
|
33 |
|
34 namespace ESock |
|
35 { |
|
36 |
|
37 /** |
|
38 * |
|
39 * Legacy RMessage2 handling framework classes |
|
40 * |
|
41 */ |
|
42 class TCFSigLegacyRMessage2Ext : public Messages::TSignatureBase |
|
43 { |
|
44 public: |
|
45 enum |
|
46 { |
|
47 EUid = 0x1028712F, |
|
48 ETypeId = 0 |
|
49 }; |
|
50 |
|
51 TCFSigLegacyRMessage2Ext(); |
|
52 TCFSigLegacyRMessage2Ext(const Messages::TNodeSignal::TMessageId& aMessageId, const Den::RSafeMessage& aMessage); |
|
53 |
|
54 ~TCFSigLegacyRMessage2Ext() {} |
|
55 |
|
56 /** |
|
57 @return whether the request can be processed under the current context |
|
58 */ |
|
59 virtual TBool CanProcess(MeshMachine::TNodeContextBase& /*aContext*/) { return EFalse; }; |
|
60 |
|
61 /** |
|
62 Forward request to the another node. |
|
63 */ |
|
64 virtual void ForwardL(MeshMachine::TNodeContextBase& /*aContext*/) {}; |
|
65 |
|
66 /** |
|
67 Process the request. What this does is implementation specific. |
|
68 */ |
|
69 virtual void ProcessL(MeshMachine::TNodeContextBase& /*aContext*/) {}; |
|
70 |
|
71 /** |
|
72 Cancel the request |
|
73 */ |
|
74 virtual void Cancel(MeshMachine::TNodeContextBase& /*aContext*/) {}; |
|
75 |
|
76 /** |
|
77 Convert an Error into an error which matches what the client would historically have |
|
78 expected. |
|
79 |
|
80 For example, a Legacy call may fail in the stack with KErrNotFound if the interface isn't found. |
|
81 The client may expect KErrNotReady in this scenario though, so this method is to do that conversion. |
|
82 |
|
83 @param aError The error to check |
|
84 @return The error which should be returned to the client |
|
85 */ |
|
86 virtual TInt CheckError(MeshMachine::TNodeContextBase& /*aContext*/, TInt aError) { return aError; }; |
|
87 |
|
88 |
|
89 protected: |
|
90 /** |
|
91 Utility function for checking for an interface |
|
92 */ |
|
93 TBool HasInterface(MeshMachine::TNodeContextBase& /*aContext*/, TInt aInterface); |
|
94 |
|
95 TAny* FetchInterfaceL(MeshMachine::AMMNodeBase& aNode, TInt aInterface); |
|
96 TAny* FetchInterfaceL(Messages::ANode& aNode, TInt aInterface); |
|
97 void ForwardRequestL(MeshMachine::TNodeContextBase& aContext); |
|
98 |
|
99 public: |
|
100 /** |
|
101 Read only version of RSafeMessage to stop users from completing |
|
102 when they shouldn't. The RMessage2 should only ever be completed at the |
|
103 CConnection-level. If you hit these ASSERTs then your code is broken/dangerous |
|
104 since it is vulnerable to double completes. */ |
|
105 class RReadOnlyRMessage : public Den::RSafeMessage |
|
106 { |
|
107 private: |
|
108 void Complete(TInt /*aReason*/) const { ASSERT(0); } |
|
109 void PanicClient(const TDesC& /*aCategory*/, TInt /*aReason*/) const { ASSERT(0); } |
|
110 }; |
|
111 |
|
112 RReadOnlyRMessage iMessage; |
|
113 |
|
114 EXPORT_DATA_VTABLE_AND_FN |
|
115 }; |
|
116 |
|
117 class TCFSigLegacyRMessage2PlatsecExt : public TCFSigLegacyRMessage2Ext, protected MPlatsecApiExt |
|
118 { |
|
119 public: |
|
120 inline TCFSigLegacyRMessage2PlatsecExt() {}; |
|
121 TCFSigLegacyRMessage2PlatsecExt(const Messages::TNodeSignal::TMessageId& aMessageId, const Den::RSafeMessage& aMessage) |
|
122 : TCFSigLegacyRMessage2Ext(aMessageId, aMessage) |
|
123 { |
|
124 } |
|
125 |
|
126 protected: |
|
127 // From MPlatsecExtensionApi |
|
128 IMPORT_C virtual TInt SecureId(TSecureId& aResult) const; |
|
129 IMPORT_C virtual TInt VendorId(TVendorId& aResult) const; |
|
130 IMPORT_C virtual TBool HasCapability(const TCapability aCapability) const; |
|
131 IMPORT_C virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy) const; |
|
132 }; |
|
133 |
|
134 // Response structure for a RMessage2 |
|
135 struct TLegacyRMessage2Response |
|
136 { |
|
137 enum TResponseType { ENormal, EPanic }; |
|
138 explicit TLegacyRMessage2Response() : iType(ENormal), iCode(KErrNone) {} |
|
139 explicit TLegacyRMessage2Response(TResponseType aType, TInt aCode) : iType(aType), iCode(aCode), iCatagory() {} |
|
140 explicit TLegacyRMessage2Response(TResponseType aType, TInt aCode, const TDesC& aCatagory) : iType(aType), iCode(aCode), iCatagory() |
|
141 { iCatagory.Copy(aCatagory); } |
|
142 TResponseType iType; |
|
143 TInt iCode; |
|
144 TBuf<20> iCatagory; |
|
145 }; |
|
146 |
|
147 DECLARE_MESSAGE_SIG_1(SigLegacyRMessage2Response, TLegacyRMessage2Response, Response) |
|
148 |
|
149 /** |
|
150 Message interface for Legacy RMessage2 handling |
|
151 */ |
|
152 class TCFLegacyMessage |
|
153 { |
|
154 public: |
|
155 |
|
156 enum |
|
157 { |
|
158 ECFLegacyRMessage2Processed = 1, |
|
159 ECFMCprGetConnectionSetting = 101, |
|
160 }; |
|
161 |
|
162 public: |
|
163 static void RegisterL(); |
|
164 static void DeRegister(); |
|
165 |
|
166 |
|
167 enum { ERealmId = 0x1028712F }; //UID allocated on 21/11/2007 |
|
168 |
|
169 /** |
|
170 Legacy RMessage2 has been completed or paniced. |
|
171 */ |
|
172 typedef TMessageSigLegacyRMessage2Response<ECFLegacyRMessage2Processed, TCFLegacyMessage::ERealmId> TLegacyRMessage2Processed; |
|
173 }; |
|
174 |
|
175 |
|
176 /** |
|
177 A self-propagating extension message. It advances down the stack looking for |
|
178 a MeshMachine::AMMNodeBase that implements MLinkCprDataAccessExtensionApi. |
|
179 @internalComponent |
|
180 */ |
|
181 class TMCprGetConnectionSetting : public TCFSigLegacyRMessage2PlatsecExt, |
|
182 public Messages::TSignatureBase::TTypeToMessageId<TCFLegacyMessage::ECFMCprGetConnectionSetting, TCFLegacyMessage::ERealmId> |
|
183 { |
|
184 public: |
|
185 enum TConnectionSettingType |
|
186 { |
|
187 EIntSetting, |
|
188 EBoolSetting, |
|
189 EDes8Setting, |
|
190 EDes16Setting, |
|
191 ELongDesSetting |
|
192 }; |
|
193 |
|
194 public: |
|
195 inline TMCprGetConnectionSetting() {}; |
|
196 |
|
197 TMCprGetConnectionSetting(TConnectionSettingType aSettingType, const Den::RSafeMessage& aMessage) |
|
198 : TCFSigLegacyRMessage2PlatsecExt(Messages::TNodeSignal::TMessageId(EId, ERealm), aMessage), iSettingType(aSettingType) |
|
199 { |
|
200 } |
|
201 |
|
202 protected: |
|
203 virtual TBool CanProcess(MeshMachine::TNodeContextBase& aContext); |
|
204 virtual void ForwardL(MeshMachine::TNodeContextBase& aContext); |
|
205 virtual void ProcessL(MeshMachine::TNodeContextBase& aContext); |
|
206 |
|
207 public: |
|
208 DECLARE_MVIP_CTR(TMCprGetConnectionSetting) |
|
209 EXPORT_DATA_VTABLE_AND_FN |
|
210 TConnectionSettingType iSettingType; |
|
211 }; |
|
212 |
|
213 |
|
214 } |
|
215 #endif // SYMBIAN_NODEMESSAGES_LEGACY_H |
|
216 |