|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // server side exmaple of how to use the abstract server framework |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32debug.h> |
|
19 #include "lbstestserver.h" |
|
20 #include "lbstestserverdata.h" |
|
21 #include "lbstestmessageenums.h" |
|
22 #include "lbstestsession.h" |
|
23 |
|
24 |
|
25 /////////////////////////////////////////////////////////////////////////////// |
|
26 // Security Policy information |
|
27 /////////////////////////////////////////////////////////////////////////////// |
|
28 const TUint myRangeCount = 4; |
|
29 const TInt myRanges[myRangeCount] = |
|
30 { |
|
31 0, //range is 0-1 inclusive |
|
32 ESecureSubSessionBaseClose, //range is ESecureSubSessionBaseClose to (EFirstLbsTestServerMessage - 1) |
|
33 EFirstLbsTestServerMessage, //range is EFirstLbsTestServerMessage to (ELastLbsTestServerMessage - 1) |
|
34 ELastLbsTestServerMessage // range is ELastLbsTestServerMessage to KMaxTInt inclusive |
|
35 }; |
|
36 |
|
37 const TUint8 myElementsIndex[myRangeCount] = |
|
38 { |
|
39 CPolicyServer::EAlwaysPass, |
|
40 CPolicyServer::ENotSupported, |
|
41 0, |
|
42 CPolicyServer::ENotSupported |
|
43 }; |
|
44 |
|
45 const CPolicyServer::TPolicyElement myElements[] = |
|
46 { |
|
47 {_INIT_SECURITY_POLICY_C1(ECapabilityLocation), CPolicyServer::EFailClient} |
|
48 }; |
|
49 |
|
50 const CPolicyServer::TPolicy myPolicy = |
|
51 { |
|
52 CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass |
|
53 myRangeCount, |
|
54 myRanges, |
|
55 myElementsIndex, |
|
56 myElements, |
|
57 }; |
|
58 |
|
59 /////////////////////////////////////////////////////////////////////////////// |
|
60 // Implementation of Server Framework functions |
|
61 /////////////////////////////////////////////////////////////////////////////// |
|
62 |
|
63 MCreateServerImpl* CSecureASBase::GetImplLC() |
|
64 { |
|
65 CLbsTestServerImpl* impl = new(ELeave) CLbsTestServerImpl(); |
|
66 CleanupStack::PushL(impl); |
|
67 return impl; |
|
68 } |
|
69 |
|
70 void CLbsTestServerImpl::CreateServerLC(TServerStartParams& aParams) |
|
71 { |
|
72 CLbsTestServer* s = new(ELeave) CLbsTestServer(CActive::EPriorityStandard, myPolicy); |
|
73 CleanupStack::PushL(s); |
|
74 s->ConstructL(aParams.GetServerName()); |
|
75 // leave the server object on the CS |
|
76 } |
|
77 |
|
78 /////////////////////////////////////////////////////////////////////////////// |
|
79 // CTestServer |
|
80 /////////////////////////////////////////////////////////////////////////////// |
|
81 |
|
82 CLbsTestServer::CLbsTestServer(TInt aPriority, const CPolicyServer::TPolicy& aSecurityPolicy) : |
|
83 CSecureServerBase(aPriority, aSecurityPolicy), |
|
84 iVersion(KTestServerMajorVersionNumber, |
|
85 KTestServerMinorVersionNumber, |
|
86 KTestServerBuildVersionNumber) |
|
87 { |
|
88 } |
|
89 |
|
90 CLbsTestServer::~CLbsTestServer() |
|
91 { |
|
92 } |
|
93 |
|
94 void CLbsTestServer::ConstructL(const TDesC& aServerName) |
|
95 { |
|
96 StartL(aServerName); |
|
97 BaseConstructL(); // MUST BE CALLED |
|
98 } |
|
99 |
|
100 CSession2* CLbsTestServer::DoNewSessionL(const TVersion& /*aVersion*/, const RMessage2& /*aMessage*/) const |
|
101 { |
|
102 return new (ELeave) CLbsTestSession(); // version number already checked at this point |
|
103 } |
|
104 |
|
105 |
|
106 TVersion CLbsTestServer::GetServerVersion() const |
|
107 { |
|
108 return iVersion; |
|
109 } |