|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEMSPYDRIVERPANDS_H |
|
19 #define MEMSPYDRIVERPANDS_H |
|
20 |
|
21 // System includes |
|
22 #include <e32property.h> |
|
23 #include <kernel.h> |
|
24 #include <kern_priv.h> |
|
25 #include <sproperty.h> |
|
26 |
|
27 // User includes |
|
28 #include "MemSpyDriverLog.h" |
|
29 #include <memspy/driver/memspydriverpanics.h> |
|
30 |
|
31 |
|
32 /** |
|
33 * Spoof TProperty, the kernel-side object that encapsulates all P&S keys |
|
34 */ |
|
35 class TMemSpyProperty |
|
36 { |
|
37 public: |
|
38 // The property attributes. |
|
39 // Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit) |
|
40 // Constant while the property is defined |
|
41 inline TUint32 Owner() { return iOwner; } |
|
42 |
|
43 public: |
|
44 const TUint iCategory; |
|
45 const TUint iKey; |
|
46 |
|
47 public: |
|
48 // iType == RProperty::ETypeLimit means not defined |
|
49 TUint8 iType; // updates require the system lock AND the feature lock |
|
50 // reads require only one of them |
|
51 // The property attributes. |
|
52 // Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit) |
|
53 // Constant while the property is defined |
|
54 TUint8 iAttr; |
|
55 TCompiledSecurityPolicy iReadPolicy; |
|
56 TCompiledSecurityPolicy iWritePolicy; |
|
57 TUint32 iOwner; |
|
58 |
|
59 TUint iRefCount; // protected by the feature lock |
|
60 TProperty* iNext; // hash table collision list link - |
|
61 // protected by the feature lock |
|
62 |
|
63 class TBuf |
|
64 { // Viraiable-size buffer for byte array property values |
|
65 public: |
|
66 static TBuf* New(TInt aSize); |
|
67 |
|
68 TUint16 iBufSize; // buffer size - constant |
|
69 TUint16 iSize; // actual property size - protected by the system lock |
|
70 TUint8 iBytes[1]; // byte array - protected by the system lock |
|
71 }; |
|
72 |
|
73 // The property value |
|
74 // Meaningful for defined properties only (ie. iType != RProperty::ETypeLimit) |
|
75 union // the value (ie. iValue or iBuf->iBytes) is protected by the system lock |
|
76 { |
|
77 TBuf* iBuf; // pointer updates of a defined property (eg. buffer |
|
78 // reallocation) require the system AND the feature locks; |
|
79 // pointer reads (eg to get/set byte values) require any of them |
|
80 TInt iValue; |
|
81 }; |
|
82 |
|
83 // Called with system or feature locked |
|
84 TInt Size() |
|
85 { |
|
86 return iBuf ? iBuf->iSize : 0; |
|
87 } |
|
88 |
|
89 // Called with system or feature locked |
|
90 TUint8* Buf() |
|
91 { |
|
92 return iBuf ? iBuf->iBytes : NULL; |
|
93 } |
|
94 |
|
95 SDblQue iPendingQue; // pending subscriptions - protected by the system lock |
|
96 }; |
|
97 |
|
98 |
|
99 |
|
100 /** |
|
101 * Spoof of DPropertyRef - the kernel-side object that represents user-side P&S property keys |
|
102 */ |
|
103 class DMemSpyPropertyRef : public DObject |
|
104 { |
|
105 public: |
|
106 TMemSpyProperty* iProp; |
|
107 TRequestStatus* iStatus; |
|
108 DThread* iClient; |
|
109 TPropertySubsRequest iSubs; |
|
110 }; |
|
111 |
|
112 |
|
113 #endif |