17 * activities, and adding/removing sessions. The actual STS |
17 * activities, and adding/removing sessions. The actual STS |
18 * functionality is handled in the STS class. |
18 * functionality is handled in the STS class. |
19 */ |
19 */ |
20 |
20 |
21 #include "stsserver.h" |
21 #include "stsserver.h" |
22 |
|
23 #include "stsserversession.h" |
22 #include "stsserversession.h" |
24 #include "sts.h" |
23 #include "sts.h" |
25 |
24 |
26 // TODO: IMPLEMENT PLATFORM SECURITY CHECKS ON THIS API. |
|
27 |
|
28 // Total number of ranges |
25 // Total number of ranges |
29 const TUint KStsRangeCount = 2; |
26 const TUint KStsRangeCount = 3; |
30 |
27 |
31 // Definition of the ranges of IPC numbers |
28 // Definition of the ranges of IPC numbers |
32 const TInt KStsRanges[KStsRangeCount] = |
29 const TInt KStsRanges[KStsRangeCount] = |
33 { |
30 { |
34 0, KStsCmdLast + 1 |
31 0, 2, KStsCmdLast + 1 |
35 }; |
32 }; |
36 |
33 |
37 // Policy to implement for each of the above ranges |
34 // Policy to implement for each of the above ranges |
38 const TUint8 KStsElementsIndex[KStsRangeCount] = |
35 const TUint8 KStsElementsIndex[KStsRangeCount] = |
39 { |
36 { |
40 CPolicyServer::EAlwaysPass, CPolicyServer::ENotSupported |
37 CPolicyServer::EAlwaysPass, |
|
38 CPolicyServer::ECustomCheck, |
|
39 CPolicyServer::ENotSupported |
41 }; |
40 }; |
42 |
41 |
43 // Package all the above together into a policy |
42 // Package all the above together into a policy |
44 const CPolicyServer::TPolicy KStsPolicy = |
43 const CPolicyServer::TPolicy KStsPolicy = |
45 { |
44 { |
79 { |
78 { |
80 iSessions.ResetAndDestroy(); |
79 iSessions.ResetAndDestroy(); |
81 CSts::Delete(iSts); |
80 CSts::Delete(iSts); |
82 } |
81 } |
83 |
82 |
|
83 // Performs security checks based on the tone or Alarm type. |
|
84 CPolicyServer::TCustomResult CStsServer::CustomSecurityCheckL( |
|
85 const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& aMissing) |
|
86 { |
|
87 CPolicyServer::TCustomResult result; |
|
88 |
|
89 switch (aMsg.Function()) |
|
90 { |
|
91 case StsMsg_PlayTone: |
|
92 { |
|
93 CSystemToneService::TToneType tone = |
|
94 (CSystemToneService::TToneType) aMsg.Int0(); |
|
95 result = SecurityCheckTone(tone, aMsg, aMissing); |
|
96 } |
|
97 break; |
|
98 case StsMsg_PlayAlarm: |
|
99 { |
|
100 CSystemToneService::TAlarmType alarm = |
|
101 (CSystemToneService::TAlarmType) aMsg.Int0(); |
|
102 result = SecurityCheckAlarm(alarm, aMsg, aMissing); |
|
103 } |
|
104 break; |
|
105 default: |
|
106 result = CPolicyServer::EFail; |
|
107 } |
|
108 |
|
109 return result; |
|
110 } |
|
111 |
|
112 CPolicyServer::TCustomResult CStsServer::SecurityCheckAlarm( |
|
113 CSystemToneService::TAlarmType aAlarm, const RMessage2& /*aMsg*/, |
|
114 TSecurityInfo& /*aMissing*/) |
|
115 { |
|
116 CPolicyServer::TCustomResult result; |
|
117 switch(aAlarm) |
|
118 { |
|
119 default: |
|
120 result = CPolicyServer::EPass; |
|
121 } |
|
122 return result; |
|
123 } |
|
124 |
|
125 CPolicyServer::TCustomResult CStsServer::SecurityCheckTone( |
|
126 CSystemToneService::TToneType aTone, const RMessage2& /*aMsg*/, |
|
127 TSecurityInfo& /*aMissing*/) |
|
128 { |
|
129 CPolicyServer::TCustomResult result; |
|
130 switch(aTone) |
|
131 { |
|
132 default: |
|
133 result = CPolicyServer::EPass; |
|
134 } |
|
135 return result; |
|
136 } |
|
137 |
84 CSession2* CStsServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
138 CSession2* CStsServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
85 { |
139 { |
86 if (aVersion.iMajor != KStsServerMajorVersion || aVersion.iMinor |
140 if (aVersion.iMajor != KStsServerMajorVersion || aVersion.iMinor |
87 != KStsServerMinorVersion || aVersion.iBuild != KStsServerBuild) |
141 != KStsServerMinorVersion || aVersion.iBuild != KStsServerBuild) |
88 { |
142 { |