|
1 /* |
|
2 * Copyright (c) 2007-2008 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef _RTSECMGRMSG_H |
|
25 #define _RTSECMGRMSG_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32std.h> |
|
29 #include <e32base.h> |
|
30 #include <s32strm.h> |
|
31 #include <s32mem.h> |
|
32 #include <rtsecmgrcommondef.h> |
|
33 |
|
34 // Maximum size expected for iHashMarker in CRTSecMgrRegisterScriptMsg |
|
35 const TInt KMaxHashValueDesLen = 255; |
|
36 |
|
37 // Maximum total size expected for a CRTSecMgrRegisterScriptMsg object |
|
38 const TInt KMaxMsgLength = 520; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Message type to pass script object across |
|
44 * client server boundary |
|
45 * |
|
46 */ |
|
47 NONSHARABLE_CLASS(CRTSecMgrRegisterScriptMsg) : public CBase |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 IMPORT_C ~CRTSecMgrRegisterScriptMsg(); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * |
|
59 * Creates an instance of CRTSecMgrRegisterScriptMsg. |
|
60 * |
|
61 * |
|
62 * @param aPolicyID policy identifier of script |
|
63 * @param aHashValue hash value of script |
|
64 * |
|
65 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg |
|
66 * |
|
67 */ |
|
68 IMPORT_C static CRTSecMgrRegisterScriptMsg* NewL(TPolicyID aPolicyID, const TDesC& aHashValue); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 * |
|
73 * Creates an instance of CRTSecMgrRegisterScriptMsg |
|
74 * and leaves it on cleanupstack |
|
75 * |
|
76 * @param aPolicyID policy identifier of script |
|
77 * @param aHashValue hash value of script |
|
78 * |
|
79 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg |
|
80 * |
|
81 */ |
|
82 IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(TPolicyID aPolicyID, const TDesC& aHashValue); |
|
83 |
|
84 /** |
|
85 * Two-phased constructor. |
|
86 * |
|
87 * Creates an instance of CRTSecMgrRegisterScriptMsg |
|
88 * from the input source |
|
89 * |
|
90 * @param aStreamData input source data |
|
91 * |
|
92 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg |
|
93 * |
|
94 */ |
|
95 IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(const TDesC8& aStreamData); |
|
96 |
|
97 /* |
|
98 * Creates an HBufC8 representation of CRTSecMgrRegisterScriptMsg |
|
99 * |
|
100 * @return HBufC8* buffer representation of CRTSecMgrRegisterScriptMsg |
|
101 */ |
|
102 IMPORT_C HBufC8* PackMsgL() const; |
|
103 |
|
104 /* |
|
105 * Gets the hash value of the script |
|
106 * |
|
107 * @return const TDesC8& hash value of script |
|
108 */ |
|
109 inline const TDesC& HashValue() const |
|
110 { |
|
111 if(iHashMarker) |
|
112 return *iHashMarker; |
|
113 else |
|
114 return KNullDesC; |
|
115 } |
|
116 |
|
117 /* |
|
118 * Gets the policy identifier |
|
119 * |
|
120 * @return TPolicyID policy identifier |
|
121 */ |
|
122 inline TPolicyID PolicyID() const |
|
123 { |
|
124 return iPolicyID; |
|
125 } |
|
126 |
|
127 protected: |
|
128 // Writes ’this’ to the stream |
|
129 void ExternalizeL(RWriteStream& aStream) const; |
|
130 // Initializes ’this’ from stream |
|
131 void InternalizeL(RReadStream& aStream); |
|
132 |
|
133 private: |
|
134 |
|
135 /** |
|
136 * Constructor for performing 1st stage construction |
|
137 */ |
|
138 CRTSecMgrRegisterScriptMsg() |
|
139 {} |
|
140 |
|
141 /** |
|
142 * Constructor for performing 1st stage construction |
|
143 */ |
|
144 CRTSecMgrRegisterScriptMsg(TPolicyID aPolicyID); |
|
145 |
|
146 /** |
|
147 * Second stage construction |
|
148 */ |
|
149 void ConstructL(const TDesC& aHashValue); |
|
150 |
|
151 private: |
|
152 /* |
|
153 * Policy identifier |
|
154 * |
|
155 */ |
|
156 TPolicyID iPolicyID; |
|
157 |
|
158 /* |
|
159 * Hash value of the script |
|
160 * |
|
161 */ |
|
162 HBufC* iHashMarker; |
|
163 }; |
|
164 |
|
165 #endif // RTSECMGRMSG_H |
|
166 |