|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|
3 <title>TB10.1 Example Applications: examples/Base/IPC/secureserver/secureserverccountserver.cpp Source File</title> |
|
4 <link href="doxygen.css" rel="stylesheet" type="text/css"> |
|
5 <link href="tabs.css" rel="stylesheet" type="text/css"> |
|
6 </head><body> |
|
7 <!-- Generated by Doxygen 1.5.3 --> |
|
8 <h1>examples/Base/IPC/secureserver/secureserverccountserver.cpp</h1><a href="secureserverccountserver_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).</span> |
|
9 <a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span> |
|
10 <a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span> |
|
11 <a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span> |
|
12 <a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span> |
|
13 <a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span> |
|
14 <a name="l00007"></a>00007 <span class="comment">//</span> |
|
15 <a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span> |
|
16 <a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span> |
|
17 <a name="l00010"></a>00010 <span class="comment">//</span> |
|
18 <a name="l00011"></a>00011 <span class="comment">// Contributors:</span> |
|
19 <a name="l00012"></a>00012 <span class="comment">//</span> |
|
20 <a name="l00013"></a>00013 <span class="comment">// Description:</span> |
|
21 <a name="l00014"></a>00014 <span class="comment">// Contains the implementation of functions described in the CSecureServer class.</span> |
|
22 <a name="l00015"></a>00015 <span class="comment">//</span> |
|
23 <a name="l00016"></a>00016 |
|
24 <a name="l00017"></a>00017 |
|
25 <a name="l00018"></a>00018 |
|
26 <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="secureclientandserver_8h.html">secureclientandserver.h</a>"</span> |
|
27 <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="secureserver_8h.html">secureserver.h</a>"</span> |
|
28 <a name="l00024"></a>00024 |
|
29 <a name="l00029"></a><a class="code" href="class_c_secure_server.html#c8c14996a41c6d897efaee0fa7d12cd2">00029</a> <span class="keywordtype">void</span> <a class="code" href="class_c_secure_server.html#c8c14996a41c6d897efaee0fa7d12cd2">CSecureServer::PanicServer</a>(<a class="code" href="secureserver_8h.html#091a5ad2956fb84c4470a59010a0d4ef">TSecureServerPanic</a> aPanic) |
|
30 <a name="l00030"></a>00030 { |
|
31 <a name="l00031"></a>00031 _LIT(KTxTSecureServer,<span class="stringliteral">"SecureServer"</span>); |
|
32 <a name="l00032"></a>00032 User::Panic(KTxTSecureServer,aPanic); |
|
33 <a name="l00033"></a>00033 } |
|
34 <a name="l00034"></a>00034 |
|
35 <a name="l00040"></a><a class="code" href="class_c_secure_server.html#3d4524a4e4accf80a32364780ae43e91">00040</a> <a class="code" href="class_c_secure_server.html">CSecureServer</a>* <a class="code" href="class_c_secure_server.html#3d4524a4e4accf80a32364780ae43e91">CSecureServer::NewL</a>(CActive::TPriority aActiveObjectPriority) |
|
36 <a name="l00041"></a>00041 { |
|
37 <a name="l00042"></a>00042 <a class="code" href="class_c_secure_server.html">CSecureServer</a>* <span class="keyword">self</span> = <span class="keyword">new</span> (ELeave) <a class="code" href="class_c_secure_server.html">CSecureServer</a>(aActiveObjectPriority); |
|
38 <a name="l00043"></a>00043 CleanupStack::PushL(<span class="keyword">self</span>); |
|
39 <a name="l00044"></a>00044 <span class="keyword">self</span>->ConstructL(); |
|
40 <a name="l00045"></a>00045 CleanupStack::Pop(); |
|
41 <a name="l00046"></a>00046 <span class="keywordflow">return</span> <span class="keyword">self</span>; |
|
42 <a name="l00047"></a>00047 } |
|
43 <a name="l00048"></a>00048 |
|
44 <a name="l00053"></a><a class="code" href="class_c_secure_server.html#65a88f3753c16940867d3b277608bdac">00053</a> CObjectCon* <a class="code" href="class_c_secure_server.html#65a88f3753c16940867d3b277608bdac">CSecureServer::NewContainerL</a>() |
|
45 <a name="l00054"></a>00054 { |
|
46 <a name="l00055"></a>00055 <span class="keywordflow">return</span> iContainerIndex->CreateL(); |
|
47 <a name="l00056"></a>00056 } |
|
48 <a name="l00057"></a>00057 |
|
49 <a name="l00062"></a><a class="code" href="class_c_secure_server.html#e6b5aba2bd5e4b8bffaa4febbe874e37">00062</a> <span class="keywordtype">void</span> <a class="code" href="class_c_secure_server.html#e6b5aba2bd5e4b8bffaa4febbe874e37">CSecureServer::RemoveContainer</a>(CObjectCon *aCon) |
|
50 <a name="l00063"></a>00063 { |
|
51 <a name="l00064"></a>00064 iContainerIndex->Remove(aCon); |
|
52 <a name="l00065"></a>00065 } |
|
53 <a name="l00066"></a>00066 |
|
54 <a name="l00075"></a>00075 CSecureServer::CSecureServer(CActive::TPriority aActiveObjectPriority) |
|
55 <a name="l00076"></a>00076 : CPolicyServer(aActiveObjectPriority, <a class="code" href="secureserver_8h.html#35e41e8fbb27c5be7ed4ce6c6cd28d2a">KSecureServerPolicy</a>, ESharableSessions) |
|
56 <a name="l00077"></a>00077 { |
|
57 <a name="l00078"></a>00078 <span class="comment">// KSecurityPolicy is the TPolicy object that defines the security policy of the server.</span> |
|
58 <a name="l00079"></a>00079 } |
|
59 <a name="l00080"></a>00080 |
|
60 <a name="l00090"></a>00090 <span class="keywordtype">void</span> CSecureServer::ConstructL() |
|
61 <a name="l00091"></a>00091 { |
|
62 <a name="l00092"></a>00092 iContainerIndex = CObjectConIx::NewL(); |
|
63 <a name="l00093"></a>00093 } |
|
64 <a name="l00094"></a>00094 |
|
65 <a name="l00098"></a><a class="code" href="class_c_secure_server.html#42202b0478075c59aa39dca27b1cb48d">00098</a> <a class="code" href="class_c_secure_server.html#42202b0478075c59aa39dca27b1cb48d">CSecureServer::~CSecureServer</a>() |
|
66 <a name="l00099"></a>00099 { |
|
67 <a name="l00100"></a>00100 <span class="keyword">delete</span> iContainerIndex; |
|
68 <a name="l00101"></a>00101 } |
|
69 <a name="l00102"></a>00102 |
|
70 <a name="l00108"></a><a class="code" href="class_c_secure_server.html#1f53e7eb732c048d41f7a74069c971bf">00108</a> CSession2* <a class="code" href="class_c_secure_server.html#1f53e7eb732c048d41f7a74069c971bf">CSecureServer::NewSessionL</a>(<span class="keyword">const</span> TVersion &aVersion,<span class="keyword">const</span> RMessage2& <span class="comment">/*aMessage*/</span>)<span class="keyword"> const</span> |
|
71 <a name="l00109"></a>00109 <span class="keyword"> </span>{ |
|
72 <a name="l00110"></a>00110 TVersion v(<a class="code" href="secureclientandserver_8h.html#2c7a31de3ef992e8aa4c26453c32fc5f">KSecureServMajorVersionNumber</a>,<a class="code" href="secureclientandserver_8h.html#278c356b18a5bf229401b22dc41f4a93">KSecureServMinorVersionNumber</a>,<a class="code" href="secureclientandserver_8h.html#d2f7af8cbb138c526da5559f77f5764d">KSecureServBuildVersionNumber</a>); |
|
73 <a name="l00111"></a>00111 <span class="keywordflow">if</span> (!User::QueryVersionSupported(v,aVersion)) |
|
74 <a name="l00112"></a>00112 { |
|
75 <a name="l00113"></a>00113 User::Leave(KErrNotSupported); |
|
76 <a name="l00114"></a>00114 } |
|
77 <a name="l00115"></a>00115 <span class="keywordflow">return</span> <span class="keyword">new</span> (ELeave) <a class="code" href="class_c_secure_server_session.html">CSecureServerSession</a>; |
|
78 <a name="l00116"></a>00116 } |
|
79 <a name="l00117"></a>00117 |
|
80 <a name="l00136"></a><a class="code" href="class_c_secure_server.html#cf179b4c14ae84701779f659c9e4488f">00136</a> CPolicyServer::TCustomResult <a class="code" href="class_c_secure_server.html#cf179b4c14ae84701779f659c9e4488f">CSecureServer:: CustomSecurityCheckL</a>(<span class="keyword">const</span> RMessage2 &aMsg, TInt &aAction, TSecurityInfo &aMissing) |
|
81 <a name="l00137"></a>00137 { |
|
82 <a name="l00138"></a>00138 TInt sid; |
|
83 <a name="l00139"></a>00139 RMessagePtr2 msg = aMsg; |
|
84 <a name="l00140"></a>00140 sid = msg.SecureId(); |
|
85 <a name="l00141"></a>00141 <span class="keywordflow">switch</span>(aMsg.Function()) |
|
86 <a name="l00142"></a>00142 { |
|
87 <a name="l00143"></a>00143 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c29c27793f5b6b3beb6aad11d0bf953144">ESecureServerIncreaseBy</a>: |
|
88 <a name="l00144"></a>00144 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c20bcce01e7f822786412221374e7a8b76">ESecureServerDecreaseBy</a>: |
|
89 <a name="l00145"></a>00145 { |
|
90 <a name="l00146"></a>00146 TInt val = aMsg.Int0(); |
|
91 <a name="l00147"></a>00147 <span class="keywordflow">if</span>(val > 10) |
|
92 <a name="l00148"></a>00148 { |
|
93 <a name="l00149"></a>00149 <span class="keywordflow">if</span>(sid > 0x70fffff5) |
|
94 <a name="l00150"></a>00150 { |
|
95 <a name="l00151"></a>00151 <span class="keywordflow">return</span> EFail; |
|
96 <a name="l00152"></a>00152 } |
|
97 <a name="l00153"></a>00153 } |
|
98 <a name="l00154"></a>00154 } |
|
99 <a name="l00155"></a>00155 <span class="keywordflow">break</span>; |
|
100 <a name="l00156"></a>00156 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c2a9d1e980d9ed0a23782b98761d7e57d7">ESecureServerReset</a>: |
|
101 <a name="l00157"></a>00157 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c242948fe36fdaab2a2d9a4328ea3eedec">ESecureServerDecrease</a>: |
|
102 <a name="l00158"></a>00158 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c21b3935c0f5f79f45a27de1fa32654e17">ESecureServerIncrease</a>: |
|
103 <a name="l00159"></a>00159 { |
|
104 <a name="l00160"></a>00160 } |
|
105 <a name="l00161"></a>00161 <span class="keywordflow">break</span>; |
|
106 <a name="l00162"></a>00162 <span class="keywordflow">default</span>: |
|
107 <a name="l00163"></a>00163 { |
|
108 <a name="l00164"></a>00164 aAction = EPanicClient; |
|
109 <a name="l00165"></a>00165 CheckFailedL(aMsg,aAction,aMissing); |
|
110 <a name="l00166"></a>00166 <span class="keywordflow">return</span> EFail; |
|
111 <a name="l00167"></a>00167 } |
|
112 <a name="l00168"></a>00168 } |
|
113 <a name="l00169"></a>00169 <span class="keywordflow">return</span> EPass; |
|
114 <a name="l00170"></a>00170 } |
|
115 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:32:57 2010 for TB10.1 Example Applications by |
|
116 <a href="http://www.doxygen.org/index.html"> |
|
117 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> |
|
118 </body> |
|
119 </html> |