secsrv_plat/cms_api/inc/CCMSAttribute.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCMSAttribute_H
       
    21 #define CCMSAttribute_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "CCMSSequence.h"
       
    25 #include <badesca.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 // Extension
       
    29 class MCMSAttributeExtension;
       
    30 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 *  Attribute type module
       
    35 *
       
    36 *  ASN.1 Definition:
       
    37 *  Attribute ::= SEQUENCE {
       
    38 *  		attrType OBJECT IDENTIFIER,
       
    39 *  		attrValues SET OF AttributeValue }
       
    40 *
       
    41 *  AttributeValue ::= ANY
       
    42 *
       
    43 *  @lib cms.lib
       
    44 *  @since 2.8
       
    45 */
       
    46 class CCMSAttribute : public CCMSSequence
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49 		/**
       
    50         * Two-phased constructor.
       
    51         * NOTE: Encrypt will leave with KErrBadDescriptor if
       
    52         * valid Attribute Type has not setted.
       
    53         */
       
    54         IMPORT_C static CCMSAttribute* NewLC();
       
    55 
       
    56 	   /**
       
    57         * Two-phased constructor.
       
    58         * NOTE: Encrypt will leave with KErrBadDescriptor if
       
    59         * valid Attribute Type has not setted.
       
    60         */
       
    61         IMPORT_C static CCMSAttribute* NewL();
       
    62 		
       
    63 		/**
       
    64         * Two-phased constructor.
       
    65         * Takes copy of the both type and values.
       
    66         * @param aAttributeType	The attribute type in desc e.g.
       
    67         *						content type = "1.2.840.113549.1.9.3".
       
    68         * @param aAttriteValues	Set of attribute values. Each attribute must be
       
    69         *						already encoded since they are added as is.
       
    70         */
       
    71         IMPORT_C static CCMSAttribute* NewL( const TDesC& aAttributeType,
       
    72 										     const CDesC8Array& aAttributeValues );
       
    73 
       
    74         /**
       
    75         * Two-phased constructor.
       
    76         * Takes copy of the both type and values.
       
    77 		* Leaves newly created instance in CleanupStack
       
    78         * @param aAttributeType	The attribute type in desc e.g.
       
    79         *						content type = "1.2.840.113549.1.9.3".
       
    80         * @param aAttriteValues	Set of attribute values. Each attribute must be
       
    81         *						already encoded since they are added as is.
       
    82         */
       
    83         IMPORT_C static CCMSAttribute* NewLC( const TDesC& aAttributeType,
       
    84 											  const CDesC8Array& aAttributeValues );
       
    85 
       
    86 		/**
       
    87         * Two-phased constructor.
       
    88         * Same as above although takes only one value
       
    89         * @param aAttributeType	The attribute type in desc e.g.
       
    90         *						content type = "1.2.840.113549.1.9.3".
       
    91         * @param aAttriteValue	Single attribute value. Attribute must be
       
    92         *						already encoded since it is added as is.
       
    93         */
       
    94         IMPORT_C static CCMSAttribute* NewL( const TDesC& aAttributeType,
       
    95 											 const TDesC8& aAttributeValue );
       
    96 
       
    97 		/**
       
    98         * Two-phased constructor.
       
    99         * Same as above although takes only one value
       
   100 		* Leaves newly created instance in CleanupStack
       
   101         * @param aAttributeType	The attribute type in desc e.g.
       
   102         *						content type = "1.2.840.113549.1.9.3".
       
   103         * @param aAttriteValue	Single attribute value. Attribute must be
       
   104         *						already encoded since it is added as is.
       
   105         */
       
   106         IMPORT_C static CCMSAttribute* NewLC( const TDesC& aAttributeType,
       
   107 											  const TDesC8& aAttributeValue );
       
   108 
       
   109         /**
       
   110         * Destructor.
       
   111         */
       
   112         virtual ~CCMSAttribute();
       
   113 
       
   114     public: // New functions
       
   115 
       
   116         /**
       
   117 		* Getter for attribute type
       
   118 		* @since 2,8
       
   119 		* @return Attribute type in TDesC reference
       
   120 		*/
       
   121 		IMPORT_C const TDesC& AttributeType() const;
       
   122 
       
   123         /**
       
   124         * Getter for attribute values
       
   125         * @since 2.8
       
   126         * @return Attribute values in CDesC8ArrayFlat reference
       
   127         */
       
   128 		IMPORT_C const CDesC8Array& AttributeValues() const;
       
   129 
       
   130 		/**
       
   131         * Setter for attribute type, takes copy
       
   132         * @since 2.8
       
   133         * @param aAttributeType	Attribute type to be set as TDesC.
       
   134         */
       
   135 		IMPORT_C void SetAttributeTypeL( const TDesC& aAttributeType );
       
   136 
       
   137         /**
       
   138         * Setter for attribute values
       
   139         * @since 2,8
       
   140         * @param aSerialNumber Array of attribute values
       
   141         */
       
   142 		IMPORT_C void SetAttributeValuesL( const CDesC8Array& aAttributeValues );
       
   143 
       
   144     public: // Functions from base classes
       
   145 
       
   146 	 	/**
       
   147         * From MCMSModule
       
   148         * @since 2.8
       
   149         * @param aRawData raw-data to be parsed in this instance
       
   150         */
       
   151         void DecodeL( const TDesC8& aRawData );
       
   152 
       
   153 	 	/**
       
   154         * From MCMSModule
       
   155         * @since 2.8
       
   156         * @return Returns ASN1 encoder and leaves it in CleanupStack
       
   157         */
       
   158         CASN1EncBase* EncoderLC() const;
       
   159 
       
   160     protected:  // New functions
       
   161 
       
   162 	   /**
       
   163         * Protected construction to allow derivation
       
   164         */
       
   165         IMPORT_C void ConstructL();
       
   166 
       
   167 	   /**
       
   168         * Protected construction to allow derivation
       
   169         */
       
   170         IMPORT_C void ConstructL( const TDesC& aAttributeType,
       
   171 								  const CDesC8Array& aAttributeValues );
       
   172 
       
   173 	   /**
       
   174         * Protected construction to allow derivation
       
   175         */
       
   176         IMPORT_C void ConstructL( const TDesC& aAttributeType,
       
   177 								  const TDesC8& aAttributeValue );
       
   178 
       
   179         /**
       
   180         * C++ default constructor.
       
   181         */
       
   182         IMPORT_C CCMSAttribute();
       
   183 
       
   184     private:    // Data
       
   185         // Attribute Type, owned
       
   186         HBufC* iAttributeType;
       
   187         // Attribute values, owned
       
   188 		CDesC8ArrayFlat* iAttributeValues;
       
   189 
       
   190 		// Reserved for extensions
       
   191 		MCMSAttributeExtension* iReserved;
       
   192     };
       
   193 
       
   194 #endif      // CCMSAttribute_H
       
   195 
       
   196 // End of File