|
1 /* |
|
2 * Copyright (c) 2007 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: WMDRM File Server implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "wmdrmfileserversession.h" |
|
20 #include "wmdrmfileserver.h" |
|
21 |
|
22 //#define _LOGGING_FILE L"wmdrmfileserver.txt" |
|
23 |
|
24 //#include "flogger.h" |
|
25 //#include "logfn.h" |
|
26 |
|
27 CWmDrmFileServer::CWmDrmFileServer(): |
|
28 CServer2( CActive::EPriorityStandard, ESharableSessions ) |
|
29 { |
|
30 } |
|
31 |
|
32 CServer2* CWmDrmFileServer::NewLC() |
|
33 { |
|
34 //LOGFN( "CWmDrmFileServer::NewLC" ); |
|
35 CWmDrmFileServer* self = new( ELeave ) CWmDrmFileServer; |
|
36 CleanupStack::PushL( self ); |
|
37 self->ConstructL(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 CWmDrmFileServer::~CWmDrmFileServer() |
|
42 { |
|
43 //LOGFN( "CWmDrmFileServer::~CWmDrmFileServer" ); |
|
44 iFs.Close(); |
|
45 } |
|
46 |
|
47 void CWmDrmFileServer::ConstructL() |
|
48 { |
|
49 //LOGFN( "CWmDrmFileServer::ConstructL" ); |
|
50 StartL( KWmDrmFileServerName ); |
|
51 User::LeaveIfError( iFs.Connect() ); |
|
52 } |
|
53 |
|
54 CSession2* CWmDrmFileServer::NewSessionL( |
|
55 const TVersion& /*aVersion*/, |
|
56 const RMessage2& /*aMessage*/ ) const |
|
57 { |
|
58 //LOGFN( "CWmDrmFileServer::NewSessionL" ); |
|
59 return new( ELeave ) CWmDrmFileServerSession(); |
|
60 } |
|
61 |
|
62 RFs& CWmDrmFileServer::Fs() |
|
63 { |
|
64 return iFs; |
|
65 } |
|
66 |
|
67 void PanicClient( |
|
68 const RMessagePtr2& aMessage, |
|
69 TWmDrmPanic aPanic ) |
|
70 { |
|
71 //LOGFN( "PanicClient" ); |
|
72 _LIT( KPanic, "WmDrmServer" ); |
|
73 aMessage.Panic( KPanic, aPanic ); |
|
74 } |
|
75 |
|
76 static void RunServerL() |
|
77 { |
|
78 //LOGFN( "RunServerL" ); |
|
79 |
|
80 User::LeaveIfError( RThread::RenameMe( KWmDrmFileServerName ) ); |
|
81 CActiveScheduler* s = new( ELeave ) CActiveScheduler; |
|
82 CleanupStack::PushL( s ); |
|
83 CActiveScheduler::Install( s ); |
|
84 CWmDrmFileServer::NewLC(); |
|
85 RProcess::Rendezvous( KErrNone ); |
|
86 CActiveScheduler::Start(); |
|
87 CleanupStack::PopAndDestroy( 2 ); // server, s |
|
88 } |
|
89 |
|
90 TInt E32Main() |
|
91 { |
|
92 __UHEAP_MARK; |
|
93 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
94 TInt r = KErrNoMemory; |
|
95 if ( cleanup ) |
|
96 { |
|
97 TRAP( r, RunServerL() ); |
|
98 delete cleanup; |
|
99 } |
|
100 __UHEAP_MARKEND; |
|
101 return r; |
|
102 } |