natfw/natfwunsaf_protocols/unsaf_codec/src/natfwunsafsharedsecretresponse.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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 
       
    21 #include "natfwunsafsharedsecretresponse.h"
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // CNATFWUNSAFSharedSecretResponse::NewL
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 CNATFWUNSAFSharedSecretResponse* CNATFWUNSAFSharedSecretResponse::NewL(
       
    28     const TNATFWUNSAFTransactionID& aTransactionID)
       
    29     {
       
    30     CNATFWUNSAFSharedSecretResponse* self =
       
    31         CNATFWUNSAFSharedSecretResponse::NewLC(aTransactionID);
       
    32     CleanupStack::Pop(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CNATFWUNSAFSharedSecretResponse::NewLC
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CNATFWUNSAFSharedSecretResponse* CNATFWUNSAFSharedSecretResponse::NewLC(
       
    41     const TNATFWUNSAFTransactionID& aTransactionID)
       
    42     {
       
    43     CNATFWUNSAFSharedSecretResponse* self =
       
    44         new (ELeave) CNATFWUNSAFSharedSecretResponse(aTransactionID);
       
    45     CleanupStack::PushL(self);
       
    46     return self;
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CNATFWUNSAFSharedSecretResponse::CreateL
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CNATFWUNSAFMessage* CNATFWUNSAFSharedSecretResponse::CreateL(
       
    54     const TNATFWUNSAFTransactionID& aTransactionID)
       
    55     {
       
    56     return NewL(aTransactionID);
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CNATFWUNSAFSharedSecretResponse::CNATFWUNSAFSharedSecretResponse
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CNATFWUNSAFSharedSecretResponse::CNATFWUNSAFSharedSecretResponse(
       
    64     const TNATFWUNSAFTransactionID& aTransactionID) :
       
    65     CNATFWUNSAFMessage(aTransactionID)
       
    66     {
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CNATFWUNSAFSharedSecretResponse::~CNATFWUNSAFSharedSecretResponse
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 CNATFWUNSAFSharedSecretResponse::~CNATFWUNSAFSharedSecretResponse()
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CNATFWUNSAFSharedSecretResponse::Type
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CNATFWUNSAFMessage::TType CNATFWUNSAFSharedSecretResponse::Type() const
       
    82     {
       
    83     return CNATFWUNSAFMessage::ESharedSecretResponse;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CNATFWUNSAFSharedSecretResponse::Validate
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TBool CNATFWUNSAFSharedSecretResponse::Validate() const
       
    91     {
       
    92     return (HasAttribute(CNATFWUNSAFAttribute::EUsername) &&
       
    93             HasAttribute(CNATFWUNSAFAttribute::EPassword));
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CNATFWUNSAFSharedSecretResponse::IsAllowed
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TBool CNATFWUNSAFSharedSecretResponse::IsAllowed(TUint16 aAttributeType) const
       
   101     {
       
   102     return (aAttributeType == CNATFWUNSAFAttribute::EUsername ||
       
   103             aAttributeType == CNATFWUNSAFAttribute::EPassword ||
       
   104             aAttributeType == CNATFWUNSAFAttribute::ERealm ||
       
   105             aAttributeType == CNATFWUNSAFAttribute::EMessageIntegrity ||
       
   106             aAttributeType == CNATFWUNSAFAttribute::EFingerprint);
       
   107     }