uiacceltk/hitchcock/TokenServer/Inc/ftokenserver.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Server declaration, internal for Nokia
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __F_TOKEN_SERVER_H__
       
    21 #define __F_TOKEN_SERVER_H__
       
    22 
       
    23 class CFsTokenServerSession;
       
    24 
       
    25 NONSHARABLE_CLASS(CFsTokenServer): public CServer2
       
    26     {
       
    27 public:
       
    28     static void NewLC();
       
    29 	~CFsTokenServer();
       
    30 	void AddTokenL(const RMessage2& aMessage);
       
    31 	void OpenFileL(const RMessage2& aMessage);
       
    32     void HandleClientExit(const CSession2* aClient);
       
    33 
       
    34 private:
       
    35     void ConstructL();
       
    36     CFsTokenServer():CServer2(CActive::EPriorityStandard){}
       
    37 	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
       
    38 
       
    39 private:
       
    40     RFs iFs;
       
    41 
       
    42     struct TToken
       
    43         {
       
    44         TToken()
       
    45             {
       
    46             Mem::FillZ(this, sizeof(TToken));
       
    47             }
       
    48         TInt64 iToken;
       
    49         TSecurityPolicy iPolicy; 
       
    50         HBufC* iFileName;
       
    51 
       
    52        static TBool CompareToken(const TInt64* aTokenKey, const TToken& aToken)
       
    53             {
       
    54             return *aTokenKey == aToken.iToken;
       
    55             }
       
    56          
       
    57         static TBool CompareOwner(const CSession2* aSession, const TToken& aToken)
       
    58             {
       
    59             return aSession == aToken.iOwner;
       
    60             }
       
    61             
       
    62         CSession2* iOwner;
       
    63         TBool iHasSubToken;        
       
    64         };
       
    65         
       
    66     // ToDo: should use sorted array
       
    67     RArray<TToken> iTokens;
       
    68     };
       
    69 
       
    70 NONSHARABLE_CLASS(CFsTokenServerSession): public CSession2
       
    71     {
       
    72     public:
       
    73     CFsTokenServerSession();
       
    74     ~CFsTokenServerSession();
       
    75     void ServiceL(const RMessage2& aMessage);
       
    76     };
       
    77 
       
    78 #endif