rtsecuritymanager/inc/rtsecmgrmsg.h
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2007-2008 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 the License "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 
       
    22 
       
    23 
       
    24 #ifndef _RTSECMGRMSG_H
       
    25 #define _RTSECMGRMSG_H
       
    26 
       
    27 // INCLUDES
       
    28 #include <e32std.h>
       
    29 #include <e32base.h>
       
    30 #include <s32strm.h>
       
    31 #include <s32mem.h>
       
    32 #include <rtsecmgrcommondef.h>
       
    33 
       
    34 // Maximum size expected for iHashMarker in CRTSecMgrRegisterScriptMsg
       
    35 const TInt KMaxHashValueDesLen = 255;
       
    36 
       
    37 // Maximum total size expected for a CRTSecMgrRegisterScriptMsg object
       
    38 const TInt KMaxMsgLength = 520;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  *  Message type to pass script object across
       
    44  *  client server boundary
       
    45  * 
       
    46  */
       
    47 NONSHARABLE_CLASS(CRTSecMgrRegisterScriptMsg) : public CBase
       
    48 	{
       
    49 public:
       
    50 
       
    51 	/**
       
    52 	 * Destructor.
       
    53 	 */
       
    54 	IMPORT_C ~CRTSecMgrRegisterScriptMsg();
       
    55 
       
    56 	/**
       
    57 	 * Two-phased constructor.
       
    58 	 * 
       
    59 	 * Creates an instance of CRTSecMgrRegisterScriptMsg.
       
    60 	 * 
       
    61 	 * 
       
    62 	 * @param aPolicyID policy identifier of script
       
    63 	 * @param aHashValue hash value of script
       
    64 	 * 
       
    65 	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg
       
    66 	 * 
       
    67 	 */
       
    68 	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewL(TPolicyID aPolicyID, const TDesC& aHashValue);
       
    69 
       
    70 	/**
       
    71 	 * Two-phased constructor. 
       
    72 	 * 
       
    73 	 * Creates an instance of CRTSecMgrRegisterScriptMsg
       
    74 	 * and leaves it on cleanupstack
       
    75 	 * 
       
    76 	 * @param aPolicyID policy identifier of script
       
    77 	 * @param aHashValue hash value of script
       
    78 	 * 
       
    79 	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg
       
    80 	 * 
       
    81 	 */
       
    82 	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(TPolicyID aPolicyID, const TDesC& aHashValue);
       
    83 
       
    84 	/**
       
    85 	 * Two-phased constructor. 
       
    86 	 * 
       
    87 	 * Creates an instance of CRTSecMgrRegisterScriptMsg
       
    88 	 * from the input source
       
    89 	 * 
       
    90 	 * @param aStreamData input source data
       
    91 	 * 
       
    92 	 * @return CRTSecMgrRegisterScriptMsg* created instance of CRTSecMgrRegisterScriptMsg 
       
    93 	 * 
       
    94 	 */
       
    95 	IMPORT_C static CRTSecMgrRegisterScriptMsg* NewLC(const TDesC8& aStreamData);
       
    96 
       
    97 	/*
       
    98 	 * Creates an HBufC8 representation of CRTSecMgrRegisterScriptMsg
       
    99 	 * 
       
   100 	 * @return HBufC8* buffer representation of CRTSecMgrRegisterScriptMsg
       
   101 	 */
       
   102 	IMPORT_C HBufC8* PackMsgL() const;
       
   103 
       
   104 	/*
       
   105 	 * Gets the hash value of the script
       
   106 	 * 
       
   107 	 * @return const TDesC8& hash value of script
       
   108 	 */
       
   109 	inline const TDesC& HashValue() const
       
   110 		{
       
   111 		if(iHashMarker)
       
   112 		return *iHashMarker;
       
   113 		else
       
   114 		return KNullDesC;
       
   115 		}
       
   116 
       
   117 	/*
       
   118 	 * Gets the policy identifier
       
   119 	 * 
       
   120 	 * @return TPolicyID policy identifier
       
   121 	 */
       
   122 	inline TPolicyID PolicyID() const
       
   123 		{
       
   124 		return iPolicyID;
       
   125 		}
       
   126 
       
   127 protected:
       
   128 	// Writes ’this’ to the stream
       
   129 	void ExternalizeL(RWriteStream& aStream) const;
       
   130 	// Initializes ’this’ from stream
       
   131 	void InternalizeL(RReadStream& aStream);
       
   132 
       
   133 private:
       
   134 
       
   135 	/**
       
   136 	 * Constructor for performing 1st stage construction
       
   137 	 */
       
   138 	CRTSecMgrRegisterScriptMsg()
       
   139 		{}
       
   140 
       
   141 	/**
       
   142 	 * Constructor for performing 1st stage construction
       
   143 	 */
       
   144 	CRTSecMgrRegisterScriptMsg(TPolicyID aPolicyID);
       
   145 
       
   146 	/**
       
   147 	 * Second stage construction
       
   148 	 */
       
   149 	void ConstructL(const TDesC& aHashValue);
       
   150 
       
   151 private:
       
   152 	/*
       
   153 	 * Policy identifier
       
   154 	 * 
       
   155 	 */
       
   156 	TPolicyID iPolicyID;
       
   157 
       
   158 	/*
       
   159 	 * Hash value of the script
       
   160 	 * 
       
   161 	 */
       
   162 	HBufC* iHashMarker;
       
   163 	};
       
   164 
       
   165 NONSHARABLE_CLASS(CRTPermGrantMessage) : public CBase
       
   166     {
       
   167     public:
       
   168         /**
       
   169          * Destructor.
       
   170          */
       
   171         IMPORT_C virtual ~CRTPermGrantMessage();
       
   172         
       
   173         /**
       
   174          * Two-phased constructor.
       
   175          * 
       
   176          * Creates an instance of CRTPermGrantMessage.
       
   177          */
       
   178         IMPORT_C static CRTPermGrantMessage* NewL();
       
   179         
       
   180         /**
       
   181          * Two-phased constructor. 
       
   182          * 
       
   183          * Creates an instance of CRTPermGrantMessage
       
   184          * and leaves it on cleanupstack
       
   185          */
       
   186         IMPORT_C static CRTPermGrantMessage* NewLC();
       
   187                 
       
   188         /**
       
   189          * Two-phased constructor. 
       
   190          * 
       
   191          * Creates an instance of CRTPermGrantMessage
       
   192          * from the input source
       
   193          * 
       
   194          * @param aBuf input source data
       
   195          * 
       
   196          * @return CRTPermGrantMessage* created instance of CRTPermGrantMessage 
       
   197          * 
       
   198          */
       
   199         IMPORT_C static CRTPermGrantMessage* NewL(const TDesC8& aBuf);
       
   200         
       
   201         /**
       
   202          * Two-phased constructor. 
       
   203          * 
       
   204          * Creates an instance of CRTPermGrantMessage
       
   205          * from the input source and leaves it on cleanup stack
       
   206          * 
       
   207          * @param aBuf input source data
       
   208          * 
       
   209          * @return CRTPermGrantMessage* created instance of CRTPermGrantMessage 
       
   210          * 
       
   211          */
       
   212         IMPORT_C static CRTPermGrantMessage* NewLC(const TDesC8& aBuf);
       
   213         
       
   214         /**
       
   215          * Two-phased constructor. 
       
   216          * 
       
   217          * Creates an instance of CRTPermGrantMessage
       
   218          * 
       
   219          * @param aAllowedProviders RProviderArray Allowed service providers
       
   220          * @param aDeniedProviders RProviderArray Denied service providers
       
   221          * @param aScriptId TExecutableID script identifier
       
   222          * @return CRTPermGrantMessage* created instance of CRTPermGrantMessage 
       
   223          * 
       
   224          */
       
   225         IMPORT_C static CRTPermGrantMessage* NewL(RProviderArray aAllowedProviders, RProviderArray aDeniedProviders,TExecutableID aScriptId);
       
   226         
       
   227         /**
       
   228          * Two-phased constructor. 
       
   229          * 
       
   230          * Creates an instance of CRTPermGrantMessage and leaves it on the cleanup stack
       
   231          * 
       
   232          * @param aAllowedProviders RProviderArray Allowed service providers
       
   233          * @param aDeniedProviders RProviderArray Denied service providers
       
   234          * @param aScriptId TExecutableID script identifier
       
   235          * @return CRTPermGrantMessage* created instance of CRTPermGrantMessage 
       
   236          * 
       
   237          */
       
   238         IMPORT_C static CRTPermGrantMessage* NewLC(RProviderArray aAllowedProviders, RProviderArray aDeniedProviders,TExecutableID aScriptId);
       
   239         
       
   240         /**
       
   241          * Get Method.
       
   242          * 
       
   243          * Gets the list of Allowed providers
       
   244          * 
       
   245          * @param aAllowedProviders RProviderArray In/Out parameter which will contain the list of allowed providers
       
   246          */
       
   247         IMPORT_C void AllowedProviders(RProviderArray& aAllowedProviders);
       
   248         
       
   249         /**
       
   250          * Get Method.
       
   251          * 
       
   252          * Gets the list of Allowed providers
       
   253          * 
       
   254          * @param aDeniedProviders RProviderArray In/Out parameter which will contain the list of denied providers
       
   255          */
       
   256         IMPORT_C void DeniedProviders(RProviderArray& aDeniedProviders);
       
   257         
       
   258         /**
       
   259          * Get Method
       
   260          * 
       
   261          * Gets the script Identifier.
       
   262          * 
       
   263          * @return TExecutableID the script identifier
       
   264          */
       
   265         IMPORT_C TExecutableID ScriptID();
       
   266         
       
   267         /**
       
   268          * Set Method.
       
   269          * 
       
   270          * Sets the list of Allowed providers
       
   271          * 
       
   272          * @param aAllowedProviders RProviderArray input parameter which contains the list of allowed providers
       
   273          */
       
   274         IMPORT_C void setAllowedProviders(RProviderArray aAllowedProviders);
       
   275         
       
   276         /**
       
   277          * Set Method.
       
   278          * 
       
   279          * Sets the list of Denied providers
       
   280          * 
       
   281          * @param aDeniedProviders RProviderArray input parameter which contains the list of denied providers
       
   282          */
       
   283         IMPORT_C void setDeniedProviders(RProviderArray aDeniedProviders);
       
   284         
       
   285         /**
       
   286          * Set Method
       
   287          * 
       
   288          * Sets the script Identifier.
       
   289          * 
       
   290          * @param TExecutableID the script identifier
       
   291          */
       
   292         IMPORT_C void setScriptID(TExecutableID aScriptId);
       
   293         
       
   294         /*
       
   295          * Creates an HBufC8 representation of CRTPermGrantMessage
       
   296          * 
       
   297          * @return HBufC8* buffer representation of CRTPermGrantMessage
       
   298          */
       
   299         IMPORT_C HBufC8* PackMessageL();
       
   300         
       
   301     private:
       
   302         CRTPermGrantMessage();
       
   303         CRTPermGrantMessage(RProviderArray aAllowedProviders,RProviderArray aDeniedProviders,TExecutableID aScriptId);
       
   304         void ConstructL(const TDesC8& aBuf);
       
   305         void InternalizeL(RReadStream& aSink);
       
   306         void ExternalizeL(RWriteStream& aSource);
       
   307     private:
       
   308         RProviderArray iAllowedProviders;
       
   309         RProviderArray iDeniedProviders;
       
   310         TExecutableID iScriptId;
       
   311     };
       
   312 
       
   313 #endif // RTSECMGRMSG_H
       
   314