natfw/natfwstunturnclient/inc/cstuncredentials.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005-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 #ifndef C_CSTUNCREDENTIALS_H
       
    22 #define C_CSTUNCREDENTIALS_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31  *  This class represents the credentials obtained either from a STUN server
       
    32  *  with a Shared Secret Request, or set directly by application.
       
    33  */
       
    34 class CSTUNCredentials : public CBase
       
    35     {
       
    36     public: // Constructors and destructor
       
    37 
       
    38         /**
       
    39          * Creates a new instance of CSTUNCredentials.
       
    40          * @param aUsername Username
       
    41          * @param aPassword Password
       
    42          * @return A new instance of CSTUNCredentials, ownership is transferred.
       
    43          */
       
    44         static CSTUNCredentials*
       
    45             NewL( const TDesC8& aUsername, const TDesC8& aPassword );
       
    46 
       
    47         /**
       
    48          * Destructor
       
    49          */
       
    50         ~CSTUNCredentials();    
       
    51 
       
    52     public: // New functions
       
    53 
       
    54         /**
       
    55          * Get the username.
       
    56          * @return Username
       
    57          */
       
    58         const TDesC8& Username() const;
       
    59 
       
    60         /**
       
    61          * Get the password.        
       
    62          * @return Password
       
    63          */
       
    64         const TDesC8& Password() const;
       
    65         
       
    66         /**
       
    67          * Compares the username and password to given values.
       
    68          * @param aUsername Username to compare with
       
    69          * @param aPassword Password to compare with
       
    70          * @return ETrue Credentials match with parameters, EFalse otherwise
       
    71          */
       
    72         TBool Compare( const TDesC8& aUsername, 
       
    73             const TDesC8& aPassword ) const;
       
    74 
       
    75     private: // Constructors, for internal use
       
    76 
       
    77         /**
       
    78          * Constructor
       
    79          */
       
    80         CSTUNCredentials();
       
    81         
       
    82         /**
       
    83          * Copy constructor
       
    84          */
       
    85         CSTUNCredentials( const CSTUNCredentials& aCredentials );
       
    86 
       
    87         /**
       
    88          * Second phase constructor.
       
    89          *
       
    90          * @param aUsername  Username
       
    91          * @param aPassword  Password
       
    92          */
       
    93         void ConstructL( const TDesC8& aUsername, 
       
    94             const TDesC8& aPassword );
       
    95 
       
    96     private: // Data
       
    97 
       
    98         /**
       
    99          * Username to use in the authentication process.
       
   100          * own.
       
   101          */
       
   102         HBufC8* iUsername;
       
   103         
       
   104         /**
       
   105          * Password is the shared secret.
       
   106          * own.
       
   107          */
       
   108         HBufC8* iPassword;
       
   109 
       
   110     };
       
   111 
       
   112 #endif // C_CSTUNCREDENTIALS_H