Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/secureserverccountserver_8cpp-source.html
week 10 bug fix submission: Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>TB10.1 Example Applications: examples/Base/IPC/secureserver/secureserverccountserver.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<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>
<a name="l00002"></a>00002 <span class="comment">// All rights reserved.</span>
<a name="l00003"></a>00003 <span class="comment">// This component and the accompanying materials are made available</span>
<a name="l00004"></a>00004 <span class="comment">// under the terms of "Eclipse Public License v1.0"</span>
<a name="l00005"></a>00005 <span class="comment">// which accompanies this distribution, and is available</span>
<a name="l00006"></a>00006 <span class="comment">// at the URL "http://www.eclipse.org/legal/epl-v10.html".</span>
<a name="l00007"></a>00007 <span class="comment">//</span>
<a name="l00008"></a>00008 <span class="comment">// Initial Contributors:</span>
<a name="l00009"></a>00009 <span class="comment">// Nokia Corporation - initial contribution.</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// Contributors:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// Description:</span>
<a name="l00014"></a>00014 <span class="comment">// Contains the implementation of functions described in the CSecureServer class.</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017
<a name="l00018"></a>00018
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="secureclientandserver_8h.html">secureclientandserver.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="secureserver_8h.html">secureserver.h</a>"</span>
<a name="l00024"></a>00024
<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)
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 _LIT(KTxTSecureServer,<span class="stringliteral">"SecureServer"</span>);
<a name="l00032"></a>00032 User::Panic(KTxTSecureServer,aPanic);
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034
<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)
<a name="l00041"></a>00041 {
<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);
<a name="l00043"></a>00043 CleanupStack::PushL(<span class="keyword">self</span>);
<a name="l00044"></a>00044 <span class="keyword">self</span>->ConstructL();
<a name="l00045"></a>00045 CleanupStack::Pop();
<a name="l00046"></a>00046 <span class="keywordflow">return</span> <span class="keyword">self</span>;
<a name="l00047"></a>00047 }
<a name="l00048"></a>00048
<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>()
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 <span class="keywordflow">return</span> iContainerIndex->CreateL();
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057
<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)
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064 iContainerIndex->Remove(aCon);
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066
<a name="l00075"></a>00075 CSecureServer::CSecureServer(CActive::TPriority aActiveObjectPriority)
<a name="l00076"></a>00076 : CPolicyServer(aActiveObjectPriority, <a class="code" href="secureserver_8h.html#35e41e8fbb27c5be7ed4ce6c6cd28d2a">KSecureServerPolicy</a>, ESharableSessions)
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078 <span class="comment">// KSecurityPolicy is the TPolicy object that defines the security policy of the server.</span>
<a name="l00079"></a>00079 }
<a name="l00080"></a>00080
<a name="l00090"></a>00090 <span class="keywordtype">void</span> CSecureServer::ConstructL()
<a name="l00091"></a>00091 {
<a name="l00092"></a>00092 iContainerIndex = CObjectConIx::NewL();
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094
<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>()
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100 <span class="keyword">delete</span> iContainerIndex;
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102
<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>
<a name="l00109"></a>00109 <span class="keyword"> </span>{
<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>);
<a name="l00111"></a>00111 <span class="keywordflow">if</span> (!User::QueryVersionSupported(v,aVersion))
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113 User::Leave(KErrNotSupported);
<a name="l00114"></a>00114 }
<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>;
<a name="l00116"></a>00116 }
<a name="l00117"></a>00117
<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)
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138 TInt sid;
<a name="l00139"></a>00139 RMessagePtr2 msg = aMsg;
<a name="l00140"></a>00140 sid = msg.SecureId();
<a name="l00141"></a>00141 <span class="keywordflow">switch</span>(aMsg.Function())
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c29c27793f5b6b3beb6aad11d0bf953144">ESecureServerIncreaseBy</a>:
<a name="l00144"></a>00144 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c20bcce01e7f822786412221374e7a8b76">ESecureServerDecreaseBy</a>:
<a name="l00145"></a>00145 {
<a name="l00146"></a>00146 TInt val = aMsg.Int0();
<a name="l00147"></a>00147 <span class="keywordflow">if</span>(val > 10)
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149 <span class="keywordflow">if</span>(sid > 0x70fffff5)
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151 <span class="keywordflow">return</span> EFail;
<a name="l00152"></a>00152 }
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155 <span class="keywordflow">break</span>;
<a name="l00156"></a>00156 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c2a9d1e980d9ed0a23782b98761d7e57d7">ESecureServerReset</a>:
<a name="l00157"></a>00157 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c242948fe36fdaab2a2d9a4328ea3eedec">ESecureServerDecrease</a>:
<a name="l00158"></a>00158 <span class="keywordflow">case</span> <a class="code" href="secureclientandserver_8h.html#19a3f57ac2d7b8518f6682573ac637c21b3935c0f5f79f45a27de1fa32654e17">ESecureServerIncrease</a>:
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 <span class="keywordflow">break</span>;
<a name="l00162"></a>00162 <span class="keywordflow">default</span>:
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164 aAction = EPanicClient;
<a name="l00165"></a>00165 CheckFailedL(aMsg,aAction,aMissing);
<a name="l00166"></a>00166 <span class="keywordflow">return</span> EFail;
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 }
<a name="l00169"></a>00169 <span class="keywordflow">return</span> EPass;
<a name="l00170"></a>00170 }
</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
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>