javacommons/security/legacysupport/midp2userpreferences/inc/IPCVersion.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2003 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  * @file
       
    21  * @internalComponent
       
    22  * @released
       
    23  *
       
    24  * Header file to configure/use versioned implementations of the IPC mechanism.
       
    25  */
       
    26 
       
    27 #ifndef IPCVERSION_H
       
    28 #define IPCVERSION_H
       
    29 
       
    30 #include <e32std.h>
       
    31 
       
    32 #include <j2me/os/ipcparams.h>
       
    33 
       
    34 /*
       
    35  * Client Interfaces
       
    36  */
       
    37 
       
    38 class RSessionBaseV : public RSessionBase
       
    39 {
       
    40 public:
       
    41     // NB Always uses EAutoAttach
       
    42     TInt ShareSession(TAttachMode /*unused*/ = RSessionBase::EAutoAttach)
       
    43     {
       
    44         return RSessionBase::ShareAuto();
       
    45     }
       
    46 };
       
    47 
       
    48 /*
       
    49  * the following inline functions can be used as a standard Share()
       
    50  * interface when connecting to other subsystem's servers.
       
    51  */
       
    52 
       
    53 // NB Always uses EAutoAttach
       
    54 inline TInt ShareSession(RSessionBase& session, RSessionBase::TAttachMode /*unused*/ = RSessionBase::EAutoAttach)
       
    55 {
       
    56     return session.ShareAuto();
       
    57 }
       
    58 
       
    59 
       
    60 /*
       
    61  * Server Interfaces
       
    62  */
       
    63 
       
    64 class CSharableSessionV;
       
    65 class CSessionV;
       
    66 class CServerV;
       
    67 typedef RMessage2           RMessageV;
       
    68 typedef RMessagePtr2        RMessagePtrV;
       
    69 
       
    70 class CSharableSessionV : public CSession2
       
    71 {
       
    72 protected:
       
    73     CSharableSessionV() {}
       
    74     virtual void CreateL(const CServerV&)
       
    75     {}
       
    76     void CreateL()
       
    77     {
       
    78         CreateL(*reinterpret_cast<const CServerV*>(Server()));
       
    79     }
       
    80 };
       
    81 
       
    82 
       
    83 class CSessionV : public CSharableSessionV
       
    84 {
       
    85 protected:
       
    86     CSessionV() {}
       
    87     CSessionV(RThread) {}
       
    88 };
       
    89 
       
    90 
       
    91 class CServerV : public CPolicyServer
       
    92 {
       
    93 protected:
       
    94     virtual CSharableSessionV* NewSessionL(const TVersion&) const = 0;
       
    95     CServerV(TInt aPriority, const TPolicy& aPolicy, TServerType aType) : CPolicyServer(aPriority, aPolicy, aType)
       
    96     {}
       
    97 
       
    98 private:
       
    99     CSession2* NewSessionL(const TVersion& aVersion, const RMessageV&) const
       
   100     {
       
   101         return NewSessionL(aVersion);
       
   102     }
       
   103 };
       
   104 
       
   105 
       
   106 #endif // IPCVERSION_H