realtimenetprots/sipfw/SIP/SIPSec/DigestPlugin/inc/sipsecrequestdata.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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 * Name          : sipsecrequestdata.h
       
    16 * Part of       : SIPSec/DigestPlugin
       
    17 * Version       : SIP/6.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef __SIPSEC_REQUESTDATA_H__
       
    29 #define __SIPSEC_REQUESTDATA_H__
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 #include <e32std.h>
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class TSIPSecDigestCtxProcess;
       
    37 class TSIPSecDigestVerifyContext;
       
    38 
       
    39 
       
    40 // CLASS DECLARATION
       
    41 /**
       
    42  * @brief Class represents data field of A2 
       
    43  *
       
    44  * @class RSIPSecRequestDataField sipsecrequestdata.h "sipsecrequestdata.h" 
       
    45  */
       
    46 class RSIPSecRequestDataField 
       
    47     {
       
    48 public:
       
    49     
       
    50     /**
       
    51     * Default Constructor
       
    52     */
       
    53     RSIPSecRequestDataField();
       
    54 
       
    55     /**
       
    56     * Closes
       
    57     */
       
    58     void Close();
       
    59     
       
    60     /**
       
    61     * Constructor
       
    62     * @param aValue value of field
       
    63     * @param aNeedsHashing does it need hashing
       
    64     */
       
    65     RSIPSecRequestDataField( const TDesC8& aValue, TBool aNeedsHashing );
       
    66 
       
    67     /**
       
    68     * Constructor
       
    69     * @param aValue value of field
       
    70     * @param aNeedsHashing does it need hashing
       
    71     */
       
    72     RSIPSecRequestDataField( TPtrC8 aValue, TBool aNeedsHashing );  
       
    73 
       
    74     /**
       
    75     * Constructor
       
    76     * @param aValue value of field
       
    77     * @param aNeedsHashing does it need hashing
       
    78     */
       
    79     RSIPSecRequestDataField( HBufC8* aValue, TBool aNeedsHashing );
       
    80 
       
    81     /**
       
    82     * Does field need hashing
       
    83     * @return ETrue, if field needs hashing
       
    84     */
       
    85     TBool NeedsHashing() const;
       
    86 
       
    87     /**
       
    88     * Value of the field
       
    89     * @return Value of the field
       
    90     */
       
    91     TPtrC8 Value();
       
    92 
       
    93 private: // Data
       
    94 
       
    95     // Value    
       
    96     TPtrC8 iValue;
       
    97     
       
    98     // Does field need hashing    
       
    99     TBool iNeedsHashing;
       
   100 
       
   101     // Holds pointer to buffer. Owned.
       
   102     HBufC8* iBuffer;
       
   103     };
       
   104 
       
   105 
       
   106 
       
   107 /**
       
   108  * @brief Class represents A2 of response of credentials or authentication info
       
   109  * 
       
   110  * @class CSIPSecRequestData sipsecrequestdata.h "sipsecrequestdata.h"
       
   111  */
       
   112 class CSIPSecRequestData : public CBase
       
   113     {
       
   114 public:
       
   115 
       
   116     enum TQop
       
   117         {
       
   118         EUnknown = -1, 	// qop exists, but isn't auth or auth-int
       
   119         EAuth,			// auth
       
   120         EAuthInt,		// auth-int
       
   121         EDoesNotExist	// qop doesn't exist
       
   122         };
       
   123 
       
   124     /**
       
   125     * Constructor
       
   126     * @param aContext Digest context
       
   127     * @param aQop Qop value
       
   128     */
       
   129     static CSIPSecRequestData* NewL( TSIPSecDigestCtxProcess& aContext,
       
   130     								 CSIPSecRequestData::TQop aQop );
       
   131 
       
   132     /**
       
   133     * Size of data
       
   134     * @return Size of data
       
   135     */
       
   136     TInt Size() const;
       
   137 
       
   138     /**
       
   139     * Next field
       
   140     * @return Next field
       
   141     */
       
   142     virtual RSIPSecRequestDataField NextL();
       
   143     
       
   144     /**
       
   145     * Is end of data
       
   146     * @return ETrue if end of data
       
   147     */
       
   148     virtual TBool EndOfData() const;
       
   149 
       
   150     /**
       
   151     * Separator of the field
       
   152     * @return Separator of the field
       
   153     */
       
   154     virtual const TDesC8& Separator() const;
       
   155 
       
   156 protected: // New functions
       
   157 
       
   158     /**
       
   159     * Constructor
       
   160     * @param aContext Digest context
       
   161     * @param aQop Qop value
       
   162     */
       
   163     CSIPSecRequestData( TSIPSecDigestCtxProcess& aContext,
       
   164     					CSIPSecRequestData::TQop aQop );
       
   165 
       
   166 private: // New functions, for internal use
       
   167     
       
   168     /**
       
   169     * 2nd phase Constructor
       
   170     */
       
   171     void ConstructL();
       
   172     
       
   173 protected: // Data
       
   174 
       
   175     // Digest context
       
   176     TSIPSecDigestCtxProcess& iDigestContext;
       
   177 
       
   178     // Field iterator    
       
   179     TInt iIterator;
       
   180 
       
   181     // Qop    
       
   182     TQop iQop;
       
   183     
       
   184     // Size of data    
       
   185     TInt iSize;    
       
   186     };
       
   187 
       
   188 
       
   189 
       
   190 /**
       
   191  * @brief Class represents A2 of response of security verify
       
   192  * 
       
   193  * @class CSIPSecDigestVerifyData sipsecrequestdata.h "sipsecrequestdata.h"
       
   194  *
       
   195  */
       
   196 class CSIPSecDigestVerifyData : public CSIPSecRequestData
       
   197     {    
       
   198 public:
       
   199 
       
   200     /**
       
   201     * Constructor
       
   202     * @param aContext Digest context
       
   203     * @param aQop Qop value
       
   204     */
       
   205     static CSIPSecDigestVerifyData* NewL( TSIPSecDigestVerifyContext& aContext,
       
   206     		  							  CSIPSecRequestData::TQop aQop );
       
   207 
       
   208     /**
       
   209     * Next field
       
   210     * @return Next field
       
   211     */
       
   212     RSIPSecRequestDataField NextL();
       
   213     
       
   214     /**
       
   215     * Is end of data
       
   216     * @return ETrue if end of data
       
   217     */
       
   218     TBool EndOfData() const;    
       
   219 
       
   220 private: // Constructors, for internal use
       
   221     
       
   222     /**
       
   223     * Constructor
       
   224     * @param aContext Digest context
       
   225     * @param aQop Qop value
       
   226     */
       
   227     CSIPSecDigestVerifyData( TSIPSecDigestVerifyContext& aContext,
       
   228     						 CSIPSecRequestData::TQop aQop );
       
   229 
       
   230     /**
       
   231     * 2nd phase Constructor
       
   232     */
       
   233     void ConstructL();
       
   234     };
       
   235 
       
   236 #endif //__SIPSEC_REQUESTDATA_H__