multimediacommsengine/tsrc/mccstub/src/mmccsecureinterface_stub.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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:    Class is used for configuring secure RTP.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "mmccsecureinterface_stub.h"
       
    22 #include "mmccinterfacelogs.h"
       
    23 const TUid KMccControllerUidInterface = {0x101F8CA6};
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CMccEvent::CMccEvent
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CMccSecureInterface::CMccSecureInterface( CMccInterface& aInterface )
       
    34     : iInterface( aInterface )/*, iMessageDest( KMccControllerUidInterface )*/
       
    35     {  
       
    36     }
       
    37     
       
    38 // ---------------------------------------------------------------------------
       
    39 // CMccInterface::ConstructL
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 void CMccSecureInterface::ConstructL( )
       
    43     {
       
    44     __INTERFACE( "CMccSecureInterface::ConstructL" )
       
    45     //iInterface.GetController( iController );
       
    46 	iContextCounter = 0;
       
    47 	iContextId1 = 0;
       
    48 	iContextId2 = 0;
       
    49 	iContextId1Binded = EFalse;
       
    50 	iContextId2Binded = EFalse;
       
    51     //iContextContainer = CMccCryptoContextContainer::NewL();
       
    52     }
       
    53     
       
    54 // ---------------------------------------------------------------------------
       
    55 // CMccSecureInterface::NewL()
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CMccSecureInterface* CMccSecureInterface::NewL( CMccInterface& aInterface )
       
    59     {
       
    60     CMccSecureInterface* self = new(ELeave) CMccSecureInterface( aInterface );
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL( );
       
    63     CleanupStack::Pop( self );
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CMccSecureInterface::~CMccSecureInterface
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CMccSecureInterface::~CMccSecureInterface()
       
    72     {      
       
    73     //delete iContextContainer;
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CMccSecureInterface::CreateContext
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C TInt CMccSecureInterface::CreateContext( const TDesC8& /*aMasterKey*/,
       
    81     							                  const TDesC8& /*aSaltKey*/,
       
    82     							                  TUint32& aContextId,
       
    83     							                  const TDesC8& /*aParams*/ )
       
    84     {
       
    85     
       
    86     TInt err = KErrNone;
       
    87 	aContextId = iContextCounter ++;   
       
    88     if ( iContextId1 == 0 )
       
    89     	iContextId1 = aContextId ;
       
    90     else if ( iContextId2 == 0 )
       
    91     		iContextId2 = aContextId;	
       
    92     
       
    93     return err;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CMccSecureInterface::UpdateContext
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C TInt CMccSecureInterface::UpdateContext( const TDesC8& /*aMasterKey*/,
       
   101     					                          const TDesC8& /*aSaltKey*/,
       
   102     					                          TUint32 aContextId,
       
   103     					                          const TDesC8& /*aParams*/ )
       
   104     {
       
   105     
       
   106     TInt err( KErrNone );
       
   107             
       
   108     if ( aContextId != iContextId1 && iContextId2 != aContextId )
       
   109     	{
       
   110     	err = KErrNotFound;
       
   111     	}
       
   112     return err;   
       
   113     }
       
   114     
       
   115 // ---------------------------------------------------------------------------
       
   116 // CMccSecureInterface::RemoveContext
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 EXPORT_C TInt CMccSecureInterface::RemoveContext( TUint32 aContextId )
       
   120     {
       
   121     
       
   122     TInt err( KErrNone );
       
   123     
       
   124             
       
   125     if ( aContextId != iContextId1 && iContextId2 != aContextId )
       
   126     	{
       
   127     	err = KErrNotFound;
       
   128     	}
       
   129     
       
   130     
       
   131     
       
   132     return err;
       
   133     }
       
   134     
       
   135 // ---------------------------------------------------------------------------
       
   136 // CMccSecureInterface::Bind
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 EXPORT_C TInt CMccSecureInterface::Bind( TUint32 /*aSessionId*/, TUint32 /*aLinkId*/,
       
   140     			                         TUint32 /*aStreamId*/, TUint32 /*aEndPointId*/,
       
   141     			                         TUint32 aContextId )
       
   142     {
       
   143     
       
   144     TInt err = KErrNone;
       
   145     
       
   146    
       
   147     if ( iContextId1Binded && iContextId2Binded )
       
   148     	{
       
   149     	err = KErrArgument;
       
   150     	}
       
   151     if ( aContextId == iContextId1 && iContextId1Binded )
       
   152     	{
       
   153     	err = KErrArgument;
       
   154     	}
       
   155     if ( aContextId == iContextId2 && iContextId2Binded )
       
   156     	{
       
   157     	err = KErrArgument;
       
   158     	}	
       
   159     if ( aContextId != iContextId1 && aContextId != iContextId2 )
       
   160     	{
       
   161     	err = KErrNotFound;
       
   162     	}
       
   163     if ( aContextId == iContextId1 && !iContextId1Binded )
       
   164     	{
       
   165     	iContextId1Binded = ETrue;
       
   166     	}
       
   167     	
       
   168     if ( aContextId == iContextId2 && !iContextId2Binded )
       
   169     	{
       
   170     	iContextId2Binded = ETrue;
       
   171     	}
       
   172     return err;
       
   173     }