omadrm/drmengine/server/inc/DRMXOma.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Datatype for the X-Oma header data
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DRMXOMA_H
       
    20 #define DRMXOMA_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class RReadStream;
       
    34 class RWriteStream;
       
    35 
       
    36 // TYPE DEFINITIONS
       
    37 
       
    38 // FUNCTION PROTOTYPES
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  CDRMXOma implements a datatype for the x-oma data for a single
       
    44 *  content identifier
       
    45 *
       
    46 *  @lib RightsServer.dll
       
    47 *  @since 2.6
       
    48 */
       
    49 
       
    50 class CDRMXOma : public CBase 
       
    51     {
       
    52     
       
    53     public: // Constructors and destructor
       
    54         
       
    55         /**
       
    56         * NewLC
       
    57         *
       
    58         * Creates an instance of the CDRMXOma class and returns a pointer 
       
    59         * to it. The function leaves the object into the cleanup stack
       
    60         *
       
    61         * @since    3.0
       
    62         * @param    aContentID : Content Identifier
       
    63         * @param    aTimeStamp : Time stamp the the object
       
    64         * @param    aWaitTime : The wait time in seconds to wait for the rights object
       
    65         * @return   Functional CDRMXOma object, Function leaves if an error 
       
    66         *           occurs.
       
    67         */
       
    68         static CDRMXOma* NewLC( const TDesC8& aContentID,
       
    69                                 const TTime& aTimeStamp,
       
    70                                 const TTimeIntervalSeconds& aWaitTime );
       
    71         
       
    72         /**
       
    73         * NewL
       
    74         *
       
    75         * Creates an instance of the CDRMXOma class and returns a pointer 
       
    76         * to it.
       
    77         *
       
    78         * @since    3.0
       
    79         * @param    aContentID : Content Identifier
       
    80         * @param    aTimeStamp : Time stamp the the object
       
    81         * @param    aWaitTime : The wait time in seconds to wait for the rights object
       
    82         * @return   Functional CDRMXOma object, Function leaves if an error 
       
    83         *           occurs.
       
    84         */
       
    85         static CDRMXOma* NewL( const TDesC8& aContentID,
       
    86                                const TTime& aTimeStamp,
       
    87                                const TTimeIntervalSeconds& aWaitTime );
       
    88           
       
    89 
       
    90         
       
    91         /**
       
    92         * NewLC
       
    93         *
       
    94         * Creates an instance of the CDRMXOma class and returns a pointer 
       
    95         * to it. The function leaves the object into the cleanup stack
       
    96         *
       
    97         * @since    3.0
       
    98         * @return   Functional CDRMXOma object, Function leaves if an error 
       
    99         *           occurs.
       
   100         */
       
   101         static CDRMXOma* NewLC();
       
   102         
       
   103         /**
       
   104         * NewL
       
   105         *
       
   106         * Creates an instance of the CDRMXOma class and returns a pointer 
       
   107         * to it.
       
   108         *
       
   109         * @since    3.0
       
   110         * @return   Functional CDRMXOma object, Function leaves if an error 
       
   111         *           occurs.
       
   112         */
       
   113         static CDRMXOma* NewL();
       
   114 
       
   115         /**
       
   116         * Destructor
       
   117         */
       
   118         virtual ~CDRMXOma();
       
   119         
       
   120         
       
   121         /**
       
   122         * ContentID
       
   123         * 
       
   124         * Returns a constant TDesC8 reference to the content id
       
   125         *
       
   126         * @since    3.0
       
   127         * @return   a pointer to the content id or null
       
   128         */        
       
   129         const TDesC8& ContentID() const;
       
   130         
       
   131         
       
   132         /**
       
   133         * TimeStamp
       
   134         * 
       
   135         * Returns a constant TTime reference to the time stamp
       
   136         *
       
   137         * @since    3.0            
       
   138         * @return   a pointer to the rights issuer or null
       
   139         */         
       
   140         const TTime& TimeStamp() const;
       
   141 
       
   142         /**
       
   143         * WaitTime
       
   144         *
       
   145         * Return a constant TTimeIntervalSeconds reference to the wait time
       
   146         *
       
   147         * @since    3.0
       
   148         * @return   a pointer to the content name or null 
       
   149         */
       
   150         const TTimeIntervalSeconds& WaitTime() const;
       
   151 
       
   152         /**
       
   153         * SetContentIDL
       
   154         * 
       
   155         * Sets the content id, deletes the previous one if one
       
   156         * exits
       
   157         *
       
   158         * @since    3.0
       
   159         * @param    aContentID : Content Identifier        
       
   160         * @return   The function leaves with Symbian OS error code if an
       
   161         *           error occurs
       
   162         */        
       
   163         void SetContentIDL( const TDesC8& aContentID );
       
   164         
       
   165         
       
   166         /**
       
   167         * SetTimeStampL
       
   168         * 
       
   169         * Sets the rights issuer, deletes the previous one if one
       
   170         * exits
       
   171         *
       
   172         * @since    3.0
       
   173         * @param    aTimeStamp : Timestamp of the insertion time         
       
   174         * @return   The function leaves with Symbian OS error code if an
       
   175         *           error occurs
       
   176         */         
       
   177         void SetTimeStampL( const TTime& aTimeStamp );
       
   178         
       
   179         
       
   180         /**
       
   181         * SetWaitTimeL
       
   182         *
       
   183         * Sets the wait time, overwrites the previous one
       
   184         *
       
   185         * @since    3.0
       
   186         * @param    aWaitTime : the wait time to replace the existing one
       
   187         * @return   The function leaves with Symbian OS error code if an
       
   188         *           error occurs
       
   189         */
       
   190         void SetWaitTimeL( const TTimeIntervalSeconds& aWaitTime );
       
   191         
       
   192         /**
       
   193         * ExternalizeL
       
   194         * 
       
   195         * Writes the data of the object into the stream
       
   196         *
       
   197         * @since    3.0
       
   198         * @param    aStream : the output stream to write to
       
   199         * @return   The function leaves with Symbian OS error code if an
       
   200         *           error occurs
       
   201         */
       
   202         void ExternalizeL( RWriteStream& aStream ) const;
       
   203         
       
   204         /**
       
   205         * InternalizeL
       
   206         * 
       
   207         * Reads the data of the object from the stream
       
   208         *
       
   209         * @since    3.0
       
   210         * @param    aStream : the output stream to write to
       
   211         * @return   The function leaves with Symbian OS error code if an
       
   212         *           error occurs
       
   213         */
       
   214         void InternalizeL( RReadStream& aStream );   
       
   215        
       
   216         
       
   217         /**
       
   218         * Size
       
   219         *
       
   220         * Returns the size of the externalized object
       
   221         *
       
   222         * @since    3.0
       
   223         * @return   the amount of bytes the externalize object occupies
       
   224         */           
       
   225         TInt Size() const;
       
   226         
       
   227     private:
       
   228 
       
   229 
       
   230         /**
       
   231         * Default Constructor - First phase.       
       
   232         */
       
   233         CDRMXOma(); 
       
   234     
       
   235         /**
       
   236         * Default Constructor - First phase.
       
   237         * @param    aTimeStamp : Time stamp the the object
       
   238         * @param    aWaitTime : The wait time in seconds to wait for the rights object        
       
   239         */
       
   240         CDRMXOma( const TTime& aTimeStamp, 
       
   241                   const TTimeIntervalSeconds& aWaitTime ); 
       
   242     
       
   243         /**
       
   244         * ConstructL
       
   245         *
       
   246         * Second phase constructor
       
   247         *
       
   248         * @since	3.0
       
   249         * @param    aContentID : Content Identifier
       
   250         * @param    aFileName : File name of the content
       
   251         * @return Functional CDRMXOma object, Function leaves if an error 
       
   252         *         occurs.
       
   253         */  
       
   254         void ConstructL( const TDesC8& aContentID );
       
   255 
       
   256         /**
       
   257         * Assignment operator - Prevented
       
   258         */
       
   259         CDRMXOma& operator =( const CDRMXOma& );    
       
   260     
       
   261         /**
       
   262         * Copy constructor - Prevented
       
   263         */
       
   264         CDRMXOma( const CDRMXOma& );                
       
   265 
       
   266 
       
   267         /**
       
   268         * WriteInt64L
       
   269         * 
       
   270         * Writes the 64 bit integer to the stream
       
   271         *
       
   272         * @since    3.0
       
   273         * @param    aWrite : the 64 bit integer to write
       
   274         * @param    aStream : the output stream to write to
       
   275         * @return   The function leaves with Symbian OS error code if an
       
   276         *           error occurs
       
   277         */
       
   278         void WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const;
       
   279 
       
   280         /**
       
   281         * ReadInt64L
       
   282         * 
       
   283         * Reads the 64 bit integer from the stream
       
   284         *
       
   285         * @since    3.0
       
   286         * @param    aRead : the 64 bit integer read
       
   287         * @param    aStream : the output stream to write to
       
   288         * @return   The function leaves with Symbian OS error code if an
       
   289         *           error occurs
       
   290         */
       
   291         void ReadInt64L( TInt64& aRead, RReadStream& aStream ); 
       
   292 
       
   293     private: // Internal Data
       
   294     
       
   295         // Content identifier of the content
       
   296         HBufC8* iContentID;
       
   297         
       
   298         // Time stamp of insertion of the object
       
   299         TTime iTimeStamp;
       
   300         
       
   301         // Wait time
       
   302         TTimeIntervalSeconds iWaitTime;
       
   303     };
       
   304 
       
   305 #endif      // DRMXOMA_H   
       
   306             
       
   307 // End of File