upnpmediaserver/mediaserverclient/src/upnpsecuritymanager.cpp
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2 * Copyright (c) 2005-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:  Implements the CUpnpService class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "upnpsecuritymanager.h"
       
    21 #include <ecom/ecom.h>
       
    22 #include "upnpmediaserversettings.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CUpnpSecurityManager::~CUpnpSecurityManager
       
    26 //
       
    27 // Destructor.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 EXPORT_C CUpnpSecurityManager::~CUpnpSecurityManager()
       
    31 {
       
    32     // Inform the framework that this specific 
       
    33     // instance of the interface has been destroyed.
       
    34     REComSession::DestroyedImplementation(iDtor_ID_Key);
       
    35 }
       
    36     
       
    37 // -----------------------------------------------------------------------------
       
    38 // CUpnpSecurityManager::NewL
       
    39 // Two-phased constructor.
       
    40 //
       
    41 // Create plugin using for identification field default_data in resource file
       
    42 // -----------------------------------------------------------------------------
       
    43 // 
       
    44 EXPORT_C CUpnpSecurityManager* CUpnpSecurityManager::NewL(const TDesC8& aType)
       
    45 {
       
    46     TEComResolverParams resolverParams;
       
    47     resolverParams.SetDataType(aType);
       
    48     // Disable wildcard matching
       
    49     resolverParams.SetWildcardMatch(EFalse);
       
    50 
       
    51 		const TUid interfaceuidRemote = {0x2001137B};
       
    52 		
       
    53 		RImplInfoPtrArray implArray;
       
    54 		
       
    55 		// check if remote access branch security plugin is found
       
    56 		REComSession::ListImplementationsL(interfaceuidRemote, implArray);
       
    57 		if (implArray.Count() > 0) 
       
    58 		    return REINTERPRET_CAST(CUpnpSecurityManager*,
       
    59                           REComSession::CreateImplementationL(
       
    60                                               KCUpnpSecurityManagerUidRemote,
       
    61                                               _FOFF(CUpnpSecurityManager, iDtor_ID_Key),
       
    62                                               resolverParams));
       
    63  		
       
    64  		// if not, use the standard security plugin
       
    65 		return REINTERPRET_CAST(CUpnpSecurityManager*,
       
    66                           REComSession::CreateImplementationL(
       
    67                                               KCUpnpSecurityManagerUid,
       
    68                                               _FOFF(CUpnpSecurityManager, iDtor_ID_Key),
       
    69                                               resolverParams));
       
    70                                               
       
    71                                               
       
    72 }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CUpnpSecurityManager::NewInstanceFromUpnpSettingsL
       
    76 // 
       
    77 // Creates new instance of CUpnpSecurityManager based on upnp settings,
       
    78 // and NULL if there is no, or empty setting.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C CUpnpSecurityManager* CUpnpSecurityManager::NewInstanceFromUpnpSettingsL()
       
    82     {
       
    83     CUpnpSecurityManager* newInstance = NULL;
       
    84     CUpnpMediaServerSettings* msSettings = CUpnpMediaServerSettings::NewL();
       
    85     CleanupStack::PushL( msSettings );
       
    86     HBufC8* secman = msSettings->GetL( UpnpMediaServerSettings::ESecurityManager );
       
    87     CleanupStack::PushL( secman );
       
    88     if ( secman && *secman != KNullDesC8() )
       
    89         {
       
    90         newInstance = CUpnpSecurityManager::NewL( *secman );
       
    91         }
       
    92     CleanupStack::PopAndDestroy( secman );
       
    93     CleanupStack::PopAndDestroy( msSettings );
       
    94     return newInstance;
       
    95     }
       
    96 
       
    97 // End of File
       
    98