vpnengine/dmadpki/src/dmadcertparms.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2002 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: Implementation of CDmAdCertParms.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <utf.h>
       
    20 
       
    21 #include "dmadcertparms.h"
       
    22 #include "vpnlogger.h"
       
    23 
       
    24 CDmAdCertParms* CDmAdCertParms::NewL()
       
    25     {
       
    26     TRACE("CDmAdCertParms::NewL");
       
    27     
       
    28     CDmAdCertParms* self = NewLC();
       
    29     CleanupStack::Pop(self);
       
    30     return self;
       
    31     }
       
    32 
       
    33 CDmAdCertParms* CDmAdCertParms::NewLC()
       
    34     {
       
    35     CDmAdCertParms* self = new (ELeave) CDmAdCertParms();
       
    36     CleanupStack::PushL(self);
       
    37     return self;
       
    38     }
       
    39 
       
    40 CDmAdCertParms::CDmAdCertParms()
       
    41     {
       
    42     }
       
    43     
       
    44 CDmAdCertParms::~CDmAdCertParms()
       
    45     {
       
    46     TRACE("CDmAdCertParms::~CDmAdCertParms");
       
    47     
       
    48     iApplicability.Reset();
       
    49     iApplicability.Close();
       
    50     delete iContent;    
       
    51     }
       
    52     
       
    53 TPKICertificateOwnerType CDmAdCertParms::Type() const
       
    54     {
       
    55     TRACE("CDmAdCertParms::Type");    
       
    56     return iType;
       
    57     }
       
    58     
       
    59 void CDmAdCertParms::SetType(TPKICertificateOwnerType aType)
       
    60     {
       
    61     TRACE("CDmAdCertParms::SetType");
       
    62 
       
    63     iType = aType;
       
    64     } 
       
    65 
       
    66 
       
    67 TBool CDmAdCertParms::Deletable() const
       
    68     {
       
    69     return iDeletable;
       
    70     }
       
    71     
       
    72 void CDmAdCertParms::SetDeletable(TBool aDeletable)
       
    73     {
       
    74     TRACE("CDmAdCertParms::SetDeletable");
       
    75     
       
    76     iDeletable = aDeletable;
       
    77     }
       
    78  
       
    79 TBool CDmAdCertParms::Trusted() const
       
    80     {        
       
    81     return iTrusted;
       
    82     }
       
    83     
       
    84 void CDmAdCertParms::SetTrusted(TBool aTrusted)
       
    85     {
       
    86     TRACE("CDmAdCertParms::SetTrusted");
       
    87     iTrusted = aTrusted;
       
    88     }
       
    89  
       
    90 const RArray<TUid>& CDmAdCertParms::Applicability() const
       
    91     {
       
    92     return iApplicability;
       
    93     }
       
    94  
       
    95 void CDmAdCertParms::SetApplicabilityL(const RArray<TUid>& aApplicability)
       
    96     {
       
    97     TRACE("CDmAdCertParms::SetApplicabilityL");
       
    98     
       
    99     iApplicability.Reset();
       
   100     
       
   101     for (TInt i = 0; i < aApplicability.Count(); ++i)
       
   102         {
       
   103         User::LeaveIfError(iApplicability.Append(aApplicability[i]));
       
   104         }
       
   105     }
       
   106 
       
   107 TPtrC8 CDmAdCertParms::Content() const
       
   108     {
       
   109     TPtrC8 ret(KNullDesC8);
       
   110     if (iContent != 0)
       
   111         {
       
   112         ret.Set(*iContent);
       
   113         }
       
   114     return ret;
       
   115     }
       
   116  
       
   117 void CDmAdCertParms::SetContentL(const TDesC8& aContent)
       
   118     {
       
   119     TRACE("CDmAdCertParms::SetContentL");
       
   120     
       
   121     delete iContent;
       
   122     iContent = 0;
       
   123     if (aContent.Length() > 0)
       
   124         {
       
   125         iContent = aContent.AllocL();
       
   126         }
       
   127     }
       
   128 
       
   129 TPtrC8 CDmAdCertParms::KeyId() const
       
   130     {
       
   131     return iKeyId;
       
   132     }
       
   133  
       
   134 void CDmAdCertParms::SetKeyId(const TDesC8& aKeyLuid)
       
   135     {
       
   136     TRACE("CDmAdCertParms::SetKeyId");
       
   137     
       
   138     __ASSERT_ALWAYS(aKeyLuid.Length() <= iKeyId.MaxLength(), User::Invariant());    
       
   139     iKeyId = aKeyLuid;
       
   140     }