|
1 /* |
|
2 * Copyright (c) 2004-2006 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: DRM Message storage handles all the messages and stores them |
|
15 * when needed |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CDRMMESSAGESTORAGE_H |
|
22 #define CDRMMESSAGESTORAGE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <DRMEvent.h> |
|
27 |
|
28 // CONSTANTS |
|
29 // MACROS |
|
30 // DATA TYPES |
|
31 // FUNCTION PROTOTYPES |
|
32 // FORWARD DECLARATIONS |
|
33 class CDRMNotifierSession; |
|
34 class CLogFile; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * This class implements the DRM3 Message Storage |
|
40 * |
|
41 * @lib RightsServer.exe |
|
42 * @since S60Rel2.6 |
|
43 */ |
|
44 NONSHARABLE_CLASS( CDRMMessageStorage ) : public CBase |
|
45 { |
|
46 public: // User defined types |
|
47 struct TMessageData |
|
48 { |
|
49 TInt iRefCount; |
|
50 TDRMEventType iEventType; |
|
51 HBufC8* iData; |
|
52 TUint8* iMessageData; |
|
53 }; |
|
54 |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @since S60Rel2.6 |
|
60 * @return Pointer to newly created server instance. |
|
61 */ |
|
62 static CDRMMessageStorage* NewL(); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 * @since S60Rel2.6 |
|
67 */ |
|
68 ~CDRMMessageStorage(); |
|
69 |
|
70 public: // New functions |
|
71 /** |
|
72 * AddSession |
|
73 * |
|
74 * Adds a session to the session list |
|
75 * |
|
76 * @since S60Rel2.6 |
|
77 * @param : aSession - The notifier session to recieve callbacks |
|
78 * @param : aMessage - Message related to the reques |
|
79 * @return None |
|
80 */ |
|
81 void AddSession( CDRMNotifierSession* aSession ); |
|
82 |
|
83 /** |
|
84 * UpdateMessage |
|
85 * |
|
86 * Updates a message in the message list, if the reference |
|
87 * counter is reduced to 0 it removes it from the list |
|
88 * |
|
89 * @since S60Rel2.6 |
|
90 * @param : aMessage - message to be updated |
|
91 * @return None |
|
92 */ |
|
93 void UpdateMessage( struct TMessageData* aMessage ); |
|
94 |
|
95 /** |
|
96 * GetEventObjectLC |
|
97 * |
|
98 * Creates an event object, adds it to the cleanup stack and |
|
99 * returns a pointer to it |
|
100 * |
|
101 * @since S60Rel2.6 |
|
102 * @param aEventType the type of event object needed |
|
103 * @return pointer to the proper event object |
|
104 */ |
|
105 MDRMEvent* GetEventObjectLC( TDRMEventType aEventType ); |
|
106 |
|
107 /** |
|
108 * NotifyL |
|
109 * |
|
110 * Calls the SendNotificationL function from all registered sessions |
|
111 * |
|
112 * @since S60Rel2.6 |
|
113 * @param : aEventType - The event type of the message |
|
114 * @param : aMessage - Message related to the request |
|
115 * @return None, Leaves with symbian OS error code if an error occurs |
|
116 */ |
|
117 void NotifyL( TDRMEventType& aEventType, const RMessage2& aMessage ); |
|
118 |
|
119 /** |
|
120 * CancelL |
|
121 * |
|
122 * Removes the object(s) related to the given session from the lists |
|
123 * |
|
124 * @since S60Rel2.6 |
|
125 * @param : aSession - Session connected to a client |
|
126 * @return None, Leaves with symbian OS error code if an error occurs |
|
127 */ |
|
128 void CancelL( CDRMNotifierSession* aSession ); |
|
129 |
|
130 protected: // New functions |
|
131 |
|
132 protected: // Functions from base classes |
|
133 |
|
134 private: |
|
135 /** |
|
136 * C++ default constructor. |
|
137 * @since S60Rel2.6 |
|
138 */ |
|
139 CDRMMessageStorage(); |
|
140 |
|
141 /** |
|
142 * By default Symbian 2nd phase constructor is private. |
|
143 * @since S60Rel2.6 |
|
144 */ |
|
145 void ConstructL(); |
|
146 |
|
147 private: // Data |
|
148 RPointerArray<CDRMNotifierSession> iSessions; |
|
149 RPointerArray<TMessageData> iMessages; |
|
150 |
|
151 |
|
152 public: // Friend classes |
|
153 |
|
154 protected: // Friend classes |
|
155 |
|
156 private: // Friend classes |
|
157 |
|
158 }; |
|
159 |
|
160 #endif // CDRMMESSAGESTORAGE_H |
|
161 |
|
162 // End of File |