vpnengine/ikeutils/src/cmutils.cpp
branchRCL_3
changeset 23 473321461bba
parent 22 9f4e37332ce5
child 24 e06095241a65
equal deleted inserted replaced
22:9f4e37332ce5 23:473321461bba
     1 /*
       
     2 * Copyright (c) 2010 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:  CmManager related utility functionality
       
    15 *
       
    16 */
       
    17 
       
    18 #include <cmmanager.h>
       
    19 #include <cmconnectionmethod.h>
       
    20 #include <cmpluginvpndef.h>
       
    21 
       
    22 #include "cmutils.h"
       
    23 
       
    24 
       
    25 EXPORT_C void CmUtils::GetPolicyIdL( const TUint32 aVpnApId, TVpnPolicyId& aPolId )
       
    26 {
       
    27     using namespace CMManager;
       
    28     
       
    29     RCmManager cmManager;
       
    30     
       
    31     cmManager.OpenL();
       
    32     CleanupClosePushL( cmManager );      
       
    33     
       
    34     RCmConnectionMethod cm = cmManager.ConnectionMethodL( aVpnApId );
       
    35     CleanupClosePushL( cm );
       
    36 
       
    37     HBufC* policy = cm.GetStringAttributeL( EVpnServicePolicy );
       
    38 
       
    39     if( policy && policy->Length() <= aPolId.MaxLength() )
       
    40     {
       
    41         aPolId.Copy( *policy );
       
    42     }
       
    43     
       
    44     delete policy;
       
    45 
       
    46     CleanupStack::PopAndDestroy( 2 );  // cm and cmManager
       
    47 }
       
    48 
       
    49 
       
    50 /***/